| Subject |
Details |
| Rector version |
v0.5.16 |
| PHP version |
PHP 7.1 |
| Full Command |
docker run -it -v $(pwd):/project rector/rector:0.5.16 process --config=/project/rector.yaml --autoload-file /project/vendir/autoload.php --dry-run --debug /project/xml/Custom/debug/Example.php |
Current Behaviour
[parsing] /project/xml/Custom/debug/Example.php
[refactoring] /project/xml/Custom/debug/Example.php
[applying] Rector\Rector\ClassMethod\AddReturnTypeDeclarationRector
[applying] Rector\Rector\Argument\ArgumentAdderRector
[applying] Rector\Rector\ClassMethod\AddReturnTypeDeclarationRector
[applying] Rector\Rector\Argument\ArgumentAdderRector
Fatal error: Uncaught TypeError: Argument 1 passed to Rector\Rector\AbstractRector::isObjectType() must implement interface PhpParser\Node, null given, called in /rector/src/Rector/Argument/ArgumentAdderRector.php on line 233 and defined in /rector/src/Rector/AbstractRector/NodeTypeResolverTrait.php:38
Stack trace:
#0 /rector/src/Rector/Argument/ArgumentAdderRector.php(233): Rector\Rector\AbstractRector->isObjectType(NULL, 'iwat_util_TaskI...')
#1 /rector/src/Rector/Argument/ArgumentAdderRector.php(108): Rector\Rector\Argument\ArgumentAdderRector->isObjectTypeMatch(Object(PhpParser\Node\Stmt\ClassMethod), 'iwat_util_TaskI...')
#2 /rector/src/Rector/AbstractRector.php(91): Rector\Rector\Argument\ArgumentAdderRector->refactor(Object(PhpParser\Node\Stmt\ClassMethod))
#3 /rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(200): Rector\Rector\AbstractRector->enterNode(Object(PhpParser\Node\Stmt\ClassMethod))
#4 /rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(114): PhpParser\NodeTraverser->traverseAr in /rector/src/Rector/AbstractRector/NodeTypeResolverTrait.php on line 38
rector.yaml
parameters:
php_version_features: '7.1'
services:
Rector\Rector\Argument\ArgumentAdderRector:
iwat_util_TaskInterface:
runTask:
1:
name: logger
type: iwat_util_LoggerInterface
Minimal PHP Code Causing Issue
<?php declare(strict_types=1);
class Custom_Example
{
public function __construct()
{
$x = new class()
{
public function hydrate($context, array $data, ViewObject $object) : ViewObject
{
return $object;
}
};
}
}
Expected Behaviour
no error and no code chages
Current Behaviour
[parsing] /project/xml/Custom/debug/Example.php
[refactoring] /project/xml/Custom/debug/Example.php
[applying] Rector\Rector\ClassMethod\AddReturnTypeDeclarationRector
[applying] Rector\Rector\Argument\ArgumentAdderRector
[applying] Rector\Rector\ClassMethod\AddReturnTypeDeclarationRector
[applying] Rector\Rector\Argument\ArgumentAdderRector
Fatal error: Uncaught TypeError: Argument 1 passed to Rector\Rector\AbstractRector::isObjectType() must implement interface PhpParser\Node, null given, called in /rector/src/Rector/Argument/ArgumentAdderRector.php on line 233 and defined in /rector/src/Rector/AbstractRector/NodeTypeResolverTrait.php:38
Stack trace:
#0 /rector/src/Rector/Argument/ArgumentAdderRector.php(233): Rector\Rector\AbstractRector->isObjectType(NULL, 'iwat_util_TaskI...')
#1 /rector/src/Rector/Argument/ArgumentAdderRector.php(108): Rector\Rector\Argument\ArgumentAdderRector->isObjectTypeMatch(Object(PhpParser\Node\Stmt\ClassMethod), 'iwat_util_TaskI...')
#2 /rector/src/Rector/AbstractRector.php(91): Rector\Rector\Argument\ArgumentAdderRector->refactor(Object(PhpParser\Node\Stmt\ClassMethod))
#3 /rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(200): Rector\Rector\AbstractRector->enterNode(Object(PhpParser\Node\Stmt\ClassMethod))
#4 /rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(114): PhpParser\NodeTraverser->traverseAr in /rector/src/Rector/AbstractRector/NodeTypeResolverTrait.php on line 38
rector.yaml
Minimal PHP Code Causing Issue
Expected Behaviour
no error and no code chages