mirror of
https://github.com/danog/psalm.git
synced 2024-12-13 01:37:23 +01:00
change order for better diff
This commit is contained in:
parent
5ec9e6543d
commit
efde3f9180
@ -1491,39 +1491,6 @@ class AssertionFinder
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Identical|Equal|NotIdentical|NotEqual $conditional
|
|
||||||
* @return false|int
|
|
||||||
*/
|
|
||||||
protected static function hasCountEqualityCheck(
|
|
||||||
PhpParser\Node\Expr\BinaryOp $conditional,
|
|
||||||
?int &$min_count
|
|
||||||
) {
|
|
||||||
$left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall
|
|
||||||
&& $conditional->left->name instanceof PhpParser\Node\Name
|
|
||||||
&& strtolower($conditional->left->name->parts[0]) === 'count'
|
|
||||||
&& $conditional->left->args;
|
|
||||||
|
|
||||||
if ($left_count && $conditional->right instanceof PhpParser\Node\Scalar\LNumber) {
|
|
||||||
$min_count = $conditional->right->value;
|
|
||||||
|
|
||||||
return self::ASSIGNMENT_TO_RIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
$right_count = $conditional->right instanceof PhpParser\Node\Expr\FuncCall
|
|
||||||
&& $conditional->right->name instanceof PhpParser\Node\Name
|
|
||||||
&& strtolower($conditional->right->name->parts[0]) === 'count'
|
|
||||||
&& $conditional->right->args;
|
|
||||||
|
|
||||||
if ($right_count && $conditional->left instanceof PhpParser\Node\Scalar\LNumber) {
|
|
||||||
$min_count = $conditional->left->value;
|
|
||||||
|
|
||||||
return self::ASSIGNMENT_TO_LEFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional
|
* @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional
|
||||||
* @return false|int
|
* @return false|int
|
||||||
@ -1573,6 +1540,39 @@ class AssertionFinder
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Identical|Equal|NotIdentical|NotEqual $conditional
|
||||||
|
* @return false|int
|
||||||
|
*/
|
||||||
|
protected static function hasCountEqualityCheck(
|
||||||
|
PhpParser\Node\Expr\BinaryOp $conditional,
|
||||||
|
?int &$min_count
|
||||||
|
) {
|
||||||
|
$left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall
|
||||||
|
&& $conditional->left->name instanceof PhpParser\Node\Name
|
||||||
|
&& strtolower($conditional->left->name->parts[0]) === 'count'
|
||||||
|
&& $conditional->left->args;
|
||||||
|
|
||||||
|
if ($left_count && $conditional->right instanceof PhpParser\Node\Scalar\LNumber) {
|
||||||
|
$min_count = $conditional->right->value;
|
||||||
|
|
||||||
|
return self::ASSIGNMENT_TO_RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
$right_count = $conditional->right instanceof PhpParser\Node\Expr\FuncCall
|
||||||
|
&& $conditional->right->name instanceof PhpParser\Node\Name
|
||||||
|
&& strtolower($conditional->right->name->parts[0]) === 'count'
|
||||||
|
&& $conditional->right->args;
|
||||||
|
|
||||||
|
if ($right_count && $conditional->left instanceof PhpParser\Node\Scalar\LNumber) {
|
||||||
|
$min_count = $conditional->left->value;
|
||||||
|
|
||||||
|
return self::ASSIGNMENT_TO_LEFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param PhpParser\Node\Expr\BinaryOp\Greater|PhpParser\Node\Expr\BinaryOp\GreaterOrEqual $conditional
|
* @param PhpParser\Node\Expr\BinaryOp\Greater|PhpParser\Node\Expr\BinaryOp\GreaterOrEqual $conditional
|
||||||
* @return false|int
|
* @return false|int
|
||||||
|
Loading…
Reference in New Issue
Block a user