function NodeFinder::findFirstInstanceOf
Find first node that is an instance of a certain class.
@template TNode as Node
Parameters
Node|Node[] $nodes Single node or array of nodes to search in:
class-string<TNode> $class Class name:
Return value
null|TNode Found node, which is an instance of $class (or null if none found)
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ NodeFinder.php, line 85
Class
Namespace
PhpParserCode
public function findFirstInstanceOf($nodes, string $class) : ?Node {
return $this->findFirst($nodes, function ($node) use ($class) {
return $node instanceof $class;
});
}