@@ -152,7 +152,7 @@ public function __construct($cacheSeed = '')
152152 $ this ->_usageAnnotation = new UsageAnnotation ();
153153 $ this ->_usageAnnotation ->class = true ;
154154 $ this ->_usageAnnotation ->inherited = true ;
155- $ this ->_traitsSupported = version_compare (PHP_VERSION , '5.4.0 ' , '>= ' );
155+ $ this ->_traitsSupported = \ version_compare (PHP_VERSION , '5.4.0 ' , '>= ' );
156156 }
157157
158158 /**
@@ -195,10 +195,10 @@ protected function getAnnotationFile($path)
195195 $ code = $ this ->getParser ()->parseFile ($ path );
196196 $ data = eval ($ code );
197197 } else {
198- $ checksum = crc32 ($ path . ': ' . $ this ->_cacheSeed . ': ' . self ::CACHE_FORMAT_VERSION );
199- $ key = basename ($ path ) . '- ' . sprintf ('%x ' , $ checksum );
198+ $ checksum = \ crc32 ($ path . ': ' . $ this ->_cacheSeed . ': ' . self ::CACHE_FORMAT_VERSION );
199+ $ key = \ basename ($ path ) . '- ' . \ sprintf ('%x ' , $ checksum );
200200
201- if (($ this ->cache ->exists ($ key ) === false ) || (filemtime ($ path ) > $ this ->cache ->getTimestamp ($ key ))) {
201+ if (($ this ->cache ->exists ($ key ) === false ) || (\ filemtime ($ path ) > $ this ->cache ->getTimestamp ($ key ))) {
202202 $ code = $ this ->getParser ()->parseFile ($ path );
203203 $ this ->cache ->store ($ key , $ code );
204204 }
@@ -224,19 +224,19 @@ protected function getAnnotationFile($path)
224224 */
225225 public function resolveName ($ name )
226226 {
227- if (strpos ($ name , '\\' ) !== false ) {
227+ if (\ strpos ($ name , '\\' ) !== false ) {
228228 return $ name . $ this ->suffix ; // annotation class-name is fully qualified
229229 }
230230
231- $ type = lcfirst ($ name );
231+ $ type = \ lcfirst ($ name );
232232
233233 if (isset ($ this ->registry [$ type ])) {
234234 return $ this ->registry [$ type ]; // type-name is registered
235235 }
236236
237- $ type = ucfirst (strtr ($ name , '- ' , '_ ' )) . $ this ->suffix ;
237+ $ type = \ ucfirst (\ strtr ($ name , '- ' , '_ ' )) . $ this ->suffix ;
238238
239- return strlen ($ this ->namespace )
239+ return \ strlen ($ this ->namespace )
240240 ? $ this ->namespace . '\\' . $ type
241241 : $ type ;
242242 }
@@ -279,7 +279,7 @@ protected function getAnnotations($class_name, $member_type = self::MEMBER_CLASS
279279
280280 unset($ spec ['#name ' ], $ spec ['#type ' ]);
281281
282- if (!class_exists ($ type , $ this ->autoload )) {
282+ if (!\ class_exists ($ type , $ this ->autoload )) {
283283 throw new AnnotationException ("Annotation type ' {$ type }' does not exist " );
284284 }
285285
@@ -316,7 +316,7 @@ protected function getAnnotations($class_name, $member_type = self::MEMBER_CLASS
316316 }
317317 }
318318
319- $ annotations = array_merge ($ traitAnnotations , $ annotations );
319+ $ annotations = \ array_merge ($ traitAnnotations , $ annotations );
320320 }
321321 }
322322
@@ -331,13 +331,13 @@ protected function getAnnotations($class_name, $member_type = self::MEMBER_CLASS
331331
332332 if ($ parent !== __NAMESPACE__ . '\Annotation ' ) {
333333 foreach ($ this ->getAnnotations ($ parent , $ member_type , $ member_name ) as $ annotation ) {
334- if ($ this ->getUsage (get_class ($ annotation ))->inherited ) {
334+ if ($ this ->getUsage (\ get_class ($ annotation ))->inherited ) {
335335 $ parent_annotations [] = $ annotation ;
336336 }
337337 }
338338 }
339339
340- $ annotations = array_merge ($ parent_annotations , $ annotations );
340+ $ annotations = \ array_merge ($ parent_annotations , $ annotations );
341341 }
342342
343343 $ this ->annotations [$ key ] = $ this ->applyConstraints ($ annotations , $ member_type );
@@ -360,9 +360,9 @@ protected function getAnnotations($class_name, $member_type = self::MEMBER_CLASS
360360 protected function classHasMember ($ className , $ memberType , $ memberName )
361361 {
362362 if ($ memberType === self ::MEMBER_METHOD ) {
363- return method_exists ($ className , $ memberName );
363+ return \ method_exists ($ className , $ memberName );
364364 } else if ($ memberType === self ::MEMBER_PROPERTY ) {
365- return property_exists ($ className , ltrim ($ memberName , '$ ' ));
365+ return \ property_exists ($ className , \ ltrim ($ memberName , '$ ' ));
366366 }
367367 return false ;
368368 }
@@ -381,10 +381,10 @@ protected function classHasMember($className, $memberType, $memberName)
381381 protected function applyConstraints (array $ annotations , $ member )
382382 {
383383 $ result = array ();
384- $ annotationCount = count ($ annotations );
384+ $ annotationCount = \ count ($ annotations );
385385
386386 foreach ($ annotations as $ outerIndex => $ annotation ) {
387- $ type = get_class ($ annotation );
387+ $ type = \ get_class ($ annotation );
388388 $ usage = $ this ->getUsage ($ type );
389389
390390 // Checks, that annotation can be applied to given class/method/property according to it's @usage annotation.
@@ -424,8 +424,8 @@ protected function applyConstraints(array $annotations, $member)
424424 */
425425 protected function filterAnnotations (array $ annotations , $ type )
426426 {
427- if (substr ($ type , 0 , 1 ) === '@ ' ) {
428- $ type = $ this ->resolveName (substr ($ type , 1 ));
427+ if (\ substr ($ type , 0 , 1 ) === '@ ' ) {
428+ $ type = $ this ->resolveName (\ substr ($ type , 1 ));
429429 }
430430
431431 if ($ type === false ) {
@@ -457,16 +457,16 @@ public function getUsage($class)
457457 }
458458
459459 if (!isset ($ this ->usage [$ class ])) {
460- if (!class_exists ($ class , $ this ->autoload )) {
460+ if (!\ class_exists ($ class , $ this ->autoload )) {
461461 throw new AnnotationException ("Annotation type ' {$ class }' does not exist " );
462462 }
463463
464464 $ usage = $ this ->getAnnotations ($ class );
465465
466- if (count ($ usage ) === 0 ) {
466+ if (\ count ($ usage ) === 0 ) {
467467 throw new AnnotationException ("The class ' {$ class }' must have exactly one UsageAnnotation " );
468468 } else {
469- if (count ($ usage ) !== 1 || !($ usage [0 ] instanceof UsageAnnotation)) {
469+ if (\ count ($ usage ) !== 1 || !($ usage [0 ] instanceof UsageAnnotation)) {
470470 throw new AnnotationException ("The class ' {$ class }' must have exactly one UsageAnnotation (no other Annotations are allowed) " );
471471 } else {
472472 $ usage = $ usage [0 ];
@@ -493,16 +493,16 @@ public function getClassAnnotations($class, $type = null)
493493 {
494494 if ($ class instanceof \ReflectionClass) {
495495 $ class = $ class ->getName ();
496- } elseif (is_object ($ class )) {
497- $ class = get_class ($ class );
496+ } elseif (\ is_object ($ class )) {
497+ $ class = \ get_class ($ class );
498498 } else {
499- $ class = ltrim ($ class , '\\' );
499+ $ class = \ ltrim ($ class , '\\' );
500500 }
501501
502- if (!class_exists ($ class , $ this ->autoload ) &&
503- !(function_exists ('trait_exists ' ) && trait_exists ($ class , $ this ->autoload ))
502+ if (!\ class_exists ($ class , $ this ->autoload ) &&
503+ !(\ function_exists ('trait_exists ' ) && \ trait_exists ($ class , $ this ->autoload ))
504504 ) {
505- if (interface_exists ($ class , $ this ->autoload )) {
505+ if (\ interface_exists ($ class , $ this ->autoload )) {
506506 throw new AnnotationException ("Reading annotations from interface ' {$ class }' is not supported " );
507507 }
508508
@@ -534,17 +534,17 @@ public function getMethodAnnotations($class, $method = null, $type = null)
534534 } elseif ($ class instanceof \ReflectionMethod) {
535535 $ method = $ class ->name ;
536536 $ class = $ class ->class ;
537- } elseif (is_object ($ class )) {
538- $ class = get_class ($ class );
537+ } elseif (\ is_object ($ class )) {
538+ $ class = \ get_class ($ class );
539539 } else {
540- $ class = ltrim ($ class , '\\' );
540+ $ class = \ ltrim ($ class , '\\' );
541541 }
542542
543- if (!class_exists ($ class , $ this ->autoload )) {
543+ if (!\ class_exists ($ class , $ this ->autoload )) {
544544 throw new AnnotationException ("Unable to read annotations from an undefined class ' {$ class }' " );
545545 }
546546
547- if (!method_exists ($ class , $ method )) {
547+ if (!\ method_exists ($ class , $ method )) {
548548 throw new AnnotationException ("Unable to read annotations from an undefined method {$ class }:: {$ method }() " );
549549 }
550550
@@ -574,17 +574,17 @@ public function getPropertyAnnotations($class, $property = null, $type = null)
574574 } elseif ($ class instanceof \ReflectionProperty) {
575575 $ property = $ class ->name ;
576576 $ class = $ class ->class ;
577- } elseif (is_object ($ class )) {
578- $ class = get_class ($ class );
577+ } elseif (\ is_object ($ class )) {
578+ $ class = \ get_class ($ class );
579579 } else {
580- $ class = ltrim ($ class , '\\' );
580+ $ class = \ ltrim ($ class , '\\' );
581581 }
582582
583- if (!class_exists ($ class , $ this ->autoload )) {
583+ if (!\ class_exists ($ class , $ this ->autoload )) {
584584 throw new AnnotationException ("Unable to read annotations from an undefined class ' {$ class }' " );
585585 }
586586
587- if (!property_exists ($ class , $ property )) {
587+ if (!\ property_exists ($ class , $ property )) {
588588 throw new AnnotationException ("Unable to read annotations from an undefined property {$ class }:: \${$ property }" );
589589 }
590590
0 commit comments