Skip to content

Commit d36e06e

Browse files
Merge branch '4.4' into 5.1
* 4.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 47b0218 + 8db77d9 commit d36e06e

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

Annotation/Route.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ public function __construct(array $data)
6565
}
6666

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

7272
if (isset($data['stateless'])) {
73-
$data['defaults']['_stateless'] = filter_var($data['stateless'], FILTER_VALIDATE_BOOLEAN) ?: false;
73+
$data['defaults']['_stateless'] = filter_var($data['stateless'], \FILTER_VALIDATE_BOOLEAN) ?: false;
7474
unset($data['stateless']);
7575
}
7676

Generator/UrlGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ protected function doGenerate(array $variables, array $defaults, array $requirem
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/AnnotationFileLoader.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function load($file, string $type = null)
7575
*/
7676
public function supports($resource, string $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
/**
@@ -89,11 +89,11 @@ protected function findClass(string $file)
8989
$namespace = false;
9090
$tokens = token_get_all(file_get_contents($file));
9191

92-
if (1 === \count($tokens) && T_INLINE_HTML === $tokens[0][0]) {
92+
if (1 === \count($tokens) && \T_INLINE_HTML === $tokens[0][0]) {
9393
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));
9494
}
9595

96-
$nsTokens = [T_NS_SEPARATOR => true, T_STRING => true];
96+
$nsTokens = [\T_NS_SEPARATOR => true, \T_STRING => true];
9797
if (\defined('T_NAME_QUALIFIED')) {
9898
$nsTokens[T_NAME_QUALIFIED] = true;
9999
}
@@ -105,7 +105,7 @@ protected function findClass(string $file)
105105
continue;
106106
}
107107

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

@@ -117,18 +117,18 @@ protected function findClass(string $file)
117117
$token = $tokens[$i];
118118
}
119119

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

128-
if (T_DOUBLE_COLON === $tokens[$j][0] || T_NEW === $tokens[$j][0]) {
128+
if (\T_DOUBLE_COLON === $tokens[$j][0] || \T_NEW === $tokens[$j][0]) {
129129
$skipClassToken = true;
130130
break;
131-
} elseif (!\in_array($tokens[$j][0], [T_WHITESPACE, T_DOC_COMMENT, T_COMMENT])) {
131+
} elseif (!\in_array($tokens[$j][0], [\T_WHITESPACE, \T_DOC_COMMENT, \T_COMMENT])) {
132132
break;
133133
}
134134
}
@@ -138,7 +138,7 @@ protected function findClass(string $file)
138138
}
139139
}
140140

141-
if (T_NAMESPACE === $token[0]) {
141+
if (\T_NAMESPACE === $token[0]) {
142142
$namespace = true;
143143
}
144144
}

Loader/PhpFileLoader.php

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

7070
protected function callConfigurator(callable $result, string $path, string $file): RouteCollection

Loader/XmlFileLoader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function parseNode(RouteCollection $collection, \DOMElement $node, str
9898
*/
9999
public function supports($resource, string $type = null)
100100
{
101-
return \is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
101+
return \is_string($resource) && 'xml' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
102102
}
103103

104104
/**
@@ -115,8 +115,8 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, st
115115
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have an "id" attribute.', $path));
116116
}
117117

118-
$schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY);
119-
$methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY);
118+
$schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, \PREG_SPLIT_NO_EMPTY);
119+
$methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, \PREG_SPLIT_NO_EMPTY);
120120

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

@@ -158,8 +158,8 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, s
158158

159159
$type = $node->getAttribute('type');
160160
$prefix = $node->getAttribute('prefix');
161-
$schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY) : null;
162-
$methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY) : null;
161+
$schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, \PREG_SPLIT_NO_EMPTY) : null;
162+
$methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, \PREG_SPLIT_NO_EMPTY) : null;
163163
$trailingSlashOnRoot = $node->hasAttribute('trailing-slash-on-root') ? XmlUtils::phpize($node->getAttribute('trailing-slash-on-root')) : true;
164164
$namePrefix = $node->getAttribute('name-prefix') ?: null;
165165

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function load($file, string $type = null)
101101
*/
102102
public function supports($resource, string $type = null)
103103
{
104-
return \is_string($resource) && \in_array(pathinfo($resource, PATHINFO_EXTENSION), ['yml', 'yaml'], true) && (!$type || 'yaml' === $type);
104+
return \is_string($resource) && \in_array(pathinfo($resource, \PATHINFO_EXTENSION), ['yml', 'yaml'], true) && (!$type || 'yaml' === $type);
105105
}
106106

107107
/**

RouteCompiler.php

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

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

212212
// find the first optional token
213-
$firstOptional = PHP_INT_MAX;
213+
$firstOptional = \PHP_INT_MAX;
214214
if (!$isHost) {
215215
for ($i = \count($tokens) - 1; $i >= 0; --$i) {
216216
$token = $tokens[$i];

Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ private function getConfigCacheFactory(): ConfigCacheFactoryInterface
373373

374374
private static function getCompiledRoutes(string $path): array
375375
{
376-
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))) {
376+
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))) {
377377
self::$cache = null;
378378
}
379379

0 commit comments

Comments
 (0)