@@ -285,7 +285,7 @@ public function getDefaultImplementationClassNameForInterface(string $interfaceN
285285 }
286286 $ interfaceName = $ this ->prepareClassReflectionForUsage ($ interfaceName );
287287
288- $ classNamesFound = isset ($ this ->classReflectionData [$ interfaceName ][self ::DATA_INTERFACE_IMPLEMENTATIONS ]) ? array_keys ( $ this -> classReflectionData [ $ interfaceName ][ self :: DATA_INTERFACE_IMPLEMENTATIONS ]) : [] ;
288+ $ classNamesFound = array_keys ($ this ->classReflectionData [$ interfaceName ][self ::DATA_INTERFACE_IMPLEMENTATIONS ] ?? []) ;
289289 if (count ($ classNamesFound ) === 1 ) {
290290 return $ classNamesFound [0 ];
291291 }
@@ -321,7 +321,7 @@ public function getAllImplementationClassNamesForInterface(string $interfaceName
321321 }
322322 $ interfaceName = $ this ->prepareClassReflectionForUsage ($ interfaceName );
323323
324- return ( isset ( $ this ->classReflectionData [$ interfaceName ][self ::DATA_INTERFACE_IMPLEMENTATIONS ])) ? array_keys ( $ this -> classReflectionData [ $ interfaceName ][ self :: DATA_INTERFACE_IMPLEMENTATIONS ]) : [] ;
324+ return array_keys ( $ this ->classReflectionData [$ interfaceName ][self ::DATA_INTERFACE_IMPLEMENTATIONS ] ?? []) ;
325325 }
326326
327327 /**
@@ -341,7 +341,7 @@ public function getAllSubClassNamesForClass(string $className): array
341341 throw new \InvalidArgumentException ('" ' . $ className . '" does not exist or is not the name of a class. ' , 1257168042 );
342342 }
343343 $ className = $ this ->prepareClassReflectionForUsage ($ className );
344- return ( isset ( $ this ->classReflectionData [$ className ][self ::DATA_CLASS_SUBCLASSES ])) ? array_keys ( $ this -> classReflectionData [ $ className ][ self :: DATA_CLASS_SUBCLASSES ]) : [] ;
344+ return array_keys ( $ this ->classReflectionData [$ className ][self ::DATA_CLASS_SUBCLASSES ] ?? []) ;
345345 }
346346
347347 /**
@@ -355,7 +355,7 @@ public function getClassNamesByAnnotation(string $annotationClassName): array
355355 }
356356 $ annotationClassName = $ this ->cleanClassName ($ annotationClassName );
357357
358- return ( isset ( $ this -> annotatedClasses [ $ annotationClassName ]) ? array_keys ($ this ->annotatedClasses [$ annotationClassName ]) : []);
358+ return array_keys ($ this ->annotatedClasses [$ annotationClassName ] ?? []);
359359 }
360360
361361 /**
@@ -372,7 +372,7 @@ public function isClassAnnotatedWith(string $className, string $annotationClassN
372372
373373 $ annotationClassName = $ this ->cleanClassName ($ annotationClassName );
374374
375- return ( isset ($ this ->annotatedClasses [$ annotationClassName ][$ className ]) );
375+ return isset ($ this ->annotatedClasses [$ annotationClassName ][$ className ]);
376376 }
377377
378378 /**
@@ -443,7 +443,7 @@ public function isClassImplementationOf(string $className, string $interfaceName
443443 $ className = $ this ->prepareClassReflectionForUsage ($ className );
444444 $ this ->prepareClassReflectionForUsage ($ interfaceName );
445445
446- return ( isset ($ this ->classReflectionData [$ interfaceName ][self ::DATA_INTERFACE_IMPLEMENTATIONS ][$ className ]) );
446+ return isset ($ this ->classReflectionData [$ interfaceName ][self ::DATA_INTERFACE_IMPLEMENTATIONS ][$ className ]);
447447 }
448448
449449 /**
@@ -516,7 +516,7 @@ public function getClassesContainingMethodsAnnotatedWith(string $annotationClass
516516 $ this ->initialize ();
517517 }
518518
519- return isset ($ this ->classesByMethodAnnotations [$ annotationClassName ]) ? array_keys ( $ this -> classesByMethodAnnotations [ $ annotationClassName ]) : [] ;
519+ return array_keys ($ this ->classesByMethodAnnotations [$ annotationClassName ] ?? []) ;
520520 }
521521
522522 /**
@@ -574,7 +574,7 @@ public function isMethodStatic(string $className, string $methodName): bool
574574 public function isMethodPublic (string $ className , string $ methodName ): bool
575575 {
576576 $ className = $ this ->prepareClassReflectionForUsage ($ className );
577- return (isset ( $ this ->classReflectionData [$ className ][self ::DATA_CLASS_METHODS ][$ methodName ][self ::DATA_METHOD_VISIBILITY ]) && $ this -> classReflectionData [ $ className ][ self :: DATA_CLASS_METHODS ][ $ methodName ][ self :: DATA_METHOD_VISIBILITY ] === self ::VISIBILITY_PUBLIC ) ;
577+ return ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_METHODS ][$ methodName ][self ::DATA_METHOD_VISIBILITY ] ?? null ) === self ::VISIBILITY_PUBLIC ;
578578 }
579579
580580 /**
@@ -587,7 +587,7 @@ public function isMethodPublic(string $className, string $methodName): bool
587587 public function isMethodProtected (string $ className , string $ methodName ): bool
588588 {
589589 $ className = $ this ->prepareClassReflectionForUsage ($ className );
590- return (isset ( $ this ->classReflectionData [$ className ][self ::DATA_CLASS_METHODS ][$ methodName ][self ::DATA_METHOD_VISIBILITY ]) && $ this -> classReflectionData [ $ className ][ self :: DATA_CLASS_METHODS ][ $ methodName ][ self :: DATA_METHOD_VISIBILITY ] === self ::VISIBILITY_PROTECTED ) ;
590+ return ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_METHODS ][$ methodName ][self ::DATA_METHOD_VISIBILITY ] ?? null ) === self ::VISIBILITY_PROTECTED ;
591591 }
592592
593593 /**
@@ -600,7 +600,7 @@ public function isMethodProtected(string $className, string $methodName): bool
600600 public function isMethodPrivate (string $ className , string $ methodName ): bool
601601 {
602602 $ className = $ this ->prepareClassReflectionForUsage ($ className );
603- return (isset ( $ this ->classReflectionData [$ className ][self ::DATA_CLASS_METHODS ][$ methodName ][self ::DATA_METHOD_VISIBILITY ]) && $ this -> classReflectionData [ $ className ][ self :: DATA_CLASS_METHODS ][ $ methodName ][ self :: DATA_METHOD_VISIBILITY ] === self ::VISIBILITY_PRIVATE ) ;
603+ return ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_METHODS ][$ methodName ][self ::DATA_METHOD_VISIBILITY ] ?? null ) === self ::VISIBILITY_PRIVATE ;
604604 }
605605
606606 /**
@@ -722,7 +722,7 @@ public function getMethodAnnotation(string $className, string $methodName, strin
722722 public function getClassPropertyNames (string $ className ): array
723723 {
724724 $ className = $ this ->prepareClassReflectionForUsage ($ className );
725- return isset ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ]) ? array_keys ( $ this -> classReflectionData [ $ className ][ self :: DATA_CLASS_PROPERTIES ]) : [] ;
725+ return array_keys ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ] ?? []) ;
726726 }
727727
728728 /**
@@ -807,12 +807,9 @@ public function getMethodDeclaredReturnType(string $className, string $methodNam
807807 public function getPropertyNamesByTag (string $ className , string $ tag ): array
808808 {
809809 $ className = $ this ->prepareClassReflectionForUsage ($ className );
810- if (!isset ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ])) {
811- return [];
812- }
813810
814811 $ propertyNames = [];
815- foreach ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ] as $ propertyName => $ propertyData ) {
812+ foreach ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ] ?? [] as $ propertyName => $ propertyData ) {
816813 if (isset ($ propertyData [self ::DATA_PROPERTY_TAGS_VALUES ][$ tag ])) {
817814 $ propertyNames [$ propertyName ] = true ;
818815 }
@@ -835,10 +832,6 @@ public function getPropertyNamesByTag(string $className, string $tag): array
835832 public function getPropertyTagsValues (string $ className , string $ propertyName ): array
836833 {
837834 $ className = $ this ->prepareClassReflectionForUsage ($ className );
838- if (!isset ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ][$ propertyName ])) {
839- return [];
840- }
841-
842835 return $ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ][$ propertyName ][self ::DATA_PROPERTY_TAGS_VALUES ] ?? [];
843836 }
844837
@@ -858,10 +851,6 @@ public function getPropertyTagsValues(string $className, string $propertyName):
858851 public function getPropertyTagValues (string $ className , string $ propertyName , string $ tag ): array
859852 {
860853 $ className = $ this ->prepareClassReflectionForUsage ($ className );
861- if (!isset ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ][$ propertyName ])) {
862- return [];
863- }
864-
865854 return $ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ][$ propertyName ][self ::DATA_PROPERTY_TAGS_VALUES ][$ tag ] ?? [];
866855 }
867856
@@ -893,8 +882,7 @@ public function getPropertyType(string $className, string $propertyName): ?strin
893882 public function isPropertyPrivate (string $ className , string $ propertyName ): bool
894883 {
895884 $ className = $ this ->prepareClassReflectionForUsage ($ className );
896- return (isset ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ][$ propertyName ][self ::DATA_PROPERTY_VISIBILITY ])
897- && $ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ][$ propertyName ][self ::DATA_PROPERTY_VISIBILITY ] === self ::VISIBILITY_PRIVATE );
885+ return ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ][$ propertyName ][self ::DATA_PROPERTY_VISIBILITY ] ?? null ) === self ::VISIBILITY_PRIVATE ;
898886 }
899887
900888 /**
@@ -948,12 +936,9 @@ public function isPropertyAnnotatedWith(string $className, string $propertyName,
948936 public function getPropertyNamesByAnnotation (string $ className , string $ annotationClassName ): array
949937 {
950938 $ className = $ this ->prepareClassReflectionForUsage ($ className );
951- if (!isset ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ])) {
952- return [];
953- }
954939
955940 $ propertyNames = [];
956- foreach ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ] as $ propertyName => $ propertyData ) {
941+ foreach ($ this ->classReflectionData [$ className ][self ::DATA_CLASS_PROPERTIES ] ?? [] as $ propertyName => $ propertyData ) {
957942 if (isset ($ propertyData [self ::DATA_PROPERTY_ANNOTATIONS ][$ annotationClassName ])) {
958943 $ propertyNames [$ propertyName ] = true ;
959944 }
0 commit comments