30
30
import java .util .ArrayList ;
31
31
import org .jetbrains .annotations .NotNull ;
32
32
33
- @ SuppressWarnings ({"PMD.ExcessiveMethodLength" , "PMD.NPathComplexity" })
33
+ @ SuppressWarnings ({"PMD.ExcessiveMethodLength" , "PMD.NPathComplexity" , "PMD.CognitiveComplexity" })
34
34
public class PluginInspection extends PhpInspection {
35
35
36
36
private static final String WRONG_PARAM_TYPE = "inspection.wrong_param_type" ;
37
37
38
- @ NotNull
39
38
@ Override
40
- public PsiElementVisitor buildVisitor (
39
+ public @ NotNull PsiElementVisitor buildVisitor (
41
40
final @ NotNull ProblemsHolder problemsHolder ,
42
41
final boolean isOnTheFly
43
42
) {
@@ -146,7 +145,7 @@ private void checkTargetMethod(
146
145
final String targetClassMethodName ,
147
146
final Method targetMethod
148
147
) {
149
- if (targetClassMethodName . equals ( MagentoPhpClass .CONSTRUCT_METHOD_NAME )) {
148
+ if (MagentoPhpClass .CONSTRUCT_METHOD_NAME . equals ( targetClassMethodName )) {
150
149
problemsHolder .registerProblem (
151
150
pluginMethod .getNameIdentifier (),
152
151
inspectionBundle .message ("inspection.plugin.error.constructMethod" ),
@@ -167,7 +166,7 @@ private void checkTargetMethod(
167
166
ProblemHighlightType .ERROR
168
167
);
169
168
}
170
- if (!targetMethod .getAccess ().toString (). equals ( AbstractPhpFile . PUBLIC_ACCESS )) {
169
+ if (!AbstractPhpFile . PUBLIC_ACCESS . equals ( targetMethod .getAccess ().toString ())) {
171
170
problemsHolder .registerProblem (
172
171
pluginMethod .getNameIdentifier (),
173
172
inspectionBundle .message ("inspection.plugin.error.nonPublicMethod" ),
@@ -187,6 +186,9 @@ private void checkParametersCompatibility(
187
186
188
187
int index = 0 ;
189
188
for (final Parameter pluginMethodParameter : pluginMethodParameters ) {
189
+ if (pluginMethodParameter .getName ().isEmpty ()) {
190
+ continue ;
191
+ }
190
192
index ++;
191
193
String declaredType = pluginMethodParameter .getDeclaredType ().toString ();
192
194
@@ -276,7 +278,7 @@ private void checkParametersCompatibility(
276
278
if (declaredType .isEmpty ()) {
277
279
continue ;
278
280
}
279
- if (!declaredType . equals ( MagentoPhpClass .PHP_NULL )) {
281
+ if (!MagentoPhpClass .PHP_NULL . equals ( declaredType )) {
280
282
problemsHolder .registerProblem (
281
283
pluginMethodParameter ,
282
284
PhpBundle .message (
0 commit comments