3030import java .util .ArrayList ;
3131import org .jetbrains .annotations .NotNull ;
3232
33- @ SuppressWarnings ({"PMD.ExcessiveMethodLength" , "PMD.NPathComplexity" })
33+ @ SuppressWarnings ({"PMD.ExcessiveMethodLength" , "PMD.NPathComplexity" , "PMD.CognitiveComplexity" })
3434public class PluginInspection extends PhpInspection {
3535
3636 private static final String WRONG_PARAM_TYPE = "inspection.wrong_param_type" ;
3737
38- @ NotNull
3938 @ Override
40- public PsiElementVisitor buildVisitor (
39+ public @ NotNull PsiElementVisitor buildVisitor (
4140 final @ NotNull ProblemsHolder problemsHolder ,
4241 final boolean isOnTheFly
4342 ) {
@@ -146,7 +145,7 @@ private void checkTargetMethod(
146145 final String targetClassMethodName ,
147146 final Method targetMethod
148147 ) {
149- if (targetClassMethodName . equals ( MagentoPhpClass .CONSTRUCT_METHOD_NAME )) {
148+ if (MagentoPhpClass .CONSTRUCT_METHOD_NAME . equals ( targetClassMethodName )) {
150149 problemsHolder .registerProblem (
151150 pluginMethod .getNameIdentifier (),
152151 inspectionBundle .message ("inspection.plugin.error.constructMethod" ),
@@ -167,7 +166,7 @@ private void checkTargetMethod(
167166 ProblemHighlightType .ERROR
168167 );
169168 }
170- if (!targetMethod .getAccess ().toString (). equals ( AbstractPhpFile . PUBLIC_ACCESS )) {
169+ if (!AbstractPhpFile . PUBLIC_ACCESS . equals ( targetMethod .getAccess ().toString ())) {
171170 problemsHolder .registerProblem (
172171 pluginMethod .getNameIdentifier (),
173172 inspectionBundle .message ("inspection.plugin.error.nonPublicMethod" ),
@@ -187,6 +186,9 @@ private void checkParametersCompatibility(
187186
188187 int index = 0 ;
189188 for (final Parameter pluginMethodParameter : pluginMethodParameters ) {
189+ if (pluginMethodParameter .getName ().isEmpty ()) {
190+ continue ;
191+ }
190192 index ++;
191193 String declaredType = pluginMethodParameter .getDeclaredType ().toString ();
192194
@@ -276,7 +278,7 @@ private void checkParametersCompatibility(
276278 if (declaredType .isEmpty ()) {
277279 continue ;
278280 }
279- if (!declaredType . equals ( MagentoPhpClass .PHP_NULL )) {
281+ if (!MagentoPhpClass .PHP_NULL . equals ( declaredType )) {
280282 problemsHolder .registerProblem (
281283 pluginMethodParameter ,
282284 PhpBundle .message (
0 commit comments