Closed
Description
Description
Uncaught TypeError: strlen() expects parameter 1 to be string, null given in dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php:667
When a function does have 2 or more parameter in the doc head and one of them have no specified type a PHP Fatal Error occures.
Steps to reproduce
- Create a function that looks like:
/**
* Helpermethod
*
* @param AInterface $a
* @param $b
*/
private function example($a, $b)
- run code style check with
vendor/bin/phpcs --warning-severity=6 ExampleClass.php --extensions=php --standard=src/dev/tests/static/framework/Magento/ruleset.xml
- See PHP Fatal Error in console
Expected result
- <line_number> | ERROR | Type is not specified
Actual result
PHP Fatal error: Uncaught TypeError: strlen() expects parameter 1 to be string, null given in /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php:667
Stack trace:
#0 /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php(667): strlen(NULL)
#1 /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php(630): Magento\Sniffs\Annotation\MethodArgumentsSniff->noneParamsAligned(Array, Array, Array)
#2 /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php(519): Magento\Sniffs\Annotation\MethodArgumentsSniff->validateFormattingConsistency(Array, Array, Object(PHP_CodeSniffer\Files\LocalFile), Array)
#3 /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php(596): Magento\Sniffs\Anno in /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php on line 667
Fatal error: Uncaught TypeError: strlen() expects parameter 1 to be string, null given in /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php on line 667
TypeError: strlen() expects parameter 1 to be string, null given in /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php on line 667
Call Stack:
0.0133 390448 1. {main}() /vendor/squizlabs/php_codesniffer/bin/phpcs:0
0.1076 402440 2. PHP_CodeSniffer\Runner->runPHPCS() /vendor/squizlabs/php_codesniffer/bin/phpcs:18
0.2946 1576928 3. PHP_CodeSniffer\Runner->run() /vendor/squizlabs/php_codesniffer/src/Runner.php:114
0.3042 1674624 4. PHP_CodeSniffer\Runner->processFile(???) /vendor/squizlabs/php_codesniffer/src/Runner.php:434
0.3042 1674624 5. PHP_CodeSniffer\Files\LocalFile->process() /vendor/squizlabs/php_codesniffer/src/Runner.php:630
0.3042 1674624 6. PHP_CodeSniffer\Files\LocalFile->process() /vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php:91
1.2115 3261856 7. Magento\Sniffs\Annotation\MethodArgumentsSniff->process(???, ???) /vendor/squizlabs/php_codesniffer/src/Files/File.php:496
1.2119 3264640 8. Magento\Sniffs\Annotation\MethodArgumentsSniff->validateMethodParameterAnnotations(???, ???, ???, ???, ???, ???, ???) /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php:596
1.2120 3264640 9. Magento\Sniffs\Annotation\MethodArgumentsSniff->validateFormattingConsistency(???, ???, ???, ???) /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php:519
1.2120 3265392 10. Magento\Sniffs\Annotation\MethodArgumentsSniff->noneParamsAligned(???, ???, ???) /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php:630
4.4818 3266952 11. strlen(???) /src/dev/tests/static/framework/Magento/Sniffs/Annotation/MethodArgumentsSniff.php:667