Skip to content

Commit f17d8a0

Browse files
Merge branch '3.4' into 4.0
* 3.4: Fix Clidumper tests Enable the fixer enforcing fully-qualified calls for compiler-optimized functions Apply fixers Disable the native_constant_invocation fixer until it can be scoped Update the list of excluded files for the CS fixer
2 parents c889c79 + d36d6c3 commit f17d8a0

21 files changed

+68
-68
lines changed

Annotation/Route.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(array $data)
4646
foreach ($data as $key => $value) {
4747
$method = 'set'.str_replace('_', '', $key);
4848
if (!method_exists($this, $method)) {
49-
throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, get_class($this)));
49+
throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, \get_class($this)));
5050
}
5151
$this->$method($value);
5252
}
@@ -114,7 +114,7 @@ public function getDefaults()
114114

115115
public function setSchemes($schemes)
116116
{
117-
$this->schemes = is_array($schemes) ? $schemes : array($schemes);
117+
$this->schemes = \is_array($schemes) ? $schemes : array($schemes);
118118
}
119119

120120
public function getSchemes()
@@ -124,7 +124,7 @@ public function getSchemes()
124124

125125
public function setMethods($methods)
126126
{
127-
$this->methods = is_array($methods) ? $methods : array($methods);
127+
$this->methods = \is_array($methods) ? $methods : array($methods);
128128
}
129129

130130
public function getMethods()

Generator/UrlGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
185185
$scheme = $this->context->getScheme();
186186

187187
if ($requiredSchemes) {
188-
if (!in_array($scheme, $requiredSchemes, true)) {
188+
if (!\in_array($scheme, $requiredSchemes, true)) {
189189
$referenceType = self::ABSOLUTE_URL;
190190
$scheme = current($requiredSchemes);
191191
}
@@ -308,7 +308,7 @@ public static function getRelativePath($basePath, $targetPath)
308308
}
309309

310310
$targetDirs[] = $targetFile;
311-
$path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs);
311+
$path = str_repeat('../', \count($sourceDirs)).implode('/', $targetDirs);
312312

313313
// A reference to the same base directory or an empty subdirectory must be prefixed with "./".
314314
// This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used

Loader/AnnotationClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
174174
*/
175175
public function supports($resource, $type = null)
176176
{
177-
return is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
177+
return \is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
178178
}
179179

180180
/**

Loader/AnnotationDirectoryLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function supports($resource, $type = null)
8080
return true;
8181
}
8282

83-
if ($type || !is_string($resource)) {
83+
if ($type || !\is_string($resource)) {
8484
return false;
8585
}
8686

Loader/AnnotationFileLoader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AnnotationFileLoader extends FileLoader
3131
*/
3232
public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader)
3333
{
34-
if (!function_exists('token_get_all')) {
34+
if (!\function_exists('token_get_all')) {
3535
throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.');
3636
}
3737

@@ -71,7 +71,7 @@ public function load($file, $type = null)
7171
*/
7272
public function supports($resource, $type = null)
7373
{
74-
return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
74+
return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
7575
}
7676

7777
/**
@@ -87,7 +87,7 @@ protected function findClass($file)
8787
$namespace = false;
8888
$tokens = token_get_all(file_get_contents($file));
8989

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

@@ -104,7 +104,7 @@ protected function findClass($file)
104104

105105
if (true === $namespace && T_STRING === $token[0]) {
106106
$namespace = $token[1];
107-
while (isset($tokens[++$i][1]) && in_array($tokens[$i][0], array(T_NS_SEPARATOR, T_STRING))) {
107+
while (isset($tokens[++$i][1]) && \in_array($tokens[$i][0], array(T_NS_SEPARATOR, T_STRING))) {
108108
$namespace .= $tokens[$i][1];
109109
}
110110
$token = $tokens[$i];
@@ -121,7 +121,7 @@ protected function findClass($file)
121121
if (T_DOUBLE_COLON === $tokens[$j][0] || T_NEW === $tokens[$j][0]) {
122122
$skipClassToken = true;
123123
break;
124-
} elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) {
124+
} elseif (!\in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) {
125125
break;
126126
}
127127
}

Loader/Configurator/RoutingConfigurator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public function __construct(RouteCollection $collection, PhpFileLoader $loader,
3838
*/
3939
final public function import($resource, $type = null, $ignoreErrors = false)
4040
{
41-
$this->loader->setCurrentDir(dirname($this->path));
41+
$this->loader->setCurrentDir(\dirname($this->path));
4242
$imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file);
43-
if (!is_array($imported)) {
43+
if (!\is_array($imported)) {
4444
return new ImportConfigurator($this->collection, $imported);
4545
}
4646

Loader/ObjectRouteLoader.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract protected function getServiceObject($id);
4545
public function load($resource, $type = null)
4646
{
4747
$parts = explode(':', $resource);
48-
if (2 != count($parts)) {
48+
if (2 != \count($parts)) {
4949
throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service_name:methodName"', $resource));
5050
}
5151

@@ -54,20 +54,20 @@ public function load($resource, $type = null)
5454

5555
$loaderObject = $this->getServiceObject($serviceString);
5656

57-
if (!is_object($loaderObject)) {
58-
throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', get_class($this), gettype($loaderObject)));
57+
if (!\is_object($loaderObject)) {
58+
throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject)));
5959
}
6060

6161
if (!method_exists($loaderObject, $method)) {
62-
throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, get_class($loaderObject), $resource));
62+
throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, \get_class($loaderObject), $resource));
6363
}
6464

