Comments (12)
The problem is in imports (Request
class and request
function), not in variable name. I believe this will be fixed with #7704 / #7705 (depending on the chosen implementation), because imports will be sorted by kind. Now all the imports are collected into one list, which makes the matching inaccurate (last one is used). However, in terms of ::class
it will always be somehow inaccurate, because we're probably going to treat all these usages related to class imports (because Fixer is rather unable to determine proper context).
from php-cs-fixer.
@soyuka #7749 should fix the 1st change in your example.
from php-cs-fixer.
@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, OperationMetadataFactoryInterface
is from the same namespace as OperationMetadataFactory
so it's not in imports and is treated like something that should be compared with the existing imports. Since there's also use ApiPlatform\Metadata\Operation;
, which is a class with FQCN which is a substring of OperationMetadataFactoryInterface
's FQCN, it was wrongly replaced with relative reference. Fix in #7752.
I'll take a look at 3rd one too 🙂.
from php-cs-fixer.
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.
from php-cs-fixer.
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}
from php-cs-fixer.
@dkrnl your case is rather related to #7721, as FQCN was shortened using relative name based on use Yii;
.
from php-cs-fixer.
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.
from php-cs-fixer.
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.
from php-cs-fixer.
@soyuka if you're so kind and verify if these PRs fix the problem then would be great 🙂.
from php-cs-fixer.
Quick fix was provided, proper support for import kinds will land later.
from php-cs-fixer.
Indeed it fixes some of my issues, I ran #7705 and #7704 but I still have issues with uppercases.
Should I open new issues for these?
from php-cs-fixer.
@soyuka the 3rd one looks like an actual fix 😅. In DoctrineExtractorTest
you have use Symfony\Component\PropertyInfo\Type;
and there are many Type::BUILTIN_TYPE_*
usages, but that one TYPE::BUILTIN_TYPE_INT
has wrong casing. Was it there on purpose and should remain like this? Because otherwise IMHO it's good that the casing was fixed.
from php-cs-fixer.
Related Issues (20)
- https://cs.symfony.com/doc/installation.html website not in line with latest version HOT 1
- `?xxx` to `xxx|null` for phpdoc fixer HOT 1
- Method chaining must be fully multiline, with the first item on a new line HOT 1
- Add `general_attribute_remove` similar to `general_phpdoc_annotation_remove`
- Wrong type annotation in Config HOT 6
- Analyzer/Analysis/* - constructor shall not be part of BC promise
- `numeric_literal_separator` converts floats to ints
- Test class links in web are broken HOT 1
- `/doc/rules/index.rst` fails to render on GitHub HOT 6
- Make `single_line_empty_body` fix control structures HOT 10
- Incompatible with phpunit 11 HOT 1
- `no_useless_concat_operator` rule may break code
- Identation reapplied by each pass/rerun HOT 3
- Convert `array<V>` phpdoc to `array<array-key, V>` HOT 4
- statement_indentation with stick_comment_to_next_continuous_control_statement isn't honored? HOT 2
- Backtrack limit exhausted HOT 3
- `method_argument_space`: allow separating arguments with empty lines
- `&` bitwise operator is interpreted as "reference" operator by `unary_operator_spaces`
- statement_indentation doesn't like multiline const
- `multiline_whitespace_before_semicolons` doesn't work with multiline const
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-cs-fixer.