Skip to content

Commit 8db77d9

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents e338796 + 9c62272 commit 8db77d9

15 files changed

+30
-30
lines changed

Annotation/Route.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(array $data)
6464
}
6565

6666
if (isset($data['utf8'])) {
67-
$data['options']['utf8'] = filter_var($data['utf8'], FILTER_VALIDATE_BOOLEAN) ?: false;
67+
$data['options']['utf8'] = filter_var($data['utf8'], \FILTER_VALIDATE_BOOLEAN) ?: false;
6868
unset($data['utf8']);
6969
}
7070

Generator/Dumper/PhpGeneratorDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Routing\Generator\Dumper;
1313

14-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "CompiledUrlGeneratorDumper" instead.', PhpGeneratorDumper::class), E_USER_DEPRECATED);
14+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "CompiledUrlGeneratorDumper" instead.', PhpGeneratorDumper::class), \E_USER_DEPRECATED);
1515

1616
use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper;
1717

Generator/UrlGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
302302
unset($extra['_fragment']);
303303
}
304304

305-
if ($extra && $query = http_build_query($extra, '', '&', PHP_QUERY_RFC3986)) {
305+
if ($extra && $query = http_build_query($extra, '', '&', \PHP_QUERY_RFC3986)) {
306306
$url .= '?'.strtr($query, self::QUERY_FRAGMENT_DECODED);
307307
}
308308

Loader/AnnotationClassLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
147147

148148
foreach ($requirements as $placeholder => $requirement) {
149149
if (\is_int($placeholder)) {
150-
@trigger_error(sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" of route "%s" in "%s::%s()"?', $placeholder, $requirement, $name, $class->getName(), $method->getName()), E_USER_DEPRECATED);
150+
@trigger_error(sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" of route "%s" in "%s::%s()"?', $placeholder, $requirement, $name, $class->getName(), $method->getName()), \E_USER_DEPRECATED);
151151
}
152152
}
153153

@@ -305,7 +305,7 @@ protected function getGlobals(\ReflectionClass $class)
305305

306306
foreach ($globals['requirements'] as $placeholder => $requirement) {
307307
if (\is_int($placeholder)) {
308-
@trigger_error(sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" in "%s"?', $placeholder, $requirement, $class->getName()), E_USER_DEPRECATED);
308+
@trigger_error(sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" in "%s"?', $placeholder, $requirement, $class->getName()), \E_USER_DEPRECATED);
309309
}
310310
}
311311
}

Loader/AnnotationFileLoader.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function load($file, $type = null)
7575
*/
7676
public function supports($resource, $type = null)
7777
{
78-
return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
78+
return \is_string($resource) && 'php' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
7979
}
8080

8181
/**
@@ -91,11 +91,11 @@ protected function findClass($file)
9191
$namespace = false;
9292
$tokens = token_get_all(file_get_contents($file));
9393

94-
if (1 === \count($tokens) && T_INLINE_HTML === $tokens[0][0]) {
94+
if (1 === \count($tokens) && \T_INLINE_HTML === $tokens[0][0]) {
9595
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forgot to add the "<?php" start tag at the beginning of the file?', $file));
9696
}
9797

98-
$nsTokens = [T_NS_SEPARATOR => true, T_STRING => true];
98+
$nsTokens = [\T_NS_SEPARATOR => true, \T_STRING => true];
9999
if (\defined('T_NAME_QUALIFIED')) {
100100
$nsTokens[T_NAME_QUALIFIED] = true;
101101
}
@@ -107,7 +107,7 @@ protected function findClass($file)
107107
continue;
108108
}
109109

110-
if (true === $class && T_STRING === $token[0]) {
110+
if (true === $class && \T_STRING === $token[0]) {
111111
return $namespace.'\\'.$token[1];
112112
}
113113

@@ -119,18 +119,18 @@ protected function findClass($file)
119119
$token = $tokens[$i];
120120
}
121121

122-
if (T_CLASS === $token[0]) {
122+
if (\T_CLASS === $token[0]) {
123123
// Skip usage of ::class constant and anonymous classes
124124
$skipClassToken = false;
125125
for ($j = $i - 1; $j > 0; --$j) {
126126
if (!isset($tokens[$j][1])) {
127127
break;
128128
}
129129

130-
if (T_DOUBLE_COLON === $tokens[$j][0] || T_NEW === $tokens[$j][0]) {
130+
if (\T_DOUBLE_COLON === $tokens[$j][0] || \T_NEW === $tokens[$j][0]) {
131131
$skipClassToken = true;
132132
break;
133-
} elseif (!\in_array($tokens[$j][0], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT])) {
133+
} elseif (!\in_array($tokens[$j][0], [\T_WHITESPACE, \T_DOC_COMMENT, \T_COMMENT])) {
134134
break;
135135
}
136136
}
@@ -140,7 +140,7 @@ protected function findClass($file)
140140
}
141141
}
142142

143-
if (T_NAMESPACE === $token[0]) {
143+
if (\T_NAMESPACE === $token[0]) {
144144
$namespace = true;
145145
}
146146
}

Loader/DependencyInjection/ServiceRouterLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\Routing\Loader\ContainerLoader;
1616
use Symfony\Component\Routing\Loader\ObjectRouteLoader;
1717

18-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ServiceRouterLoader::class, ContainerLoader::class), E_USER_DEPRECATED);
18+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ServiceRouterLoader::class, ContainerLoader::class), \E_USER_DEPRECATED);
1919

2020
/**
2121
* A route loader that executes a service to load the routes.

Loader/ObjectLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function load($resource, $type = null)
4848

4949
if (1 === substr_count($resource, ':')) {
5050
$resource = str_replace(':', '::', $resource);
51-
@trigger_error(sprintf('Referencing object route loaders with a single colon is deprecated since Symfony 4.1. Use %s instead.', $resource), E_USER_DEPRECATED);
51+
@trigger_error(sprintf('Referencing object route loaders with a single colon is deprecated since Symfony 4.1. Use %s instead.', $resource), \E_USER_DEPRECATED);
5252
}
5353

5454
$parts = explode('::', $resource);

Loader/ObjectRouteLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Routing\Loader;
1313

14-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ObjectRouteLoader::class, ObjectLoader::class), E_USER_DEPRECATED);
14+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ObjectRouteLoader::class, ObjectLoader::class), \E_USER_DEPRECATED);
1515

1616
/**
1717
* A route loader that calls a method on an object to load the routes.

Loader/PhpFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function load($file, $type = null)
6363
*/
6464
public function supports($resource, $type = null)
6565
{
66-
return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type);
66+
return \is_string($resource) && 'php' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'php' === $type);
6767
}
6868
}
6969

Loader/XmlFileLoader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ protected function parseNode(RouteCollection $collection, \DOMElement $node, $pa
9393
*/
9494
public function supports($resource, $type = null)
9595
{
96-
return \is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
96+
return \is_string($resource) && 'xml' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
9797
}
9898

9999
/**
@@ -110,8 +110,8 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, $p
110110
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have an "id" attribute.', $path));
111111
}
112112

113-
$schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY);
114-
$methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY);
113+
$schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, \PREG_SPLIT_NO_EMPTY);
114+
$methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, \PREG_SPLIT_NO_EMPTY);
115115

116116
list($defaults, $requirements, $options, $condition, $paths) = $this->parseConfigs($node, $path);
117117

@@ -155,8 +155,8 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, $
155155
$type = $node->getAttribute('type');
156156
$prefix = $node->getAttribute('prefix');
157157
$host = $node->hasAttribute('host') ? $node->getAttribute('host') : null;
158-
$schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY) : null;
159-
$methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY) : null;
158+
$schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, \PREG_SPLIT_NO_EMPTY) : null;
159+
$methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, \PREG_SPLIT_NO_EMPTY) : null;
160160
$trailingSlashOnRoot = $node->hasAttribute('trailing-slash-on-root') ? XmlUtils::phpize($node->getAttribute('trailing-slash-on-root')) : true;
161161

162162
list($defaults, $requirements, $options, $condition, /* $paths */, $prefixes) = $this->parseConfigs($node, $path);

Loader/YamlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function load($file, $type = null)
9696
*/
9797
public function supports($resource, $type = null)
9898
{
99-
return \is_string($resource) && \in_array(pathinfo($resource, PATHINFO_EXTENSION), ['yml', 'yaml'], true) && (!$type || 'yaml' === $type);
99+
return \is_string($resource) && \in_array(pathinfo($resource, \PATHINFO_EXTENSION), ['yml', 'yaml'], true) && (!$type || 'yaml' === $type);
100100
}
101101

102102
/**
@@ -118,7 +118,7 @@ protected function parseRoute(RouteCollection $collection, $name, array $config,
118118

119119
foreach ($requirements as $placeholder => $requirement) {
120120
if (\is_int($placeholder)) {
121-
@trigger_error(sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" of route "%s" in "%s"?', $placeholder, $requirement, $name, $path), E_USER_DEPRECATED);
121+
@trigger_error(sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" of route "%s" in "%s"?', $placeholder, $requirement, $name, $path), \E_USER_DEPRECATED);
122122
}
123123
}
124124

Matcher/Dumper/PhpMatcherDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Routing\Matcher\Dumper;
1313

14-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "CompiledUrlMatcherDumper" instead.', PhpMatcherDumper::class), E_USER_DEPRECATED);
14+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "CompiledUrlMatcherDumper" instead.', PhpMatcherDumper::class), \E_USER_DEPRECATED);
1515

1616
/**
1717
* PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes.

RouteCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function addCollection(self $collection)
140140
public function addPrefix($prefix, array $defaults = [], array $requirements = [])
141141
{
142142
if (null === $prefix) {
143-
@trigger_error(sprintf('Passing null as $prefix to %s is deprecated in Symfony 4.4 and will trigger a TypeError in 5.0.', __METHOD__), E_USER_DEPRECATED);
143+
@trigger_error(sprintf('Passing null as $prefix to %s is deprecated in Symfony 4.4 and will trigger a TypeError in 5.0.', __METHOD__), \E_USER_DEPRECATED);
144144
}
145145

146146
$prefix = trim(trim($prefix), '/');

RouteCompiler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private static function compilePattern(Route $route, string $pattern, bool $isHo
119119

120120
// Match all variables enclosed in "{}" and iterate over them. But we only want to match the innermost variable
121121
// in case of nested "{}", e.g. {foo{bar}}. This in ensured because \w does not match "{" or "}" itself.
122-
preg_match_all('#\{(!)?(\w+)\}#', $pattern, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
122+
preg_match_all('#\{(!)?(\w+)\}#', $pattern, $matches, \PREG_OFFSET_CAPTURE | \PREG_SET_ORDER);
123123
foreach ($matches as $match) {
124124
$important = $match[1][1] >= 0;
125125
$varName = $match[2][0];
@@ -207,7 +207,7 @@ private static function compilePattern(Route $route, string $pattern, bool $isHo
207207
}
208208

209209
// find the first optional token
210-
$firstOptional = PHP_INT_MAX;
210+
$firstOptional = \PHP_INT_MAX;
211211
if (!$isHost) {
212212
for ($i = \count($tokens) - 1; $i >= 0; --$i) {
213213
$token = $tokens[$i];

Router.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,13 @@ private function checkDeprecatedOption(string $key)
433433
case 'generator_cache_class':
434434
case 'matcher_base_class':
435435
case 'matcher_cache_class':
436-
@trigger_error(sprintf('Option "%s" given to router %s is deprecated since Symfony 4.3.', $key, static::class), E_USER_DEPRECATED);
436+
@trigger_error(sprintf('Option "%s" given to router %s is deprecated since Symfony 4.3.', $key, static::class), \E_USER_DEPRECATED);
437437
}
438438
}
439439

440440
private static function getCompiledRoutes(string $path): array
441441
{
442-
if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(ini_get('opcache.enable_cli'), FILTER_VALIDATE_BOOLEAN))) {
442+
if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) {
443443
self::$cache = null;
444444
}
445445

0 commit comments

Comments
 (0)