getAnnotations() public method

Returns all annotations.
public getAnnotations ( ) : Nette\Reflection\IAnnotation[][]
return Nette\Reflection\IAnnotation[][]
コード例 #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;
 }
コード例 #2
0
 /**
  * @param string $param
  * @return array
  */
 public static function getAnnotations($class, $param)
 {
     $parameter = new Nette\Reflection\Property($class, $param);
     return $parameter->getAnnotations();
 }