mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 06:18:07 +01:00
bump to php-parser 4.0.4
This commit is contained in:
parent
da85f34184
commit
b30fa8a047
@ -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
|
||||
|
@ -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 . '[]');
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user