/** * @param Node $node * @return void */ public function enterNode(Node $node) { if ($node instanceof Node\Stmt\Namespace_) { if (isset($node->name)) { $this->namespace = implode('\\', $node->name->parts); } return; } if (!$node instanceof Node\Stmt\Class_) { return; } $name = '' === $this->namespace ? $node->name : $this->namespace . '\\' . $node->name; if (!class_exists($name)) { return; } $metadata = $this->metadataFactory instanceof ClassMetadataFactoryInterface ? $this->metadataFactory->getClassMetadata($name) : $this->metadataFactory->getMetadataFor($name); if (!$metadata->hasConstraints() && !count($metadata->getConstrainedProperties())) { return; } $this->extractFromConstraints($metadata->constraints); foreach ($metadata->members as $members) { foreach ($members as $member) { $this->extractFromConstraints($member->constraints); } } }