mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
simplify PropertyFetchTypeResolver
This commit is contained in:
parent
5abdf00f52
commit
e32ed6a300
@ -5,7 +5,6 @@ namespace Rector\NodeTypeResolver\PerNodeTypeResolver;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\BinaryOp\Concat;
|
||||
use PhpParser\Node\Expr\New_;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
@ -54,14 +53,10 @@ final class PropertyFetchTypeResolver implements PerNodeTypeResolverInterface, N
|
||||
*/
|
||||
public function resolve(Node $propertyFetchNode): array
|
||||
{
|
||||
if ($propertyFetchNode->name instanceof Variable ||
|
||||
$propertyFetchNode->name instanceof ArrayDimFetch ||
|
||||
$propertyFetchNode->name instanceof Concat
|
||||
) {
|
||||
if (! $propertyFetchNode->name instanceof Identifier) {
|
||||
return $this->nodeTypeResolver->resolve($propertyFetchNode->name);
|
||||
}
|
||||
|
||||
/** @var Identifier $identifierNode */
|
||||
$identifierNode = $propertyFetchNode->name;
|
||||
|
||||
$propertyName = $identifierNode->toString();
|
||||
|
@ -35,6 +35,7 @@ parameters:
|
||||
- '#Method Rector\\BetterReflection\\Reflector\\SmartClassReflector::reflect\(\) should return Rector\\BetterReflection\\Reflection\\ReflectionClass\|null but returns Rector\\BetterReflection\\Reflection\\Reflection#'
|
||||
- '#Property Rector\\NodeTypeResolver\\Tests\\PerNodeCallerTypeResolver\\MethodCallCallerTypeResolver\\NestedMethodCallTest::\$(formChainMethodCallNodes|nestedMethodCallNodes) \(array<PhpParser\\Node\\Expr\\MethodCall>\) does not accept array<PhpParser\\Node>#'
|
||||
- '#Cannot call method toString\(\) on string#'
|
||||
- '#Parameter \#1 \$node of method Rector\\NodeTypeResolver\\NodeTypeResolver::resolve\(\) expects PhpParser\\Node, PhpParser\\Node\\Expr|string given#'
|
||||
|
||||
# known value of Name of MethodCall
|
||||
- '#Call to an undefined method PhpParser\\Node\\Expr\|PhpParser\\Node\\Name::toString\(\)#'
|
||||
|
Loading…
x
Reference in New Issue
Block a user