- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.1k
Closed
Description
Hello,
I've worked today to make a package compatible with both PHP-Parser 4.18 and 5.0
I've detected an issue on (I know old platform PHP 7.4, but this package is still compatible PHP 7). Here are the details of my analysis
When PHP-Parser 5.0.0 is installed with PHP_CodeSniffer (3.9.0 in my situation), I got a TypeError
TypeError: Argument 1 passed to PhpParser\Internal\TokenPolyfill::__construct() must be of the type int, string given, called in /shared/backups/forks/symbol-parser/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php on line 202
/shared/backups/forks/symbol-parser/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php:42
/shared/backups/forks/symbol-parser/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php:202
/shared/backups/forks/symbol-parser/vendor/nikic/php-parser/lib/PhpParser/Lexer.php:31
/shared/backups/forks/symbol-parser/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php:71
/shared/backups/forks/symbol-parser/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:182
/shared/backups/forks/symbol-parser/src/Parser/PHP/SymbolNameParser.php:41
/shared/backups/forks/symbol-parser/tests/Integration/Parser/PHP/SymbolNameParserTest.php:42
Version 5.0 is supposed to be compatible with PHP 7.4 min (see https://github.com/nikic/PHP-Parser/blob/v5.0.0/composer.json#L16-L17)
But :
- T_NAME_QUALIFIEDhttps://github.com/nikic/PHP-Parser/blob/v5.0.0/lib/PhpParser/Internal/TokenPolyfill.php#L200 was introduced on PHP 8.0.0beta1
- T_NAME_RELATIVEhttps://github.com/nikic/PHP-Parser/blob/v5.0.0/lib/PhpParser/Internal/TokenPolyfill.php#L198 was introduced on PHP 8.0.0beta1
- T_NAME_FULLY_QUALIFIEDhttps://github.com/nikic/PHP-Parser/blob/v5.0.0/lib/PhpParser/Internal/TokenPolyfill.php#L196 was introduced on PHP 8.0.0beta1
Reason is PHPCS define these tokens as string.
And TokenPolyfill first argument of class constructor is int
Hope my explains are enough clear ?
Metadata
Metadata
Assignees
Labels
No labels