bump to php-parser 4.0.4

This commit is contained in:
Tomas Votruba 2018-09-21 14:09:32 +02:00
parent da85f34184
commit b30fa8a047
4 changed files with 21 additions and 10 deletions

View File

@ -178,7 +178,7 @@ final class NodeFactory
public function createParam(string $name, string $type): Param
{
return $this->builderFactory->param($name)
->setTypeHint(new FullyQualified($type))
->setType(new FullyQualified($type))
->getNode();
}
@ -194,7 +194,7 @@ final class NodeFactory
$paramBuild = $this->builderFactory->param($variableInfo->getName());
foreach ($variableInfo->getTypes() as $type) {
$paramBuild->setTypeHint($this->createTypeName($type));
$paramBuild->setType($this->createTypeName($type));
}
return $paramBuild->getNode();
@ -207,7 +207,7 @@ final class NodeFactory
public function createVariable(string $name): Variable
{
return new Variable($name);
return $this->builderFactory->var($name);
}
public function createTypeName(string $name): Name

View File

@ -2,19 +2,30 @@
namespace Rector\Node;
use PhpParser\BuilderFactory;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\Variable;
final class PropertyFetchNodeFactory
{
/**
* @var BuilderFactory
*/
private $builderFactory;
public function __construct(BuilderFactory $builderFactory)
{
$this->builderFactory = $builderFactory;
}
/**
* Creates "$variable->property"
*/
public function createWithVariableNameAndPropertyName(string $variable, string $property): PropertyFetch
public function createWithVariableNameAndPropertyName(string $variable, string $propertyName): PropertyFetch
{
$variableNode = new Variable($variable);
$variableNode = $this->builderFactory->var($variable);
return new PropertyFetch($variableNode, $property);
return $this->builderFactory->propertyFetch($variableNode, $propertyName);
}
/**
@ -26,7 +37,7 @@ final class PropertyFetchNodeFactory
'name' => $propertyName,
]);
return new PropertyFetch($localVariable, $propertyName);
return $this->builderFactory->propertyFetch($localVariable, $propertyName);
}
/**
@ -38,6 +49,6 @@ final class PropertyFetchNodeFactory
'name' => $propertyName,
]);
return new PropertyFetch($localVariable, $propertyName . '[]');
return $this->builderFactory->propertyFetch($localVariable, $propertyName . '[]');
}
}

View File

@ -369,7 +369,7 @@ final class SourceStubber
$parameterType = $parameterReflection->getType();
if (null !== $parameterReflection->getType()) {
$parameterNode->setTypeHint($this->formatType($parameterType));
$parameterNode->setType($this->formatType($parameterType));
}
return $parameterNode;

View File

@ -369,7 +369,7 @@ final class SourceStubber
$parameterType = $parameterReflection->getType();
if (null !== $parameterReflection->getType()) {
$parameterNode->setTypeHint($this->formatType($parameterType));
$parameterNode->setType($this->formatType($parameterType));
}
return $parameterNode;