mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-22 02:36:52 +01:00
fix parent typehint for anonymous class
This commit is contained in:
parent
e0fb86b2dd
commit
5d09a89d7f
@ -5,7 +5,6 @@ namespace Rector\Rector\Typehint;
|
|||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
use PhpParser\Node\Param;
|
use PhpParser\Node\Param;
|
||||||
use PhpParser\Node\Stmt\ClassMethod;
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
use Rector\Exception\ShouldNotHappenException;
|
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||||
use Rector\Rector\AbstractRector;
|
use Rector\Rector\AbstractRector;
|
||||||
use Rector\RectorDefinition\ConfiguredCodeSample;
|
use Rector\RectorDefinition\ConfiguredCodeSample;
|
||||||
@ -92,7 +91,8 @@ PHP
|
|||||||
foreach ($this->typehintForArgumentByMethodAndClass as $type => $methodToArgumentToTypes) {
|
foreach ($this->typehintForArgumentByMethodAndClass as $type => $methodToArgumentToTypes) {
|
||||||
$classNode = $node->getAttribute(AttributeKey::CLASS_NODE);
|
$classNode = $node->getAttribute(AttributeKey::CLASS_NODE);
|
||||||
if ($classNode === null) {
|
if ($classNode === null) {
|
||||||
throw new ShouldNotHappenException();
|
// anonymous class
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $this->isObjectType($classNode, $type)) {
|
if (! $this->isObjectType($classNode, $type)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user