65-
$routeCollection = call_user_func(array($loaderObject, $method), $this);
65+
$routeCollection = \call_user_func(array($loaderObject, $method), $this);
6666

6767
if (!$routeCollection instanceof RouteCollection) {
68-
$type = is_object($routeCollection) ? get_class($routeCollection) : gettype($routeCollection);
68+
$type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection);
6969

70-
throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned', get_class($loaderObject), $method, $type));
70+
throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned', \get_class($loaderObject), $method, $type));
7171
}
7272

7373
// make the service file tracked so that if it changes, the cache rebuilds

Loader/PhpFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class PhpFileLoader extends FileLoader
3636
public function load($file, $type = null)
3737
{
3838
$path = $this->locator->locate($file);
39-
$this->setCurrentDir(dirname($path));
39+
$this->setCurrentDir(\dirname($path));
4040

4141
// the closure forbids access to the private scope in the included file
4242
$loader = $this;
@@ -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: 3 additions & 3 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
/**
@@ -144,11 +144,11 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, $
144144

145145
list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path);
146146

147-
$this->setCurrentDir(dirname($path));
147+
$this->setCurrentDir(\dirname($path));
148148

149149
$imported = $this->import($resource, ('' !== $type ? $type : null), false, $file);
150150

151-
if (!is_array($imported)) {
151+
if (!\is_array($imported)) {
152152
$imported = array($imported);
153153
}
154154

Loader/YamlFileLoader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function load($file, $type = null)
7272
}
7373

7474
// not an array
75-
if (!is_array($parsedConfig)) {
75+
if (!\is_array($parsedConfig)) {
7676
throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path));
7777
}
7878

@@ -94,7 +94,7 @@ public function load($file, $type = null)
9494
*/
9595
public function supports($resource, $type = null)
9696
{
97-
return is_string($resource) && in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type);
97+
return \is_string($resource) && \in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type);
9898
}
9999

100100
/**
@@ -148,11 +148,11 @@ protected function parseImport(RouteCollection $collection, array $config, $path
148148
$defaults['_controller'] = $config['controller'];
149149
}
150150

151-
$this->setCurrentDir(dirname($path));
151+
$this->setCurrentDir(\dirname($path));
152152

153153
$imported = $this->import($config['resource'], $type, false, $file);
154154

155-
if (!is_array($imported)) {
155+
if (!\is_array($imported)) {
156156
$imported = array($imported);
157157
}
158158

@@ -191,7 +191,7 @@ protected function parseImport(RouteCollection $collection, array $config, $path
191191
*/
192192
protected function validate($config, $name, $path)
193193
{
194-
if (!is_array($config)) {
194+
if (!\is_array($config)) {
195195
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
196196
}
197197
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {

0 commit comments

Comments
 (0)