Skip to content

Commit 19fd2d3

Browse files
committed
Enable the fixer enforcing fully-qualified calls for compiler-optimized functions
1 parent 0850b48 commit 19fd2d3

37 files changed

+106
-106
lines changed

AcceptHeaderItem.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static function fromString($itemValue)
5757
$attributes[$bit] = null;
5858
} else {
5959
$parts = explode('=', $bit);
60-
$attributes[$parts[0]] = isset($parts[1]) && strlen($parts[1]) > 0 ? $parts[1] : '';
60+
$attributes[$parts[0]] = isset($parts[1]) && \strlen($parts[1]) > 0 ? $parts[1] : '';
6161
}
6262
}
6363

@@ -72,7 +72,7 @@ public static function fromString($itemValue)
7272
public function __toString()
7373
{
7474
$string = $this->value.($this->quality < 1 ? ';q='.$this->quality : '');
75-
if (count($this->attributes) > 0) {
75+
if (\count($this->attributes) > 0) {
7676
$string .= ';'.implode(';', array_map(function ($name, $value) {
7777
return sprintf(preg_match('/[,;=]/', $value) ? '%s="%s"' : '%s=%s', $name, $value);
7878
}, array_keys($this->attributes), $this->attributes));

ApacheRequest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function prepareBaseUrl()
3535

3636
if (false === strpos($this->server->get('REQUEST_URI'), $baseUrl)) {
3737
// assume mod_rewrite
38-
return rtrim(dirname($baseUrl), '/\\');
38+
return rtrim(\dirname($baseUrl), '/\\');
3939
}
4040

4141
return $baseUrl;

BinaryFileResponse.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function setContentDisposition($disposition, $filename = '', $filenameFal
165165
for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) {
166166
$char = mb_substr($filename, $i, 1, $encoding);
167167

168-
if ('%' === $char || ord($char) < 32 || ord($char) > 126) {
168+
if ('%' === $char || \ord($char) < 32 || \ord($char) > 126) {
169169
$filenameFallback .= '_';
170170
} else {
171171
$filenameFallback .= $char;
@@ -218,12 +218,12 @@ public function prepare(Request $request)
218218
foreach (explode(',', $request->headers->get('X-Accel-Mapping', '')) as $mapping) {
219219
$mapping = explode('=', $mapping, 2);
220220

221-
if (2 === count($mapping)) {
221+
if (2 === \count($mapping)) {
222222
$pathPrefix = trim($mapping[0]);
223223
$location = trim($mapping[1]);
224224

225-
if (substr($path, 0, strlen($pathPrefix)) === $pathPrefix) {
226-
$path = $location.substr($path, strlen($pathPrefix));
225+
if (substr($path, 0, \strlen($pathPrefix)) === $pathPrefix) {
226+
$path = $location.substr($path, \strlen($pathPrefix));
227227
break;
228228
}
229229
}

File/Exception/UnexpectedTypeException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ class UnexpectedTypeException extends FileException
1515
{
1616
public function __construct($value, $expectedType)
1717
{
18-
parent::__construct(sprintf('Expected argument of type %s, %s given', $expectedType, is_object($value) ? get_class($value) : gettype($value)));
18+
parent::__construct(sprintf('Expected argument of type %s, %s given', $expectedType, \is_object($value) ? \get_class($value) : \gettype($value)));
1919
}
2020
}

File/MimeType/FileBinaryMimeTypeGuesser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static function isSupported()
4949
return $supported;
5050
}
5151

52-
if ('\\' === DIRECTORY_SEPARATOR || !function_exists('passthru') || !function_exists('escapeshellarg')) {
52+
if ('\\' === DIRECTORY_SEPARATOR || !\function_exists('passthru') || !\function_exists('escapeshellarg')) {
5353
return $supported = false;
5454
}
5555

File/MimeType/FileinfoMimeTypeGuesser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct($magicFile = null)
4040
*/
4141
public static function isSupported()
4242
{
43-
return function_exists('finfo_open');
43+
return \function_exists('finfo_open');
4444
}
4545

4646
/**

File/UploadedFile.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ public static function getMaxFilesize()
222222

223223
$max = ltrim($iniMax, '+');
224224
if (0 === strpos($max, '0x')) {
225-
$max = intval($max, 16);
225+
$max = \intval($max, 16);
226226
} elseif (0 === strpos($max, '0')) {
227-
$max = intval($max, 8);
227+
$max = \intval($max, 8);
228228
} else {
229229
$max = (int) $max;
230230
}

FileBag.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function replace(array $files = array())
4545
*/
4646
public function set($key, $value)
4747
{
48-
if (!is_array($value) && !$value instanceof UploadedFile) {
48+
if (!\is_array($value) && !$value instanceof UploadedFile) {
4949
throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.');
5050
}
5151

@@ -76,7 +76,7 @@ protected function convertFileInformation($file)
7676
}
7777

7878
$file = $this->fixPhpFilesArray($file);
79-
if (is_array($file)) {
79+
if (\is_array($file)) {
8080
$keys = array_keys($file);
8181
sort($keys);
8282

@@ -113,14 +113,14 @@ protected function convertFileInformation($file)
113113
*/
114114
protected function fixPhpFilesArray($data)
115115
{
116-
if (!is_array($data)) {
116+
if (!\is_array($data)) {
117117
return $data;
118118
}
119119

120120
$keys = array_keys($data);
121121
sort($keys);
122122

123-
if (self::$fileKeys != $keys || !isset($data['name']) || !is_array($data['name'])) {
123+
if (self::$fileKeys != $keys || !isset($data['name']) || !\is_array($data['name'])) {
124124
return $data;
125125
}
126126

HeaderBag.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function get($key, $default = null, $first = true)
120120
}
121121

122122
if ($first) {
123-
return count($this->headers[$key]) ? $this->headers[$key][0] : $default;
123+
return \count($this->headers[$key]) ? $this->headers[$key][0] : $default;
124124
}
125125

126126
return $this->headers[$key];
@@ -172,7 +172,7 @@ public function has($key)
172172
*/
173173
public function contains($key, $value)
174174
{
175-
return in_array($value, $this->get($key, null, false));
175+
return \in_array($value, $this->get($key, null, false));
176176
}
177177

178178
/**
@@ -280,7 +280,7 @@ public function getIterator()
280280
*/
281281
public function count()
282282
{
283-
return count($this->headers);
283+
return \count($this->headers);
284284
}
285285

286286
protected function getCacheControlHeader()

IpUtils.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private function __construct()
3737
*/
3838
public static function checkIp($requestIp, $ips)
3939
{
40-
if (!is_array($ips)) {
40+
if (!\is_array($ips)) {
4141
$ips = array($ips);
4242
}
4343

@@ -116,7 +116,7 @@ public static function checkIp6($requestIp, $ip)
116116
return self::$checkedIps[$cacheKey];
117117
}
118118

119-
if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) {
119+
if (!((\extension_loaded('sockets') && \defined('AF_INET6')) || @inet_pton('::1'))) {
120120
throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".');
121121
}
122122

JsonResponse.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function setCallback($callback = null)
9090
);
9191
$parts = explode('.', $callback);
9292
foreach ($parts as $part) {
93-
if (!preg_match($pattern, $part) || in_array($part, $reserved, true)) {
93+
if (!preg_match($pattern, $part) || \in_array($part, $reserved, true)) {
9494
throw new \InvalidArgumentException('The callback name is not valid.');
9595
}
9696
}
@@ -112,7 +112,7 @@ public function setCallback($callback = null)
112112
*/
113113
public function setData($data = array())
114114
{
115-
if (defined('HHVM_VERSION')) {
115+
if (\defined('HHVM_VERSION')) {
116116
// HHVM does not trigger any warnings and let exceptions
117117
// thrown from a JsonSerializable object pass through.
118118
// If only PHP did the same...
@@ -136,7 +136,7 @@ public function setData($data = array())
136136
restore_error_handler();
137137
set_error_handler(function () use ($errorHandler) {
138138
if (JSON_ERROR_NONE === json_last_error()) {
139-
return $errorHandler && false !== call_user_func_array($errorHandler, func_get_args());
139+
return $errorHandler && false !== \call_user_func_array($errorHandler, \func_get_args());
140140
}
141141
});
142142
$data = json_encode($data, $this->encodingOptions);
@@ -153,7 +153,7 @@ public function setData($data = array())
153153
if (\PHP_VERSION_ID < 50500 || !interface_exists('JsonSerializable', false)) {
154154
restore_error_handler();
155155
}
156-
if (interface_exists('JsonSerializable', false) && 'Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
156+
if (interface_exists('JsonSerializable', false) && 'Exception' === \get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
157157
throw $e->getPrevious() ?: $e;
158158
}
159159
throw $e;

ParameterBag.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function get($key, $default = null, $deep = false)
101101

102102
$value = $this->parameters[$root];
103103
$currentKey = null;
104-
for ($i = $pos, $c = strlen($key); $i < $c; ++$i) {
104+
for ($i = $pos, $c = \strlen($key); $i < $c; ++$i) {
105105
$char = $key[$i];
106106

107107
if ('[' === $char) {
@@ -115,7 +115,7 @@ public function get($key, $default = null, $deep = false)
115115
throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i));
116116
}
117117

118-
if (!is_array($value) || !array_key_exists($currentKey, $value)) {
118+
if (!\is_array($value) || !array_key_exists($currentKey, $value)) {
119119
return $default;
120120
}
121121

@@ -263,7 +263,7 @@ public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options
263263
$filters[filter_id($tmp)] = 1;
264264
}
265265
}
266-
if (is_bool($filter) || !isset($filters[$filter]) || is_array($deep)) {
266+
if (\is_bool($filter) || !isset($filters[$filter]) || \is_array($deep)) {
267267
@trigger_error('Passing the $deep boolean as 3rd argument to the '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0. Remove it altogether as the $deep argument will be removed in 3.0.', E_USER_DEPRECATED);
268268
$tmp = $deep;
269269
$deep = $filter;
@@ -274,12 +274,12 @@ public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options
274274
$value = $this->get($key, $default, $deep);
275275

276276
// Always turn $options into an array - this allows filter_var option shortcuts.
277-
if (!is_array($options) && $options) {
277+
if (!\is_array($options) && $options) {
278278
$options = array('flags' => $options);
279279
}
280280

281281
// Add a convenience check for arrays.
282-
if (is_array($value) && !isset($options['flags'])) {
282+
if (\is_array($value) && !isset($options['flags'])) {
283283
$options['flags'] = FILTER_REQUIRE_ARRAY;
284284
}
285285

@@ -303,6 +303,6 @@ public function getIterator()
303303
*/
304304
public function count()
305305
{
306-
return count($this->parameters);
306+
return \count($this->parameters);
307307
}
308308
}

0 commit comments

Comments
 (0)