File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ final class ClassNameCheck
1313{
1414
1515 /** @var RestrictedClassNameUsageExtension[] $extensions */
16- private array $ extensions ;
16+ private ? array $ extensions = null ;
1717
1818 public function __construct (
1919 private ClassCaseSensitivityCheck $ classCaseSensitivityCheck ,
@@ -22,7 +22,6 @@ public function __construct(
2222 private Container $ container ,
2323 )
2424 {
25- $ this ->extensions = $ this ->container ->getServicesByTag (RestrictedClassNameUsageExtension::CLASS_NAME_EXTENSION_TAG );
2625 }
2726
2827 /**
@@ -51,7 +50,8 @@ public function checkClassNames(
5150 return $ errors ;
5251 }
5352
54- if ($ this ->extensions === []) {
53+ $ extensions = $ this ->extensions ??= $ this ->container ->getServicesByTag (RestrictedClassNameUsageExtension::CLASS_NAME_EXTENSION_TAG );
54+ if ($ extensions === []) {
5555 return $ errors ;
5656 }
5757
@@ -61,7 +61,7 @@ public function checkClassNames(
6161 }
6262
6363 $ classReflection = $ this ->reflectionProvider ->getClass ($ pair ->getClassName ());
64- foreach ($ this -> extensions as $ extension ) {
64+ foreach ($ extensions as $ extension ) {
6565 $ restrictedUsage = $ extension ->isRestrictedClassNameUsage ($ classReflection , $ scope , $ location );
6666 if ($ restrictedUsage === null ) {
6767 continue ;
You can’t perform that action at this time.
0 commit comments