@@ -152,7 +152,7 @@ public function __construct($cacheSeed = '')
152
152
$ this ->_usageAnnotation = new UsageAnnotation ();
153
153
$ this ->_usageAnnotation ->class = true ;
154
154
$ this ->_usageAnnotation ->inherited = true ;
155
- $ this ->_traitsSupported = version_compare (PHP_VERSION , '5.4.0 ' , '>= ' );
155
+ $ this ->_traitsSupported = \ version_compare (PHP_VERSION , '5.4.0 ' , '>= ' );
156
156
}
157
157
158
158
/**
@@ -195,10 +195,10 @@ protected function getAnnotationFile($path)
195
195
$ code = $ this ->getParser ()->parseFile ($ path );
196
196
$ data = eval ($ code );
197
197
} 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 );
200
200
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 ))) {
202
202
$ code = $ this ->getParser ()->parseFile ($ path );
203
203
$ this ->cache ->store ($ key , $ code );
204
204
}
@@ -224,19 +224,19 @@ protected function getAnnotationFile($path)
224
224
*/
225
225
public function resolveName ($ name )
226
226
{
227
- if (strpos ($ name , '\\' ) !== false ) {
227
+ if (\ strpos ($ name , '\\' ) !== false ) {
228
228
return $ name . $ this ->suffix ; // annotation class-name is fully qualified
229
229
}
230
230
231
- $ type = lcfirst ($ name );
231
+ $ type = \ lcfirst ($ name );
232
232
233
233
if (isset ($ this ->registry [$ type ])) {
234
234
return $ this ->registry [$ type ]; // type-name is registered
235
235
}
236
236
237
- $ type = ucfirst (strtr ($ name , '- ' , '_ ' )) . $ this ->suffix ;
237
+ $ type = \ ucfirst (\ strtr ($ name , '- ' , '_ ' )) . $ this ->suffix ;
238
238
239
- return strlen ($ this ->namespace )
239
+ return \ strlen ($ this ->namespace )
240
240
? $ this ->namespace . '\\' . $ type
241
241
: $ type ;
242
242
}
@@ -279,7 +279,7 @@ protected function getAnnotations($class_name, $member_type = self::MEMBER_CLASS
279
279
280
280
unset($ spec ['#name ' ], $ spec ['#type ' ]);
281
281
282
- if (!class_exists ($ type , $ this ->autoload )) {
282
+ if (!\ class_exists ($ type , $ this ->autoload )) {
283
283
throw new AnnotationException ("Annotation type ' {$ type }' does not exist " );
284
284
}
285
285
@@ -316,7 +316,7 @@ protected function getAnnotations($class_name, $member_type = self::MEMBER_CLASS
316
316
}
317
317
}
318
318
319
- $ annotations = array_merge ($ traitAnnotations , $ annotations );
319
+ $ annotations = \ array_merge ($ traitAnnotations , $ annotations );
320
320
}
321
321
}
322
322
@@ -331,13 +331,13 @@ protected function getAnnotations($class_name, $member_type = self::MEMBER_CLASS
331
331
332
332
if ($ parent !== __NAMESPACE__ . '\Annotation ' ) {
333
333
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 ) {
335
335
$ parent_annotations [] = $ annotation ;
336
336
}
337
337
}
338
338
}
339
339
340
- $ annotations = array_merge ($ parent_annotations , $ annotations );
340
+ $ annotations = \ array_merge ($ parent_annotations , $ annotations );
341
341
}
342
342
343
343
$ this ->annotations [$ key ] = $ this ->applyConstraints ($ annotations , $ member_type );
@@ -360,9 +360,9 @@ protected function getAnnotations($class_name, $member_type = self::MEMBER_CLASS
360
360
protected function classHasMember ($ className , $ memberType , $ memberName )
361
361
{
362
362
if ($ memberType === self ::MEMBER_METHOD ) {
363
- return method_exists ($ className , $ memberName );
363
+ return \ method_exists ($ className , $ memberName );
364
364
} else if ($ memberType === self ::MEMBER_PROPERTY ) {
365
- return property_exists ($ className , ltrim ($ memberName , '$ ' ));
365
+ return \ property_exists ($ className , \ ltrim ($ memberName , '$ ' ));
366
366
}
367
367
return false ;
368
368
}
@@ -381,10 +381,10 @@ protected function classHasMember($className, $memberType, $memberName)
381
381
protected function applyConstraints (array $ annotations , $ member )
382
382
{
383
383
$ result = array ();
384
- $ annotationCount = count ($ annotations );
384
+ $ annotationCount = \ count ($ annotations );
385
385
386
386
foreach ($ annotations as $ outerIndex => $ annotation ) {
387
- $ type = get_class ($ annotation );
387
+ $ type = \ get_class ($ annotation );
388
388
$ usage = $ this ->getUsage ($ type );
389
389
390
390
// 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)
424
424
*/
425
425
protected function filterAnnotations (array $ annotations , $ type )
426
426
{
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 ));
429
429
}
430
430
431
431
if ($ type === false ) {
@@ -457,16 +457,16 @@ public function getUsage($class)
457
457
}
458
458
459
459
if (!isset ($ this ->usage [$ class ])) {
460
- if (!class_exists ($ class , $ this ->autoload )) {
460
+ if (!\ class_exists ($ class , $ this ->autoload )) {
461
461
throw new AnnotationException ("Annotation type ' {$ class }' does not exist " );
462
462
}
463
463
464
464
$ usage = $ this ->getAnnotations ($ class );
465
465
466
- if (count ($ usage ) === 0 ) {
466
+ if (\ count ($ usage ) === 0 ) {
467
467
throw new AnnotationException ("The class ' {$ class }' must have exactly one UsageAnnotation " );
468
468
} else {
469
- if (count ($ usage ) !== 1 || !($ usage [0 ] instanceof UsageAnnotation)) {
469
+ if (\ count ($ usage ) !== 1 || !($ usage [0 ] instanceof UsageAnnotation)) {
470
470
throw new AnnotationException ("The class ' {$ class }' must have exactly one UsageAnnotation (no other Annotations are allowed) " );
471
471
} else {
472
472
$ usage = $ usage [0 ];
@@ -493,16 +493,16 @@ public function getClassAnnotations($class, $type = null)
493
493
{
494
494
if ($ class instanceof \ReflectionClass) {
495
495
$ class = $ class ->getName ();
496
- } elseif (is_object ($ class )) {
497
- $ class = get_class ($ class );
496
+ } elseif (\ is_object ($ class )) {
497
+ $ class = \ get_class ($ class );
498
498
} else {
499
- $ class = ltrim ($ class , '\\' );
499
+ $ class = \ ltrim ($ class , '\\' );
500
500
}
501
501
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 ))
504
504
) {
505
- if (interface_exists ($ class , $ this ->autoload )) {
505
+ if (\ interface_exists ($ class , $ this ->autoload )) {
506
506
throw new AnnotationException ("Reading annotations from interface ' {$ class }' is not supported " );
507
507
}
508
508
@@ -534,17 +534,17 @@ public function getMethodAnnotations($class, $method = null, $type = null)
534
534
} elseif ($ class instanceof \ReflectionMethod) {
535
535
$ method = $ class ->name ;
536
536
$ class = $ class ->class ;
537
- } elseif (is_object ($ class )) {
538
- $ class = get_class ($ class );
537
+ } elseif (\ is_object ($ class )) {
538
+ $ class = \ get_class ($ class );
539
539
} else {
540
- $ class = ltrim ($ class , '\\' );
540
+ $ class = \ ltrim ($ class , '\\' );
541
541
}
542
542
543
- if (!class_exists ($ class , $ this ->autoload )) {
543
+ if (!\ class_exists ($ class , $ this ->autoload )) {
544
544
throw new AnnotationException ("Unable to read annotations from an undefined class ' {$ class }' " );
545
545
}
546
546
547
- if (!method_exists ($ class , $ method )) {
547
+ if (!\ method_exists ($ class , $ method )) {
548
548
throw new AnnotationException ("Unable to read annotations from an undefined method {$ class }:: {$ method }() " );
549
549
}
550
550
@@ -574,17 +574,17 @@ public function getPropertyAnnotations($class, $property = null, $type = null)
574
574
} elseif ($ class instanceof \ReflectionProperty) {
575
575
$ property = $ class ->name ;
576
576
$ class = $ class ->class ;
577
- } elseif (is_object ($ class )) {
578
- $ class = get_class ($ class );
577
+ } elseif (\ is_object ($ class )) {
578
+ $ class = \ get_class ($ class );
579
579
} else {
580
- $ class = ltrim ($ class , '\\' );
580
+ $ class = \ ltrim ($ class , '\\' );
581
581
}
582
582
583
- if (!class_exists ($ class , $ this ->autoload )) {
583
+ if (!\ class_exists ($ class , $ this ->autoload )) {
584
584
throw new AnnotationException ("Unable to read annotations from an undefined class ' {$ class }' " );
585
585
}
586
586
587
- if (!property_exists ($ class , $ property )) {
587
+ if (!\ property_exists ($ class , $ property )) {
588
588
throw new AnnotationException ("Unable to read annotations from an undefined property {$ class }:: \${$ property }" );
589
589
}
590
590
0 commit comments