mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-26 04:42:36 +00:00
fix statis int/float in ereg transformer
This commit is contained in:
parent
6072707458
commit
13aff11638
|
@ -36,7 +36,7 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "^2.16",
|
"friendsofphp/php-cs-fixer": "^2.16",
|
||||||
"jetbrains/phpstorm-stubs": "^2019.2",
|
"jetbrains/phpstorm-stubs": "^2019.3",
|
||||||
"ocramius/package-versions": "^1.4|^1.5",
|
"ocramius/package-versions": "^1.4|^1.5",
|
||||||
"phpunit/phpunit": "^8.4|^9.0",
|
"phpunit/phpunit": "^8.4|^9.0",
|
||||||
"symplify/changelog-linker": "^7.2",
|
"symplify/changelog-linker": "^7.2",
|
||||||
|
@ -258,7 +258,5 @@
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "0.6-dev"
|
"dev-master": "0.6-dev"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"minimum-stability": "dev",
|
|
||||||
"prefer-stable": true
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,8 @@ final class EregToPcreTransformer
|
||||||
$r[$rr] .= '()';
|
$r[$rr] .= '()';
|
||||||
++$i;
|
++$i;
|
||||||
} else {
|
} else {
|
||||||
[$t, $ii] = $this->_ere2pcre($s, $i + 1);
|
$position = (int) $i + 1;
|
||||||
|
[$t, $ii] = $this->_ere2pcre($s, $position);
|
||||||
if ($ii >= $l || $s[$ii] !== ')') {
|
if ($ii >= $l || $s[$ii] !== ')') {
|
||||||
throw new InvalidEregException('"(" does not have a matching ")"');
|
throw new InvalidEregException('"(" does not have a matching ")"');
|
||||||
}
|
}
|
||||||
|
@ -100,11 +101,15 @@ final class EregToPcreTransformer
|
||||||
do {
|
do {
|
||||||
if ($s[$i] === '[' &&
|
if ($s[$i] === '[' &&
|
||||||
$i + 1 < $l && Strings::contains('.=:', $s[$i + 1])) {
|
$i + 1 < $l && Strings::contains('.=:', $s[$i + 1])) {
|
||||||
$ii = strpos($s, ']', $i);
|
$offset = (int) $i;
|
||||||
|
$ii = strpos($s, ']', $offset);
|
||||||
if ($ii === false) {
|
if ($ii === false) {
|
||||||
throw new InvalidEregException('"[" does not have a matching "]"');
|
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 = [
|
$cclsmap = [
|
||||||
':alnum:' => '[:alnum:]',
|
':alnum:' => '[:alnum:]',
|
||||||
':alpha:' => '[:alpha:]',
|
':alpha:' => '[:alpha:]',
|
||||||
|
@ -195,11 +200,15 @@ final class EregToPcreTransformer
|
||||||
$r[$rr] .= $c;
|
$r[$rr] .= $c;
|
||||||
++$i;
|
++$i;
|
||||||
} elseif ($c === '{') {
|
} elseif ($c === '{') {
|
||||||
|
$i = (int) $i;
|
||||||
$ii = strpos($s, '}', $i);
|
$ii = strpos($s, '}', $i);
|
||||||
if ($ii === false) {
|
if ($ii === false) {
|
||||||
throw new InvalidEregException('"{" does not have a matching "}"');
|
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|
|
$m = Strings::match($bound, '/^(\d|[1-9]\d|1\d\d|
|
||||||
2[0-4]\d|25[0-5])
|
2[0-4]\d|25[0-5])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user