mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-22 19:05:10 +00:00
fix statis int/float in ereg transformer
This commit is contained in:
parent
6072707458
commit
13aff11638
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue
Block a user