-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbols' casing is changed when there's name collision between imported class and imported function #7744
Comments
The problem is in imports ( |
similar bug with namespace -- replaced lower case to upper case controllers/AbstractController.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/controllers/AbstractController.php b/controllers/AbstractController.php
index d589486e..7b238d0e 100644
--- a/controllers/AbstractController.php
+++ b/controllers/AbstractController.php
@@ -9,7 +9,7 @@ use Yii;
*
*/
-abstract class AbstractController extends \yii\web\Controller
+abstract class AbstractController extends Yii\web\Controller
{
/**
* {@inheritdoc}
|
A similar issue (though I'm not sure if the root cause is the same) occurs in this case. Note how the property name now starts with a capital letter (like the class name that's being imported). Foo.php (fully_qualified_strict_types)
---
use Bar\LanguageService;
public function __construct(
private readonly LanguageService $languageService,
) {
}
- $locale = $this->languageService::get(
+ $locale = $this->LanguageService::get( Apologies for the redacted diff/excerpt. |
HI @Wirone do you want me to test these patches? Note that this is happening in more then one case I took the simplest one, see https://github.com/api-platform/core/actions/runs/7534511533/job/20509019181. |
static
keyword is used.
Quick fix was provided, proper support for import kinds will land later. |
@soyuka as @kubawerlos said, 1st is already fixed. As for the 2nd: clear bug, fixer should not prefer relative FQNs over short names. As far as I see, I'll take a look at 3rd one too 🙂. |
@soyuka the 3rd one looks like an actual fix 😅. In |
No way my bad on the third one I thought that php-cs-fixer changed my Type to TYPE I must have then misread. Thanks! I've tested the patch at #7752 and it works. |
Bug report
Description
There's a weird behavior when a variable has the same name as an imported class, and where this class is used via the static operator
::
.Runtime version
Configuration file
https://github.com/api-platform/core/blob/main/.php-cs-fixer.dist.php
Code snippet that reproduces the problem
Before:
After:
The text was updated successfully, but these errors were encountered: