2020import com .jetbrains .php .lang .psi .visitors .PhpElementVisitor ;
2121import com .magento .idea .magento2plugin .inspections .php .util .PhpClassImplementsInterfaceUtil ;
2222import com .magento .idea .magento2plugin .magento .files .Plugin ;
23+ import com .magento .idea .magento2plugin .magento .packages .Package ;
2324import com .magento .idea .magento2plugin .util .GetPhpClassByFQN ;
2425import com .magento .idea .magento2plugin .util .magento .plugin .GetTargetClassNamesByPluginClassName ;
2526import org .jetbrains .annotations .NotNull ;
@@ -128,7 +129,7 @@ private void checkParametersCompatibility(Method pluginMethod, String pluginPref
128129 String declaredType = pluginMethodParameter .getDeclaredType ().toString ();
129130
130131 if (index == 1 ) {
131- String targetClassFqn = " \\ " .concat (targetClassName );
132+ String targetClassFqn = Package . FQN_SEPARATOR .concat (targetClassName );
132133 if (!checkTypeIncompatibility (targetClassFqn , declaredType , phpIndex )) {
133134 problemsHolder .registerProblem (pluginMethodParameter , PhpBundle .message ("inspection.wrong_param_type" , new Object []{declaredType , targetClassFqn }), ProblemHighlightType .ERROR );
134135 }
@@ -138,7 +139,8 @@ private void checkParametersCompatibility(Method pluginMethod, String pluginPref
138139 continue ;
139140 }
140141 if (index == 2 && pluginPrefix .equals (Plugin .PluginType .around .toString ())) {
141- if (!checkTypeIncompatibility ("callable" , declaredType , phpIndex )) {
142+ if (!checkTypeIncompatibility (Plugin .CALLABLE_PARAM , declaredType , phpIndex ) &&
143+ !checkTypeIncompatibility (Package .FQN_SEPARATOR .concat (Plugin .CLOSURE_PARAM ), declaredType , phpIndex )) {
142144 problemsHolder .registerProblem (pluginMethodParameter , PhpBundle .message ("inspection.wrong_param_type" , new Object []{declaredType , "callable" }), ProblemHighlightType .ERROR );
143145 }
144146 continue ;
0 commit comments