mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-25 20:32:35 +00:00
remove comments
This commit is contained in:
parent
d2ae52e417
commit
452e6748fa
|
@ -76,4 +76,12 @@ final class BetterNodeFinder
|
|||
{
|
||||
return $this->nodeFinder->find($nodes, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node|Node[] $nodes
|
||||
*/
|
||||
public function findFirst($nodes, callable $filter): ?Node
|
||||
{
|
||||
return $this->nodeFinder->findFirst($nodes, $filter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,12 +70,24 @@ final class CallerTypeResolver extends NodeVisitorAbstract
|
|||
|
||||
private function processMethodCallNode(MethodCall $methodCallNode): void
|
||||
{
|
||||
$node = $this->betterNodeFinder->findFirstInstanceOfAny(
|
||||
$callerNode = $this->betterNodeFinder->findFirst(
|
||||
$methodCallNode,
|
||||
[Variable::class, PropertyFetch::class]
|
||||
function (Node $node) use ($methodCallNode) {
|
||||
if ($node instanceof Variable || $node instanceof PropertyFetch /* || $node instanceof MethodCall*/) {
|
||||
return $node;
|
||||
}
|
||||
|
||||
if ($node === $methodCallNode) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$nodeTypes = (array) $node->getAttribute(Attribute::TYPES);
|
||||
if ($callerNode === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$nodeTypes = (array) $callerNode->getAttribute(Attribute::TYPES);
|
||||
if ($nodeTypes) {
|
||||
$methodCallNode->setAttribute(Attribute::CALLER_TYPES, $nodeTypes);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,14 @@
|
|||
|
||||
class SomeNetteExtension extends Nette\DI\CompilerExtension
|
||||
{
|
||||
/**
|
||||
* @var SomeBuilder
|
||||
*/
|
||||
private $builder;
|
||||
|
||||
public function loadConfiguration()
|
||||
{
|
||||
$builder = new SomeBuilder;
|
||||
$builder->parameters['appDir'];
|
||||
$this->builder->parameters['appDir'];
|
||||
$this->getContainerBuilder()->parameters['appDir'];
|
||||
|
|
|
@ -2,8 +2,14 @@
|
|||
|
||||
class SomeNetteExtension extends Nette\DI\CompilerExtension
|
||||
{
|
||||
/**
|
||||
* @var SomeBuilder
|
||||
*/
|
||||
private $builder;
|
||||
|
||||
public function loadConfiguration()
|
||||
{
|
||||
$builder = new SomeBuilder;
|
||||
$builder->expand('%appDir%');
|
||||
$this->builder->expand('%appDir%');
|
||||
$this->getContainerBuilder()->expand('%appDir%');
|
||||
|
|
|
@ -9,25 +9,25 @@ final class Test extends AbstractConfigurableRectorTestCase
|
|||
{
|
||||
public function test(): void
|
||||
{
|
||||
// $this->doTestFileMatchesExpectedContent(
|
||||
// __DIR__ . '/wrong/wrong.php.inc',
|
||||
// __DIR__ . '/correct/correct.php.inc'
|
||||
// );
|
||||
//
|
||||
// $this->doTestFileMatchesExpectedContent(
|
||||
// __DIR__ . '/wrong/wrong2.php.inc',
|
||||
// __DIR__ . '/correct/correct2.php.inc'
|
||||
// );
|
||||
//
|
||||
$this->doTestFileMatchesExpectedContent(
|
||||
__DIR__ . '/wrong/wrong.php.inc',
|
||||
__DIR__ . '/correct/correct.php.inc'
|
||||
);
|
||||
|
||||
$this->doTestFileMatchesExpectedContent(
|
||||
__DIR__ . '/wrong/wrong2.php.inc',
|
||||
__DIR__ . '/correct/correct2.php.inc'
|
||||
);
|
||||
|
||||
$this->doTestFileMatchesExpectedContent(
|
||||
__DIR__ . '/wrong/wrong3.php.inc',
|
||||
__DIR__ . '/correct/correct3.php.inc'
|
||||
);
|
||||
//
|
||||
// $this->doTestFileMatchesExpectedContent(
|
||||
// __DIR__ . '/wrong/wrong4.php.inc',
|
||||
// __DIR__ . '/correct/correct4.php.inc'
|
||||
// );
|
||||
|
||||
$this->doTestFileMatchesExpectedContent(
|
||||
__DIR__ . '/wrong/wrong4.php.inc',
|
||||
__DIR__ . '/correct/correct4.php.inc'
|
||||
);
|
||||
}
|
||||
|
||||
protected function provideConfig(): string
|
||||
|
|
Loading…
Reference in New Issue
Block a user