Skip to content

Commit 20d51f5

Browse files
Merge branch '4.1'
* 4.1: 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 9c12892 + c12c3b0 commit 20d51f5

18 files changed

+71
-71
lines changed

Annotation/Route.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,23 @@ class Route
4040
public function __construct(array $data)
4141
{
4242
if (isset($data['localized_paths'])) {
43-
throw new \BadMethodCallException(sprintf('Unknown property "localized_paths" on annotation "%s".', get_class($this)));
43+
throw new \BadMethodCallException(sprintf('Unknown property "localized_paths" on annotation "%s".', \get_class($this)));
4444
}
4545

4646
if (isset($data['value'])) {
47-
$data[is_array($data['value']) ? 'localized_paths' : 'path'] = $data['value'];
47+
$data[\is_array($data['value']) ? 'localized_paths' : 'path'] = $data['value'];
4848
unset($data['value']);
4949
}
5050

51-
if (isset($data['path']) && is_array($data['path'])) {
51+
if (isset($data['path']) && \is_array($data['path'])) {
5252
$data['localized_paths'] = $data['path'];
5353
unset($data['path']);
5454
}
5555

5656
foreach ($data as $key => $value) {
5757
$method = 'set'.str_replace('_', '', $key);
5858
if (!method_exists($this, $method)) {
59-
throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, get_class($this)));
59+
throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, \get_class($this)));
6060
}
6161
$this->$method($value);
6262
}
@@ -134,7 +134,7 @@ public function getDefaults()
134134

135135
public function setSchemes($schemes)
136136
{
137-
$this->schemes = is_array($schemes) ? $schemes : array($schemes);
137+
$this->schemes = \is_array($schemes) ? $schemes : array($schemes);
138138
}
139139

140140
public function getSchemes()
@@ -144,7 +144,7 @@ public function getSchemes()
144144

145145
public function setMethods($methods)
146146
{
147-
$this->methods = is_array($methods) ? $methods : array($methods);
147+
$this->methods = \is_array($methods) ? $methods : array($methods);
148148
}
149149

150150
public function getMethods()

Generator/UrlGenerator.php

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

196196
if ($requiredSchemes) {
197-
if (!in_array($scheme, $requiredSchemes, true)) {
197+
if (!\in_array($scheme, $requiredSchemes, true)) {
198198
$referenceType = self::ABSOLUTE_URL;
199199
$scheme = current($requiredSchemes);
200200
}
@@ -317,7 +317,7 @@ public static function getRelativePath($basePath, $targetPath)
317317
}
318318

319319
$targetDirs[] = $targetFile;
320-
$path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs);
320+
$path = str_repeat('../', \count($sourceDirs)).implode('/', $targetDirs);
321321

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

Loader/AnnotationClassLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
145145
$requirements = $annot->getRequirements();
146146

147147
foreach ($requirements as $placeholder => $requirement) {
148-
if (is_int($placeholder)) {
148+
if (\is_int($placeholder)) {
149149
@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);
150150
}
151151
}
@@ -224,7 +224,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
224224
*/
225225
public function supports($resource, $type = null)
226226
{
227-
return is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
227+
return \is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
228228
}
229229

230230
/**
@@ -315,7 +315,7 @@ protected function getGlobals(\ReflectionClass $class)
315315
}
316316

317317
foreach ($globals['requirements'] as $placeholder => $requirement) {
318-
if (is_int($placeholder)) {
318+
if (\is_int($placeholder)) {
319319
@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);
320320
}
321321
}

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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function load($resource, $type = null)
5050
}
5151

5252
$parts = explode('::', $resource);
53-
if (2 != count($parts)) {
53+
if (2 != \count($parts)) {
5454
throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service::method"', $resource));
5555
}
5656

@@ -59,20 +59,20 @@ public function load($resource, $type = null)
5959

6060
$loaderObject = $this->getServiceObject($serviceString);
6161

62-
if (!is_object($loaderObject)) {
63-
throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', get_class($this), gettype($loaderObject)));
62+
if (!\is_object($loaderObject)) {
63+
throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject)));
6464
}
6565

66-
if (!is_callable(array($loaderObject, $method))) {
67-
throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, get_class($loaderObject), $resource));
66+
if (!\is_callable(array($loaderObject, $method))) {
67+
throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, \get_class($loaderObject), $resource));
6868
}
6969

70-
$routeCollection = call_user_func(array($loaderObject, $method), $this);
70+
$routeCollection = \call_user_func(array($loaderObject, $method), $this);
7171

7272
if (!$routeCollection instanceof RouteCollection) {
73-
$type = is_object($routeCollection) ? get_class($routeCollection) : gettype($routeCollection);
73+
$type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection);
7474

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

7878
// 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
/**
@@ -166,11 +166,11 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, $
166166
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must not have both a "prefix" attribute and <prefix> child nodes.', $path));
167167
}
168168

169-
$this->setCurrentDir(dirname($path));
169+
$this->setCurrentDir(\dirname($path));
170170

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

173-
if (!is_array($imported)) {
173+
if (!\is_array($imported)) {
174174
$imported = array($imported);
175175
}
176176

Loader/YamlFileLoader.php

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

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

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

101101
/**
@@ -117,7 +117,7 @@ protected function parseRoute(RouteCollection $collection, $name, array $config,
117117
$condition = isset($config['condition']) ? $config['condition'] : null;
118118

119119
foreach ($requirements as $placeholder => $requirement) {
120-
if (is_int($placeholder)) {
120+
if (\is_int($placeholder)) {
121121
@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
}
@@ -126,7 +126,7 @@ protected function parseRoute(RouteCollection $collection, $name, array $config,
126126
$defaults['_controller'] = $config['controller'];
127127
}
128128

129-
if (is_array($config['path'])) {
129+
if (\is_array($config['path'])) {
130130
$route = new Route('', $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
131131

132132
foreach ($config['path'] as $locale => $path) {
@@ -167,11 +167,11 @@ protected function parseImport(RouteCollection $collection, array $config, $path
167167
$defaults['_controller'] = $config['controller'];
168168
}
169169

170-
$this->setCurrentDir(dirname($path));
170+
$this->setCurrentDir(\dirname($path));
171171

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

174-
if (!is_array($imported)) {
174+
if (!\is_array($imported)) {
175175
$imported = array($imported);
176176
}
177177

@@ -246,7 +246,7 @@ protected function parseImport(RouteCollection $collection, array $config, $path
246246
*/
247247
protected function validate($config, $name, $path)
248248
{
249-
if (!is_array($config)) {
249+
if (!\is_array($config)) {
250250
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
251251
}
252252
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {

0 commit comments

Comments
 (0)