There are some problems with PHP 7.2.0
Package versions
squizlabs/php_codesniffer 2.9.1
drupal/coder 8.2.12
Configured PHPCS standards:
$ bin/phpcs -i
The installed coding standards are MySource, PEAR, PHPCS, PSR1, PSR2, Squiz, Zend, Drupal and DrupalPractice
Steps to reproduce
When I run the follow command without phpcs.xml.dist or phpcs.xml file.
bin/phpcs --standard=Drupal src/Foo.php
then I get the this error message twice and after that the usual lint report.
Warning: Narrowing occurred during type inference. Please file a bug report on bugs.php.net in /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer.php on line 1409
Call Stack:
0.0007 410936 1. {main}() /projectRoot/vendor/squizlabs/php_codesniffer/scripts/phpcs:0
0.0324 505304 2. PHP_CodeSniffer_CLI->runphpcs() /projectRoot/vendor/squizlabs/php_codesniffer/scripts/phpcs:25
0.0333 506264 3. PHP_CodeSniffer_CLI->process() /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php:113
0.0337 511304 4. PHP_CodeSniffer->initStandard() /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php:956
0.0459 576440 5. PHP_CodeSniffer->registerSniffs() /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer.php:594
When I run the phpcs without the --standard=Drupal option but a phpcs.xml.dist file is exists with the following content
<?xml version="1.0"?>
<ruleset name="DrupalCustom">
<file>Foo.php</file>
<rule ref="Drupal" />
</ruleset>
then I get a lot of notice errors like this:
Notice: Undefined index: in /projectRoot/vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/MultipleStatementAlignmentSniff.php on line 134
Call Stack:
0.0006 410848 1. {main}() /projectRoot/vendor/squizlabs/php_codesniffer/scripts/phpcs:0
0.0309 505216 2. PHP_CodeSniffer_CLI->runphpcs() /projectRoot/vendor/squizlabs/php_codesniffer/scripts/phpcs:25
0.0318 506176 3. PHP_CodeSniffer_CLI->process() /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php:113
0.1128 1509800 4. PHP_CodeSniffer->processFiles() /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php:998
1.7017 4757784 5. PHP_CodeSniffer->processFile() /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer.php:653
1.7018 4757968 6. PHP_CodeSniffer->_processFile() /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer.php:1772
1.7018 4758576 7. PHP_CodeSniffer_File->start() /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer.php:1894
1.7660 5575328 8. Drupal_Sniffs_Formatting_MultipleStatementAlignmentSniff->process() /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer/File.php:576
1.7660 5575328 9. Drupal_Sniffs_Formatting_MultipleStatementAlignmentSniff->checkAlignment() /projectRoot/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php:98
There is no problem with the DrupalPractice standard
Comments
Comment #2
klausiThis should be fixed with the most recent release of Coder. Please upgrade and let us know if you still see errors.