make use of matchFirstAndSecondConditionNode Node type

This commit is contained in:
Tomas Votruba 2018-11-09 23:27:07 +01:00
parent 3ecf8172ed
commit 09e949f76e
5 changed files with 6 additions and 15 deletions

View File

@ -94,9 +94,7 @@ CODE_SAMPLE
$matchedNodes = $this->binaryOpMaintainer->matchFirstAndSecondConditionNode(
$ifCondition,
function (Node $node) {
return $node instanceof Variable;
},
Variable::class,
function (Node $node, Node $otherNode) use ($foreachValueNode) {
return $this->areNodesEqual($otherNode, $foreachValueNode);
}

View File

@ -80,9 +80,7 @@ final class SimplifyConditionsRector extends AbstractRector
function (Node $node) {
return $node instanceof Identical || $node instanceof NotIdentical;
},
function (Node $node) {
return $node;
}
Node::class
);
if ($matchedNodes === null) {

View File

@ -22,4 +22,4 @@ class SomeClass
}
$objects = [];
echo is_array($objects) && is_array($objects);
is_array($objects) && is_array($objects);

View File

@ -22,4 +22,4 @@ class SomeClass
}
$objects = [];
echo is_array($objects) && is_array($objects);
is_array($objects) && is_array($objects);

View File

@ -2,7 +2,6 @@
namespace Rector\Php;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\BinaryOp\BooleanOr;
use PhpParser\Node\Expr\FuncCall;
@ -34,12 +33,8 @@ final class DualCheckToAble
{
$matchedNodes = $this->binaryOpMaintainer->matchFirstAndSecondConditionNode(
$booleanOrNode,
function (Node $node) {
return $node instanceof Instanceof_;
},
function (Node $node) {
return $node instanceof FuncCall;
}
Instanceof_::class,
FuncCall::class
);
if ($matchedNodes === null) {