-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Parallel running with multiple file directives leads to "passing null to non-nullable" notice on PHP 8.1 #3677
Comments
@Kleinast Could you please elaborate how you got this deprecation notice and how it can be reproduced ?
|
We use composer
running from cli
we are using this package for ruleset https://github.com/Geolid/phpcs
Not sure what you mean by external standards |
I'll have a look see, but may still need more information.
Just FYI: |
Tried to reproduce and failed.
Ran with PHPCS In other words, please post an exact reproduction scenario as, as things are, the issue is not reproducible.
The |
Note: I do see some weird stuff going on in that repo, but not sure if it is related and you should probably report all that to the maintainers of that package:
Based on this, I have a feeling this is an issue with the external standard you are using doing things wrong and not something which needs to be solved in PHPCS. |
thx a lot for your tests, i'll dig into the geolid/phpcs package or try to reproduce the error on tiny project |
I tryed to dig, and it seem it is linked to the parallel feature, I get no error on whe it is set to 1 and I get some trim() error when more than 1. I think the batches in parrallel may be create some $path = $todo->key(); = null |
I try different configs on my project and found what in my conf create the issue, geolid/phpcs is not the cause I tryed without it.
The error trigger when parallel is more than 1 and I reference this files to check:
If I keep only one of this two file to check, I don't get the error anymore |
Describe the bug
I get an error when run phpcs or phpcs-fix when I upgrade my project on php 8.1.
vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php:32 it seem some path files are "null" in LocalFile->files and php 8.1
PHP Fatal error: Uncaught PHP_CodeSniffer\Exceptions\RuntimeException: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /srv/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php on line 32 in /srv/vendor/squizlabs/php_codesniffer/src/Runner.php:604
Stack trace:
#0 [internal function]: PHP_CodeSniffer\Runner->handleErrors()
#1 /srv/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php(32): trim()
#2 /srv/vendor/squizlabs/php_codesniffer/src/Files/FileList.php(192): PHP_CodeSniffer\Files\LocalFile->__construct()
#3 /srv/vendor/squizlabs/php_codesniffer/src/Runner.php(484): PHP_CodeSniffer\Files\FileList->current()
#4 /srv/vendor/squizlabs/php_codesniffer/src/Runner.php(114): PHP_CodeSniffer\Runner->run()
#5 /srv/vendor/squizlabs/php_codesniffer/bin/phpcs(18): PHP_CodeSniffer\Runner->runPHPCS()
#6 /srv/vendor/bin/phpcs(120): include('...')
#7 {main}
thrown in /srv/vendor/squizlabs/php_codesniffer/src/Runner.php on line 604
Fatal error: Uncaught PHP_CodeSniffer\Exceptions\RuntimeException: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /srv/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php on line 32 in /srv/vendor/squizlabs/php_codesniffer/src/Runner.php on line 604
Versions (please complete the following information):
This small PR seem fix the problem #3676 (but as said in PR, not sure it is a total fix)
The text was updated successfully, but these errors were encountered: