You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think NullableTypeDeclarationForDefaultNullValueFixer crashes when I'm trying to add readonly modifier to nullable parameter in promoted constructor.
PHP CS Fixer version: PHP CS Fixer 3.4.0 Si! by Fabien Potencier and Dariusz Ruminski
the command used to run PHP CS Fixer (run with -vvv):
PHP CS Fixer 3.4.0 Si! by Fabien Potencier and Dariusz Ruminski
Runtime: PHP 8.1.0
Loaded config default.
Using cache file ".php-cs-fixer.cache".
E 1 / 1 (100%)
Legend: ?-unknown, I-invalid file syntax (file ignored), S-skipped (cached or empty file), .-no changes, F-fixed, E-error
Fixed all files in 0.004 seconds, 12.000 MB memory used
Files that were not fixed due to errors reported during linting after fixing:
1) /application/src/ReadonlyThing.php
[PhpCsFixer\Linter\LintingException]
Parse error: syntax error, unexpected token "readonly" on line 11.
Applied fixers: nullable_type_declaration_for_default_null_value
ERROR: 64
Looking at your example I wonder why the tool tries to fix the code as it does not lint:
$ sudo docker-compose run --rm --user "$(id --user):$(id --group)" php php -l test2.php
Fatal error: Cannot use null as default value for parameter $nullable of type bool in test2.php on line 5
$ sudo docker-compose run --rm --user "$(id --user):$(id --group)" php php -v
PHP 8.1.0 (cli) (built: Dec 2 2021 12:47:04) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.0, Copyright (c) Zend Technologies
I think
NullableTypeDeclarationForDefaultNullValueFixer
crashes when I'm trying to addreadonly
modifier to nullable parameter in promoted constructor.Bug report
-vvv
):Code snippet that reproduces the problem
Expected output
Btw. when it's used with easy-coding-standard, it's even worse:
The text was updated successfully, but these errors were encountered: