public function matches(NodeData $node)
{
if ($this->withSubTypes === true) {
$nodeIsMatchingNodeType = $node->getNodeType()->isOfType($this->nodeTypeName);
} else {
// This is needed to get the raw string NodeType to prevent errors for NodeTypes that no longer exist.
$nodeType = ObjectAccess::getProperty($node, 'nodeType', true);
$nodeIsMatchingNodeType = $nodeType === $this->nodeTypeName;
}
if ($this->exclude === true) {
return !$nodeIsMatchingNodeType;
}
return $nodeIsMatchingNodeType;
}