PHP-CS-Fixer: `phpdoc_types_order` corrupts valid phpDoc with `array{}` syntax
Bug report
phpdoc_types_order
tries to apply such changes (or other similar) to Fixer’s codebase:
/**
- * @var null|list<array{class-string<TestCase>}>
+ * @var null|list<array{class-sTestCasestCase>}>
*/
/**
- * @return iterable<array{0: string, 1: null|string, 2?: array<string, mixed>}>
+ * @return iterable<array{stringinmixed null|string, 2?: array<string, mixed>}>
*/
/**
- * @return iterable<array{0: string, 1?: null|string, 2?: array<string, bool>}>
+ * @return iterable<array{stringinbool?: null|string, 2?: array<string, bool>}>
*/
CC: @paulbalandan and maybe @mvorisek (parsing phpDoc?).
Runtime version
PHP CS Fixer 3.17.1-DEV Brazilian Kangaroo by Fabien Potencier and Dariusz Ruminski. PHP runtime: 8.2.4
Used command
./php-cs-fixer fix --verbose --diff --dry-run --rules=phpdoc_types_order
on this repo.
Configuration file
Default project’s config.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (12 by maintainers)
This is not only my repository, but all RPMs (Fedora, RHEL, CentOS…)
This is an old issue related to security (SElinux) IIRC this is about the execution of code not in executable memory (data)
Also not supported on some arches:
@mvorisek I don’t need to retest - it fails in both scenarios for me, because of
PCRE JIT Support => not compiled in
🤷♂️. It’s either because ARM architecture orasdf
’s PHP builds, I don’t know. Fortunately it works through Docker setup provided in the repo 😉.That’s okay, in case you still need it: https://github.com/mvhirsch/php-cs-fixer-reproducer
I never thought about that. I’ve installed remi’s php packages 'cause of modularity (using multiple versions on same machine).
I have never configured PCRE on my machine.
incase-sensitive search 🤦
I’m preparing a reproducing-repository 👍
I’m having the same issue on my Fedora 37, using PHP 8.2.6. This just started to happen a few weeks ago, but I weren’t able to find the source/change on my machine. PCRE is the first useful hint 😃
Running with
-d pcre.jit=1
seems to fix the problem on my machine.Tests fail with exact same output as in https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/6997#issuecomment-1566067284, but running with
php -d pcre.jit=1 vendor/bin/phpunit tests/DocBlock/TypeExpressionTest.php
everything’s green:I have M1, and your test does not pass for me:
Same with
-dpcre.jit=1
.