mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-22 18:54:39 +01:00
[NodeTypeResolver] add parent to name resolver
This commit is contained in:
parent
b61a576174
commit
c0e0a2fcea
@ -38,6 +38,9 @@ final class NameTypeResolver implements PerNodeTypeResolverInterface
|
||||
}
|
||||
|
||||
$fullyQualifiedName = $name->toString();
|
||||
if ($fullyQualifiedName === 'parent') {
|
||||
return [$nameNode->getAttribute(Attribute::PARENT_CLASS_NAME)];
|
||||
}
|
||||
|
||||
$types = [];
|
||||
$types[] = $fullyQualifiedName;
|
||||
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Nette\Config\Configurator;
|
||||
|
||||
class MyConfigurator extends Configurator
|
||||
{
|
||||
public function setName()
|
||||
{
|
||||
parent::setName();
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\NodeTypeResolver\Tests\PerNodeTypeResolver\NameTypeResolver;
|
||||
|
||||
use PhpParser\Node\Name;
|
||||
use Rector\Node\Attribute;
|
||||
use Rector\NodeTypeResolver\Tests\AbstractNodeTypeResolverTest;
|
||||
|
||||
final class Test extends AbstractNodeTypeResolverTest
|
||||
{
|
||||
public function testNew(): void
|
||||
{
|
||||
$nameNodes = $this->getNodesForFileOfType(__DIR__ . '/Source/ParentCall.php.inc', Name::class);
|
||||
|
||||
$this->assertSame(['Nette\Config\Configurator'], $nameNodes[2]->getAttribute(Attribute::TYPES));
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
rectors:
|
||||
Rector\Rector\Dynamic\NamespaceReplacerRector:
|
||||
'OldNamespace': 'NewNamespace'
|
||||
'OldNamespaceWith\OldSplitNamespace': 'NewNamespaceWith\NewSplitNamespace'
|
||||
'PHPUnit_Framework_': 'PHPUnit\Framework\'
|
@ -0,0 +1,3 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
$result = Nette\Bridges\FormsLatte\Runtime::renderFormBegin($someArgs);
|
@ -0,0 +1,3 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
$result = Nette\Bridges\FormsLatte\FormMacros::renderFormBegin($someArgs);
|
Loading…
x
Reference in New Issue
Block a user