/** * {@inheritDoc} */ public function enterNode(Node $node) { if ($node instanceof Node\Expr\FuncCall) { $this->functionCalls[] = FunctionCall::fromFunctionCall($node); } if ($node instanceof Node\Expr\MethodCall) { $this->functionCalls[] = FunctionCall::fromInstanceCall($node); } if ($node instanceof Node\Expr\StaticCall) { $this->functionCalls[] = FunctionCall::fromStaticCall($node); } }
/** * @dataProvider resolvedCallsDataProvider */ public function testWillEvaluateFunctionRelativeName(Expr $node, array $variableValues, array $expectedType) { $functionCall = null; if ($node instanceof Expr\FuncCall) { $functionCall = FunctionCall::fromFunctionCall($node); } if ($node instanceof Expr\StaticCall) { $functionCall = FunctionCall::fromStaticCall($node); } if ($node instanceof Expr\MethodCall) { $functionCall = FunctionCall::fromInstanceCall($node); } if (!$functionCall) { throw new \InvalidArgumentException(sprintf('Unrecognized node of type "%s"', get_class($node))); } if (!$expectedType) { $this->assertNull($functionCall->buildReference($variableValues)); return; } $reference = $functionCall->buildReference($variableValues); $this->assertInstanceOf(FunctionReference::class, $reference); $this->assertSame(implode('::', $expectedType), $reference->getName()); }