Skip to content

Commit da17d7e

Browse files
committed
Implement suggested changes
Signed-off-by: Denis Kopylov <[email protected]>
1 parent b4742d8 commit da17d7e

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

dev/tests/static/framework/Magento/CodeMessDetector/Rule/UnusedCode/UnusedFormalParameter.php

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,35 @@ protected function removeUsedParameters(AbstractNode $node)
3636
*/
3737
private function removeVariablesUsedInPlugins(AbstractNode $node)
3838
{
39-
if ($node instanceof MethodNode) {
40-
/** @var ClassNode $classNode */
41-
$classNode = $node->getParentType();
42-
if ($this->isPluginClass($classNode->getNamespaceName())) {
43-
/**
44-
* Around and After plugins has 2 required params $subject and $proceed or $result
45-
* that should be ignored
46-
*/
47-
foreach (['around', 'after'] as $pluginMethodPrefix) {
48-
if ($this->isFunctionNameStartingWith($node, $pluginMethodPrefix)) {
49-
$this->removeVariablesByCount($node, 2);
39+
if (!$node instanceof MethodNode) {
40+
return;
41+
}
42+
43+
/** @var ClassNode $classNode */
44+
$classNode = $node->getParentType();
45+
if (!$this->isPluginClass($classNode->getNamespaceName())) {
46+
return;
47+
}
5048

51-
break;
52-
}
53-
}
49+
/**
50+
* Around and After plugins has 2 required params $subject and $proceed or $result
51+
* that should be ignored
52+
*/
53+
foreach (['around', 'after'] as $pluginMethodPrefix) {
54+
if ($this->isFunctionNameStartingWith($node, $pluginMethodPrefix)) {
55+
$this->removeVariablesByCount($node, 2);
5456

55-
/**
56-
* Before plugins has 1 required params $subject
57-
* that should be ignored
58-
*/
59-
if ($this->isFunctionNameStartingWith($node, 'before')) {
60-
$this->removeVariablesByCount($node, 1);
61-
}
57+
break;
6258
}
6359
}
60+
61+
/**
62+
* Before plugins has 1 required params $subject
63+
* that should be ignored
64+
*/
65+
if ($this->isFunctionNameStartingWith($node, 'before')) {
66+
$this->removeVariablesByCount($node, 1);
67+
}
6468
}
6569

6670
/**

0 commit comments

Comments
 (0)