use stable php-parser with arrow functoin

This commit is contained in:
Tomas Votruba 2019-05-11 15:07:00 +02:00
parent 47ff59851a
commit 83f527d571
4 changed files with 12 additions and 1 deletions

View File

@ -11,7 +11,7 @@
"jetbrains/phpstorm-stubs": "^2019.1",
"nette/robot-loader": "^3.1",
"nette/utils": "^2.5|^3.0",
"nikic/php-parser": "dev-master",
"nikic/php-parser": "^4.2.1",
"phpstan/phpdoc-parser": "0.3.3",
"phpstan/phpstan": "0.11.6",
"sebastian/diff": "^3.0",

View File

@ -59,6 +59,10 @@ CODE_SAMPLE
*/
public function refactor(Node $node): ?Node
{
if (! class_exists('PhpParser\Node\Expr\ArrowFunction')) {
return null;
}
if (! $this->isAtLeastPhpVersion('7.4')) {
return null;
}

View File

@ -9,6 +9,10 @@ final class ClosureToArrowFunctionRectorTest extends AbstractRectorTestCase
{
public function test(): void
{
if (! class_exists('PhpParser\Node\Expr\ArrowFunction')) {
$this->markTestSkipped('Wait on php-parser release');
}
$this->doTestFiles([
__DIR__ . '/Fixture/fixture.php.inc',
__DIR__ . '/Fixture/referenced_but_not_used.php.inc',

View File

@ -158,3 +158,6 @@ parameters:
- '#Anonymous function should have native typehint "string"#'
- '#Parameter \#2 \.\.\.\$args of function array_merge expects array, array<int, string\>\|false given#'
- '#Method Rector\\Collector\\CallableCollectorPopulator\:\:populate\(\) should return array<Closure\> but returns array<int\|string, callable\>#'
# waits on php-parser release
- '#ArrowFunction#'