Skip to content

Commit da2473c

Browse files
committed
Enable the fixer enforcing fully-qualified calls for compiler-optimized functions
1 parent 39064ba commit da2473c

22 files changed

+72
-72
lines changed

Annotation/Route.php

Lines changed: 5 additions & 5 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
}
@@ -105,15 +105,15 @@ public function getName()
105105
public function setRequirements($requirements)
106106
{
107107
if (isset($requirements['_method'])) {
108-
if (0 === count($this->methods)) {
108+
if (0 === \count($this->methods)) {
109109
$this->methods = explode('|', $requirements['_method']);
110110
}
111111

112112
@trigger_error('The "_method" requirement is deprecated since Symfony 2.2 and will be removed in 3.0. Use the "methods" option instead.', E_USER_DEPRECATED);
113113
}
114114

115115
if (isset($requirements['_scheme'])) {
116-
if (0 === count($this->schemes)) {
116+
if (0 === \count($this->schemes)) {
117117
$this->schemes = explode('|', $requirements['_scheme']);
118118
}
119119

@@ -150,7 +150,7 @@ public function getDefaults()
150150

151151
public function setSchemes($schemes)
152152
{
153-
$this->schemes = is_array($schemes) ? $schemes : array($schemes);
153+
$this->schemes = \is_array($schemes) ? $schemes : array($schemes);
154154
}
155155

156156
public function getSchemes()
@@ -160,7 +160,7 @@ public function getSchemes()
160160

161161
public function setMethods($methods)
162162
{
163-
$this->methods = is_array($methods) ? $methods : array($methods);
163+
$this->methods = \is_array($methods) ? $methods : array($methods);
164164
}
165165

166166
public function getMethods()

Generator/UrlGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function generate($name, $parameters = array(), $referenceType = self::AB
126126
*/
127127
protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array())
128128
{
129-
if (is_bool($referenceType) || is_string($referenceType)) {
129+
if (\is_bool($referenceType) || \is_string($referenceType)) {
130130
@trigger_error('The hardcoded value you are using for the $referenceType argument of the '.__CLASS__.'::generate method is deprecated since Symfony 2.8 and will not be supported anymore in 3.0. Use the constants defined in the UrlGeneratorInterface instead.', E_USER_DEPRECATED);
131131

132132
if (true === $referenceType) {
@@ -199,7 +199,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
199199
$scheme = $this->context->getScheme();
200200

201201
if ($requiredSchemes) {
202-
if (!in_array($scheme, $requiredSchemes, true)) {
202+
if (!\in_array($scheme, $requiredSchemes, true)) {
203203
$referenceType = self::ABSOLUTE_URL;
204204
$scheme = current($requiredSchemes);
205205
}
@@ -313,7 +313,7 @@ public static function getRelativePath($basePath, $targetPath)
313313
}
314314

315315
$targetDirs[] = $targetFile;
316-
$path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs);
316+
$path = str_repeat('../', \count($sourceDirs)).implode('/', $targetDirs);
317317

318318
// A reference to the same base directory or an empty subdirectory must be prefixed with "./".
319319
// 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
@@ -162,7 +162,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
162162
*/
163163
public function supports($resource, $type = null)
164164
{
165-
return is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
165+
return \is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
166166
}
167167

168168
/**

Loader/AnnotationDirectoryLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function (\SplFileInfo $current) {
7474
*/
7575
public function supports($resource, $type = null)
7676
{
77-
if (!is_string($resource)) {
77+
if (!\is_string($resource)) {
7878
return false;
7979
}
8080

@@ -105,7 +105,7 @@ public function __construct(\RecursiveIterator $iterator, $callback)
105105

106106
public function accept()
107107
{
108-
return call_user_func($this->callback, $this->current(), $this->key(), $this->iterator);
108+
return \call_user_func($this->callback, $this->current(), $this->key(), $this->iterator);
109109
}
110110

111111
public function hasChildren()

Loader/AnnotationFileLoader.php

Lines changed: 4 additions & 4 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

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

7878
/**
@@ -100,7 +100,7 @@ protected function findClass($file)
100100

101101
if (true === $namespace && T_STRING === $token[0]) {
102102
$namespace = $token[1];
103-
while (isset($tokens[++$i][1]) && in_array($tokens[$i][0], array(T_NS_SEPARATOR, T_STRING))) {
103+
while (isset($tokens[++$i][1]) && \in_array($tokens[$i][0], array(T_NS_SEPARATOR, T_STRING))) {
104104
$namespace .= $tokens[$i][1];
105105
}
106106
$token = $tokens[$i];
@@ -117,7 +117,7 @@ protected function findClass($file)
117117
if (T_DOUBLE_COLON === $tokens[$j][0] || T_NEW === $tokens[$j][0]) {
118118
$skipClassToken = true;
119119
break;
120-
} elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) {
120+
} elseif (!\in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) {
121121
break;
122122
}
123123
}

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
@@ -35,7 +35,7 @@ class PhpFileLoader extends FileLoader
3535
public function load($file, $type = null)
3636
{
3737
$path = $this->locator->locate($file);
38-
$this->setCurrentDir(dirname($path));
38+
$this->setCurrentDir(\dirname($path));
3939

4040
$collection = self::includeFile($path, $this);
4141
$collection->addResource(new FileResource($path));
@@ -48,7 +48,7 @@ public function load($file, $type = null)
4848
*/
4949
public function supports($resource, $type = null)
5050
{
51-
return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type);
51+
return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type);
5252
}
5353

5454
/**

Loader/XmlFileLoader.php

Lines changed: 4 additions & 4 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
/**
@@ -128,7 +128,7 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, $p
128128
list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path);
129129

130130
if (isset($requirements['_method'])) {
131-
if (0 === count($methods)) {
131+
if (0 === \count($methods)) {
132132
$methods = explode('|', $requirements['_method']);
133133
}
134134

@@ -137,7 +137,7 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, $p
137137
}
138138

139139
if (isset($requirements['_scheme'])) {
140-
if (0 === count($schemes)) {
140+
if (0 === \count($schemes)) {
141141
$schemes = explode('|', $requirements['_scheme']);
142142
}
143143

@@ -173,7 +173,7 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, $
173173

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

176-
$this->setCurrentDir(dirname($path));
176+
$this->setCurrentDir(\dirname($path));
177177

178178
$subCollection = $this->import($resource, ('' !== $type ? $type : null), false, $file);
179179
/* @var $subCollection RouteCollection */

Loader/YamlFileLoader.php

Lines changed: 6 additions & 6 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

@@ -105,7 +105,7 @@ public function load($file, $type = null)
105105
*/
106106
public function supports($resource, $type = null)
107107
{
108-
return is_string($resource) && in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type);
108+
return \is_string($resource) && \in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type);
109109
}
110110

111111
/**
@@ -127,7 +127,7 @@ protected function parseRoute(RouteCollection $collection, $name, array $config,
127127
$condition = isset($config['condition']) ? $config['condition'] : null;
128128

129129
if (isset($requirements['_method'])) {
130-
if (0 === count($methods)) {
130+
if (0 === \count($methods)) {
131131
$methods = explode('|', $requirements['_method']);
132132
}
133133

@@ -136,7 +136,7 @@ protected function parseRoute(RouteCollection $collection, $name, array $config,
136136
}
137137

138138
if (isset($requirements['_scheme'])) {
139-
if (0 === count($schemes)) {
139+
if (0 === \count($schemes)) {
140140
$schemes = explode('|', $requirements['_scheme']);
141141
}
142142

@@ -169,7 +169,7 @@ protected function parseImport(RouteCollection $collection, array $config, $path
169169
$schemes = isset($config['schemes']) ? $config['schemes'] : null;
170170
$methods = isset($config['methods']) ? $config['methods'] : null;
171171

172-
$this->setCurrentDir(dirname($path));
172+
$this->setCurrentDir(\dirname($path));
173173

174174
$subCollection = $this->import($config['resource'], $type, false, $file);
175175
/* @var $subCollection RouteCollection */
@@ -205,7 +205,7 @@ protected function parseImport(RouteCollection $collection, array $config, $path
205205
*/
206206
protected function validate($config, $name, $path)
207207
{
208-
if (!is_array($config)) {
208+
if (!\is_array($config)) {
209209
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
210210
}
211211
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {

Matcher/ApacheUrlMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function match($pathinfo)
9191
$parameters['_route'] = $route;
9292

9393
return $this->mergeDefaults($parameters, $defaults);
94-
} elseif (0 < count($allow)) {
94+
} elseif (0 < \count($allow)) {
9595
throw new MethodNotAllowedException($allow);
9696
} else {
9797
return parent::match($pathinfo);

0 commit comments

Comments
 (0)