/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class LoopContextPass extends CodeCleanerPass
{
- private $isPHP54;
private $loopDepth;
- public function __construct()
- {
- $this->isPHP54 = version_compare(PHP_VERSION, '5.4.0', '>=');
- }
-
/**
* {@inheritdoc}
*/
if ($node->num instanceof LNumber || $node->num instanceof DNumber) {
$num = $node->num->value;
- if ($this->isPHP54 && ($node->num instanceof DNumber || $num < 1)) {
+ if ($node->num instanceof DNumber || $num < 1) {
$msg = sprintf("'%s' operator accepts only positive numbers", $operator);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
$msg = sprintf("Cannot '%s' %d levels", $operator, $num);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
- } elseif ($node->num && $this->isPHP54) {
+ } elseif ($node->num) {
$msg = sprintf("'%s' operator with non-constant operand is no longer supported", $operator);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}