Check minimum php version before running IsCountableRector and TernaryToSpaceshipRector

This commit is contained in:
Manuel Dalla Lana 2019-03-12 18:05:52 +01:00 committed by Manuel Dalla Lana
parent 5f77059320
commit 9d66c6a45d
2 changed files with 8 additions and 0 deletions

View File

@ -52,6 +52,10 @@ CODE_SAMPLE
*/
public function refactor(Node $node): ?Node
{
if (! $this->isAtLeastPhpVersion('7.3')) {
return null;
}
return $this->dualCheckToAble->processBooleanOr($node, 'Countable', 'is_countable') ?: $node;
}
}

View File

@ -49,6 +49,10 @@ CODE_SAMPLE
*/
public function refactor(Node $node): ?Node
{
if (! $this->isAtLeastPhpVersion('7.0')) {
return null;
}
if ($this->shouldSkip($node)) {
return null;
}