diff --git a/composer.json b/composer.json index 551bb925856..34d6bbd1267 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.16", - "jetbrains/phpstorm-stubs": "^2019.2", + "jetbrains/phpstorm-stubs": "^2019.3", "ocramius/package-versions": "^1.4|^1.5", "phpunit/phpunit": "^8.4|^9.0", "symplify/changelog-linker": "^7.2", @@ -258,7 +258,5 @@ "branch-alias": { "dev-master": "0.6-dev" } - }, - "minimum-stability": "dev", - "prefer-stable": true + } } diff --git a/rules/php-70/src/EregToPcreTransformer.php b/rules/php-70/src/EregToPcreTransformer.php index 92b0b70361e..b05bf89bf8b 100644 --- a/rules/php-70/src/EregToPcreTransformer.php +++ b/rules/php-70/src/EregToPcreTransformer.php @@ -79,7 +79,8 @@ final class EregToPcreTransformer $r[$rr] .= '()'; ++$i; } else { - [$t, $ii] = $this->_ere2pcre($s, $i + 1); + $position = (int) $i + 1; + [$t, $ii] = $this->_ere2pcre($s, $position); if ($ii >= $l || $s[$ii] !== ')') { throw new InvalidEregException('"(" does not have a matching ")"'); } @@ -100,11 +101,15 @@ final class EregToPcreTransformer do { if ($s[$i] === '[' && $i + 1 < $l && Strings::contains('.=:', $s[$i + 1])) { - $ii = strpos($s, ']', $i); + $offset = (int) $i; + $ii = strpos($s, ']', $offset); if ($ii === false) { throw new InvalidEregException('"[" does not have a matching "]"'); } - $ccls = Strings::substring($s, $i + 1, $ii - ($i + 1)); + + $start = (int) $i + 1; + $length = (int) ($ii - ($i + 1)); + $ccls = Strings::substring($s, $start, $length); $cclsmap = [ ':alnum:' => '[:alnum:]', ':alpha:' => '[:alpha:]', @@ -195,11 +200,15 @@ final class EregToPcreTransformer $r[$rr] .= $c; ++$i; } elseif ($c === '{') { + $i = (int) $i; $ii = strpos($s, '}', $i); if ($ii === false) { throw new InvalidEregException('"{" does not have a matching "}"'); } - $bound = Strings::substring($s, $i + 1, $ii - ($i + 1)); + + $start = (int) $i + 1; + $length = (int) $ii - ($i + 1); + $bound = Strings::substring($s, $start, $length); $m = Strings::match($bound, '/^(\d|[1-9]\d|1\d\d| 2[0-4]\d|25[0-5])