Closed ghost closed 2 years ago
Hmmm, does ECS somehow compile php-cs-fixer files and dumps it's own? Does it replace polyfill functions? I can see that the original AbstractRepositoryFixer::normalizeType
has different code than the ECS's one.
Does ECS 10.1.4 use the latest symfony/polyfill-* versions when compiling?
ECS is downgraded on the release to PHP 7.1 syntax.
Ok. Then the question that remains is whether ECS downgrade process uses the latest polyfill versions. Because if not then we do not have the most recent fixes included in the dumped code that is finally used when running fixers.
That depends on the choice of composer. Here is the job run if that helps: https://github.com/symplify/symplify/runs/5572273146?check_suite_focus=true#step:7:76
The ECS itself does not use any polyfills as developed on PHP 8.0: https://github.com/symplify/symplify/blob/171595216c64f839eefccf5e1384296d093ebcfe/packages/easy-coding-standard/composer.json#L8-L28
Polyfills might work propperly in a project. But downgrade and scoping requires clear settings of composer autoload, where polyfills hack in. Mostly due to aliasing and way the scoper creates prefixed functions. Thus they're avoided and native PHP downgraded code is used.
I would be grateful if the issues stay open until the author is satisfied with an answer. Closing issue asap is not the way to go.
I can see drawbacks with this approach for downgrading polyfilled code. Look at this: if php-cs-fixer uses symfony/polyfill-* then it's code works properly with this specific polyfill code. If ECS downgrades polyfilled functions in another way then php-cs-fixer may not work properly. Good example is https://github.com/symfony/polyfill-php80/blob/f4386d7f6f66346254ed4e6bfa4354d2d16b83f8/Php80.php#L101 while ECS's code downgraded str_ends_with
function the other way.
Do you say that I should use prefixed ECS? If so then how do I install it in my project so I have the exact code as if no downgrade would happend?
I answered in the 1st comment: https://github.com/symplify/symplify/issues/4010#issuecomment-1069668487
If you find a better way that works on downgraded and prefixed code, we'd love to merge such PR :+1:
I try to upgrade ECS in my project but when running I receive tons of warnings PHP Warning: substr_compare(): The start position cannot exceed initial string length in vendor/symplify/easy-coding-standard/vendor/friendsofphp/php-cs-fixer/src/AbstractPhpdocTypesFixer.php on line 105
These warnings do not show up in the standaone php-cs-fixer 3.7.0.
What can we do about this?
This warning starts showing up on 10.0.22. At 10.0.21 it works fine.
I've got this! I had invalid annotations like @param $paramName
without type. When fixed everything is fine. Thank you and have a good day.
I have installed the latest ECS release 10.1.4 which uses php-cs-fixer version 3.7.0 (
PHP_CS_FIXER_IGNORE_ENV=-1 php vendor/symplify/easy-coding-standard/vendor/bin/php-cs-fixer -v
). Then I open filevendor/symplify/easy-coding-standard/vendor/friendsofphp/php-cs-fixer/src/AbstractPhpdocTypesFixer.php
and it's contentExpand
```php * Dariusz Rumińskiis not the same as here AbstractPhpdocTypesFixer.php
What is going on?
My PHP version: 7.2