File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ public function apply(AbstractNode $node)
32
32
return ;
33
33
}
34
34
try {
35
+ if (!class_exists ($ node ->getFullQualifiedName (), true )) {
36
+ return ;
37
+ }
35
38
$ impl = class_implements ($ node ->getFullQualifiedName (), true );
36
39
} catch (\Throwable $ exception ) {
37
40
//Couldn't load a class.
Original file line number Diff line number Diff line change @@ -110,7 +110,11 @@ private function isControllerPlugin(\ReflectionClass $class): bool
110
110
foreach ($ class ->getMethods (\ReflectionMethod::IS_PUBLIC ) as $ method ) {
111
111
if (preg_match ('/^(after|around|before).+/i ' , $ method ->getName ())) {
112
112
try {
113
- $ argument = $ this ->getParameterClass ($ method ->getParameters ()[0 ]);
113
+ $ parameters = $ method ->getParameters ();
114
+ if (count ($ parameters ) === 0 ) {
115
+ continue ;
116
+ }
117
+ $ argument = $ this ->getParameterClass ($ parameters [0 ]);
114
118
} catch (\Throwable $ exception ) {
115
119
//Non-existing class (autogenerated perhaps) or doesn't have an argument.
116
120
continue ;
@@ -139,7 +143,11 @@ private function isBlockPlugin(\ReflectionClass $class): bool
139
143
foreach ($ class ->getMethods (\ReflectionMethod::IS_PUBLIC ) as $ method ) {
140
144
if (preg_match ('/^(after|around|before).+/i ' , $ method ->getName ())) {
141
145
try {
142
- $ argument = $ this ->getParameterClass ($ method ->getParameters ()[0 ]);
146
+ $ parameters = $ method ->getParameters ();
147
+ if (count ($ parameters ) === 0 ) {
148
+ continue ;
149
+ }
150
+ $ argument = $ this ->getParameterClass ($ parameters [0 ]);
143
151
} catch (\Throwable $ exception ) {
144
152
//Non-existing class (autogenerated perhaps) or doesn't have an argument.
145
153
continue ;
You can’t perform that action at this time.
0 commit comments