/** * Check target constraints * @param ReflectionAnnotatedClass|ReflectionAnnotatedMethod|ReflectionAnnotatedProperty|bool $target Target entity * @param AnnotationsCollection $annotations * @return void * @throws ConflictException */ public static function check($target, AnnotationsCollection $annotations) { if (!self::$_conflicts) { return; } foreach ($annotations->getAllAnnotations() as $annotation) { $name = AnnotationName::createName($annotation); if (!isset(self::$_conflicts[$name])) { continue; } $second = self::$_conflicts[$name]; if ($annotations->hasAnnotation($second)) { throw new ConflictException(sprintf('Annotation `%s` cannot be used together with `%s` in `%s`', $name, $second, ReflectionName::createName($target))); } } }
public function hasAnnotation($class) { return $this->annotations->hasAnnotation($class); }