update to recent nikic/php-parser; helps with formatting

This commit is contained in:
TomasVotruba 2017-10-16 21:25:56 +02:00
parent 3f5daa93bb
commit 4d879e42f0
9 changed files with 22 additions and 9 deletions

View File

@ -10,7 +10,7 @@
"php": "^7.1",
"beberlei/assert": "^2.7",
"nette/utils": "^2.4",
"nikic/php-parser": "4.0.x-dev#ed8a744c as 3.1.1",
"nikic/php-parser": "4.0.x-dev#3193f7a as 3.1.1",
"rector/better-reflection": "^3.0",
"symfony/console": "^3.3",
"symfony/dependency-injection": "^3.3",

View File

@ -28,6 +28,14 @@ final class Attribute
*/
public const SCOPE_NODE = 'scopeNode';
/**
* System name.
* Do not change this even if you want!
*
* @var string
*/
public const ORIGIGINAL_NODE = 'origNode';
/**
* System name to be found in @see \PhpParser\NodeVisitor\NameResolver
* Do not change this even if you want!

View File

@ -8,6 +8,7 @@ use PhpParser\NodeVisitorAbstract;
use Rector\Builder\Class_\ClassPropertyCollector;
use Rector\Builder\ConstructorMethodBuilder;
use Rector\Builder\PropertyBuilder;
use Rector\Node\Attribute;
/**
* Adds new properties to class and to contructor.
@ -65,7 +66,7 @@ final class PropertyToClassAdder extends NodeVisitorAbstract
}
// prevents offset errors
$classNode->setAttribute('origNode', null);
$classNode->setAttribute(Attribute::ORIGIGINAL_NODE, null);
foreach ($propertiesForClass as $propertyType => $propertyName) {
$this->constructorMethodBuilder->addPropertyAssignToClass($classNode, $propertyType, $propertyName);

View File

@ -7,6 +7,7 @@ use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\NodeVisitorAbstract;
use Rector\Builder\Method\MethodStatementCollector;
use Rector\Node\Attribute;
/**
* Adds new statements to method.
@ -58,7 +59,7 @@ final class StatementToMethodAdder extends NodeVisitorAbstract
/** @var Node $parentNode */
$parentNode = $classMethodNode->getAttribute('parentNode');
$parentNode->setAttribute('origNode', null);
$parentNode->setAttribute(Attribute::ORIGIGINAL_NODEq, null);
return $classMethodNode;
}

View File

@ -110,6 +110,8 @@ final class MagicMethodRector extends AbstractRector
$this->docBlockAnalyzer->removeAnnotationFromNode($classNode, 'method', $methodName);
}
$classNode->setAttribute(Attribute::ORIGIGINAL_NODE, null);
return $classNode;
}

View File

@ -63,6 +63,8 @@ final class NetteObjectToSmartTraitRector extends AbstractRector
$this->removeParentClass($classNode);
$classNode->setAttribute(Attribute::ORIGIGINAL_NODE, null);
return $classNode;
}

View File

@ -69,7 +69,7 @@ final class NamespaceReplacerRector extends AbstractRector
}
$node->parts = explode('\\', $newName);
$node->setAttribute('origNode', null);
$node->setAttribute(Attribute::ORIGIGINAL_NODE, null);
return $node;
}

View File

@ -92,7 +92,7 @@ final class PseudoNamespaceToNamespaceRector extends AbstractRector
$this->oldToNewUseStatements[$oldName] = $lastNewNamePart;
} elseif (isset($this->oldToNewUseStatements[$oldName])) {
// to prevent "getComments() on string" error
$nameOrIdentifierNode->setAttribute('origNode', null);
$nameOrIdentifierNode->setAttribute(Attribute::ORIGIGINAL_NODE, null);
$newNameParts = [$this->oldToNewUseStatements[$oldName]];
}

View File

@ -1,8 +1,7 @@
<?php
declare(strict_types=1);
<?php declare(strict_types=1);
namespace PHPUnit;
class TestCase
{
}
}