Try php-parser:dev-master (5-dev)
This is just to see possible upgrade needed when use php-parser 5, beside looking on changelog, as php-parser 5 is based on dev-master
The vendor-patches error is due to class Closure movement from Expr to below Node directly.
- Applying patches for nikic/php-parser
https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-expr-closure-php.patch (0)
Could not apply patch! Skipping. The error was: Cannot apply patch
https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-expr-closure-php.patch
Error: Cannot apply patch 0 (https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-expr-closure-php.patch)!
In Patches.php line 326:
Cannot apply patch 0 (
https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-expr-closure-php.pat
It seems for Closure change, the change is on placing { on the right:
https://github.com/rectorphp/vendor-patches/commit/3e279f85ee049662385baa8ca9719d90ed58f846
The php-parser dev-master with vendor-patch is now installable, the preload config seems needs update:
➜ rector-src git:(try-php-parser-master) php build/build-preload.php .
➜ rector-src git:(try-php-parser-master) ✗ php preload.php
PHP Fatal error: Cannot declare class PhpParser\Node\ArrayItem, because the name is already in use in /Users/samsonasik/www/rector-src/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php on line 7
Fatal error: Cannot declare class PhpParser\Node\ArrayItem, because the name is already in use in /Users/samsonasik/www/rector-src/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php on line 7
I've updated preload script to regenerate preload.php with various Node that moved to under Node
@TomasVotruba I updated vendor-patches to make php-parser dev-master (5-dev) installable.
@ondrejmirtes I updated preload.php for handling movement of various Node Stmt/Expr to under Node directly, the following error seems require update in PHPStan side for update:
Run php ../e2eTestRunner.php
PHP Fatal error: Class PHPStan\Parser\PhpParserDecorator contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PhpParser\Parser::getLexer) in phar:///home/runner/work/rector-src/rector-src/vendor/phpstan/phpstan/phpstan.phar/src/Parser/PhpParserDecorator.php on line 11
Fatal error: Class PHPStan\Parser\PhpParserDecorator contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PhpParser\Parser::getLexer) in phar:///home/runner/work/rector-src/rector-src/vendor/phpstan/phpstan/phpstan.phar/src/Parser/PhpParserDecorator.php on line 11
see https://github.com/rectorphp/rector-src/runs/8220121936?check_suite_focus=true#step:8:9
Im watching the progress with excitement... keep it going 😊
Rebased and regenerate preload files https://github.com/rectorphp/rector-src/pull/2916/commits/705cffba522a40d4ca99ea1e192b06ff9bdd6274
Thanks for the probe :+1: Closing for now, untill the php-parser 5 is released with PHPStan onboard and we can finish it easily.