Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
43
vendor/symfony/routing/RouteCompiler.php
vendored
43
vendor/symfony/routing/RouteCompiler.php
vendored
@@ -103,8 +103,7 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
$needsUtf8 = $route->getOption('utf8');
|
||||
|
||||
if (!$needsUtf8 && $useUtf8 && preg_match('/[\x80-\xFF]/', $pattern)) {
|
||||
$needsUtf8 = true;
|
||||
@trigger_error(sprintf('Using UTF-8 route patterns without setting the "utf8" option is deprecated since Symfony 3.2 and will throw a LogicException in 4.0. Turn on the "utf8" route option for pattern "%s".', $pattern), E_USER_DEPRECATED);
|
||||
throw new \LogicException(sprintf('Cannot use UTF-8 route patterns without setting the "utf8" option for route "%s".', $route->getPath()));
|
||||
}
|
||||
if (!$useUtf8 && $needsUtf8) {
|
||||
throw new \LogicException(sprintf('Cannot mix UTF-8 requirements with non-UTF-8 pattern "%s".', $pattern));
|
||||
@@ -176,12 +175,12 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
if (!preg_match('//u', $regexp)) {
|
||||
$useUtf8 = false;
|
||||
} elseif (!$needsUtf8 && preg_match('/[\x80-\xFF]|(?<!\\\\)\\\\(?:\\\\\\\\)*+(?-i:X|[pP][\{CLMNPSZ]|x\{[A-Fa-f0-9]{3})/', $regexp)) {
|
||||
$needsUtf8 = true;
|
||||
@trigger_error(sprintf('Using UTF-8 route requirements without setting the "utf8" option is deprecated since Symfony 3.2 and will throw a LogicException in 4.0. Turn on the "utf8" route option for variable "%s" in pattern "%s".', $varName, $pattern), E_USER_DEPRECATED);
|
||||
throw new \LogicException(sprintf('Cannot use UTF-8 route requirements without setting the "utf8" option for variable "%s" in pattern "%s".', $varName, $pattern));
|
||||
}
|
||||
if (!$useUtf8 && $needsUtf8) {
|
||||
throw new \LogicException(sprintf('Cannot mix UTF-8 requirement with non-UTF-8 charset for variable "%s" in pattern "%s".', $varName, $pattern));
|
||||
}
|
||||
$regexp = self::transformCapturingGroupsToNonCapturings($regexp);
|
||||
}
|
||||
|
||||
$tokens[] = array('variable', $isSeparator ? $precedingChar : '', $regexp, $varName);
|
||||
@@ -232,10 +231,8 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
|
||||
/**
|
||||
* Determines the longest static prefix possible for a route.
|
||||
*
|
||||
* @return string The leading static part of a route's path
|
||||
*/
|
||||
private static function determineStaticPrefix(Route $route, array $tokens)
|
||||
private static function determineStaticPrefix(Route $route, array $tokens): string
|
||||
{
|
||||
if ('text' !== $tokens[0][0]) {
|
||||
return ($route->hasDefault($tokens[0][3]) || '/' === $tokens[0][1]) ? '' : $tokens[0][1];
|
||||
@@ -251,14 +248,9 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next static character in the Route pattern that will serve as a separator.
|
||||
*
|
||||
* @param string $pattern The route pattern
|
||||
* @param bool $useUtf8 Whether the character is encoded in UTF-8 or not
|
||||
*
|
||||
* @return string The next static character that functions as separator (or empty string when none available)
|
||||
* Returns the next static character in the Route pattern that will serve as a separator (or the empty string when none available).
|
||||
*/
|
||||
private static function findNextSeparator($pattern, $useUtf8)
|
||||
private static function findNextSeparator(string $pattern, bool $useUtf8): string
|
||||
{
|
||||
if ('' == $pattern) {
|
||||
// return empty string if pattern is empty or false (false which can be returned by substr)
|
||||
@@ -284,7 +276,7 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
*
|
||||
* @return string The regexp pattern for a single token
|
||||
*/
|
||||
private static function computeRegexp(array $tokens, $index, $firstOptional)
|
||||
private static function computeRegexp(array $tokens, int $index, int $firstOptional): string
|
||||
{
|
||||
$token = $tokens[$index];
|
||||
if ('text' === $token[0]) {
|
||||
@@ -313,4 +305,25 @@ class RouteCompiler implements RouteCompilerInterface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function transformCapturingGroupsToNonCapturings(string $regexp): string
|
||||
{
|
||||
for ($i = 0; $i < \strlen($regexp); ++$i) {
|
||||
if ('\\' === $regexp[$i]) {
|
||||
++$i;
|
||||
continue;
|
||||
}
|
||||
if ('(' !== $regexp[$i] || !isset($regexp[$i + 2])) {
|
||||
continue;
|
||||
}
|
||||
if ('*' === $regexp[++$i] || '?' === $regexp[$i]) {
|
||||
++$i;
|
||||
continue;
|
||||
}
|
||||
$regexp = substr_replace($regexp, '?:', $i, 0);
|
||||
++$i;
|
||||
}
|
||||
|
||||
return $regexp;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user