Nette\Reflection\Property::getAnnotations PHP Method

getAnnotations() public method

Returns all annotations.
public getAnnotations ( ) : Nette\Reflection\IAnnotation[][]
return Nette\Reflection\IAnnotation[][]
    public function getAnnotations()
    {
        return AnnotationsParser::getAll($this);
    }

Usage Example

Beispiel #1
0
 private function validateProperty(Property $property, array $ignore)
 {
     if (in_array($property->getDeclaringClass()->getName(), $ignore, TRUE)) {
         return FALSE;
     }
     foreach ($property->getAnnotations() as $name => $value) {
         if (!in_array(Strings::lower($name), ['autowire', 'autowired'], TRUE)) {
             continue;
         }
         if (Strings::lower($name) !== $name || $name !== 'autowire') {
             throw new UnexpectedValueException("Annotation @{$name} on {$property} should be fixed to lowercase @autowire.", $property);
         }
         if ($property->isPrivate()) {
             throw new MemberAccessException("Autowired properties must be protected or public. Please fix visibility of {$property} or remove the @autowire annotation.", $property);
         }
         return TRUE;
     }
     return FALSE;
 }
All Usage Examples Of Nette\Reflection\Property::getAnnotations