Skip to content

Commit d01f322

Browse files
Enable "native_constant_invocation" CS rule
1 parent e5a4288 commit d01f322

29 files changed

+95
-95
lines changed

AcceptHeader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static function fromString($headerValue)
5757
$item->setIndex($index++);
5858

5959
return $item;
60-
}, preg_split('/\s*(?:,*("[^"]+"),*|,*(\'[^\']+\'),*|,+)\s*/', $headerValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE)));
60+
}, preg_split('/\s*(?:,*("[^"]+"),*|,*(\'[^\']+\'),*|,+)\s*/', $headerValue, 0, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE)));
6161
}
6262

6363
/**

AcceptHeaderItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct($value, array $attributes = [])
4343
*/
4444
public static function fromString($itemValue)
4545
{
46-
$bits = preg_split('/\s*(?:;*("[^"]+");*|;*(\'[^\']+\');*|;+)\s*/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
46+
$bits = preg_split('/\s*(?:;*("[^"]+");*|;*(\'[^\']+\');*|;+)\s*/', $itemValue, 0, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE);
4747
$value = array_shift($bits);
4848
$attributes = [];
4949

File/MimeType/FileinfoMimeTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function guess($path)
6060
return null;
6161
}
6262

63-
if (!$finfo = new \finfo(FILEINFO_MIME_TYPE, $this->magicFile)) {
63+
if (!$finfo = new \finfo(\FILEINFO_MIME_TYPE, $this->magicFile)) {
6464
return null;
6565
}
6666
$mimeType = $finfo->file($path);

File/UploadedFile.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ public function __construct($path, $originalName, $mimeType = null, $size = null
6060
$this->originalName = $this->getName($originalName);
6161
$this->mimeType = $mimeType ?: 'application/octet-stream';
6262
$this->size = $size;
63-
$this->error = $error ?: UPLOAD_ERR_OK;
63+
$this->error = $error ?: \UPLOAD_ERR_OK;
6464
$this->test = (bool) $test;
6565

66-
parent::__construct($path, UPLOAD_ERR_OK === $this->error);
66+
parent::__construct($path, \UPLOAD_ERR_OK === $this->error);
6767
}
6868

6969
/**
@@ -89,7 +89,7 @@ public function getClientOriginalName()
8989
*/
9090
public function getClientOriginalExtension()
9191
{
92-
return pathinfo($this->originalName, PATHINFO_EXTENSION);
92+
return pathinfo($this->originalName, \PATHINFO_EXTENSION);
9393
}
9494

9595
/**
@@ -168,7 +168,7 @@ public function getError()
168168
*/
169169
public function isValid()
170170
{
171-
$isOk = UPLOAD_ERR_OK === $this->error;
171+
$isOk = \UPLOAD_ERR_OK === $this->error;
172172

173173
return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname());
174174
}
@@ -217,7 +217,7 @@ public static function getMaxFilesize()
217217
$sizePostMax = self::parseFilesize(ini_get('post_max_size'));
218218
$sizeUploadMax = self::parseFilesize(ini_get('upload_max_filesize'));
219219

220-
return min($sizePostMax ?: PHP_INT_MAX, $sizeUploadMax ?: PHP_INT_MAX);
220+
return min($sizePostMax ?: \PHP_INT_MAX, $sizeUploadMax ?: \PHP_INT_MAX);
221221
}
222222

223223
/**
@@ -263,17 +263,17 @@ private static function parseFilesize($size)
263263
public function getErrorMessage()
264264
{
265265
static $errors = [
266-
UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
267-
UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
268-
UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
269-
UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
270-
UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
271-
UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
272-
UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
266+
\UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
267+
\UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
268+
\UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
269+
\UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
270+
\UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
271+
\UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
272+
\UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
273273
];
274274

275275
$errorCode = $this->error;
276-
$maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
276+
$maxFilesize = \UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
277277
$message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.';
278278

279279
return sprintf($message, $this->getClientOriginalName(), $maxFilesize);

FileBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected function convertFileInformation($file)
8181
sort($keys);
8282

8383
if ($keys == self::$fileKeys) {
84-
if (UPLOAD_ERR_NO_FILE == $file['error']) {
84+
if (\UPLOAD_ERR_NO_FILE == $file['error']) {
8585
$file = null;
8686
} else {
8787
$file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']);

HeaderBag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function getDate($key, \DateTime $default = null)
224224
return $default;
225225
}
226226

227-
if (false === $date = \DateTime::createFromFormat(DATE_RFC2822, $value)) {
227+
if (false === $date = \DateTime::createFromFormat(\DATE_RFC2822, $value)) {
228228
throw new \RuntimeException(sprintf('The "%s" HTTP header is not parseable (%s).', $key, $value));
229229
}
230230

@@ -329,7 +329,7 @@ protected function getCacheControlHeader()
329329
protected function parseCacheControl($header)
330330
{
331331
$cacheControl = [];
332-
preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER);
332+
preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, \PREG_SET_ORDER);
333333
foreach ($matches as $match) {
334334
$cacheControl[strtolower($match[1])] = isset($match[3]) ? $match[3] : (isset($match[2]) ? $match[2] : true);
335335
}

IpUtils.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ public static function checkIp4($requestIp, $ip)
6868
return self::$checkedIps[$cacheKey];
6969
}
7070

71-
if (!filter_var($requestIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
71+
if (!filter_var($requestIp, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
7272
return self::$checkedIps[$cacheKey] = false;
7373
}
7474

7575
if (false !== strpos($ip, '/')) {
7676
list($address, $netmask) = explode('/', $ip, 2);
7777

7878
if ('0' === $netmask) {
79-
return self::$checkedIps[$cacheKey] = filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
79+
return self::$checkedIps[$cacheKey] = filter_var($address, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4);
8080
}
8181

8282
if ($netmask < 0 || $netmask > 32) {

JsonResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,13 @@ public function setData($data = [])
173173
throw $e;
174174
}
175175

176-
if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $this->encodingOptions)) {
176+
if (\PHP_VERSION_ID >= 70300 && (\JSON_THROW_ON_ERROR & $this->encodingOptions)) {
177177
return $this->setJson($data);
178178
}
179179
}
180180
}
181181

182-
if (JSON_ERROR_NONE !== json_last_error()) {
182+
if (\JSON_ERROR_NONE !== json_last_error()) {
183183
throw new \InvalidArgumentException(json_last_error_msg());
184184
}
185185

ParameterBag.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function getAlnum($key, $default = '')
154154
public function getDigits($key, $default = '')
155155
{
156156
// we need to remove - and + because they're allowed in the filter
157-
return str_replace(['-', '+'], '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT));
157+
return str_replace(['-', '+'], '', $this->filter($key, $default, \FILTER_SANITIZE_NUMBER_INT));
158158
}
159159

160160
/**
@@ -180,7 +180,7 @@ public function getInt($key, $default = 0)
180180
*/
181181
public function getBoolean($key, $default = false)
182182
{
183-
return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN);
183+
return $this->filter($key, $default, \FILTER_VALIDATE_BOOLEAN);
184184
}
185185

186186
/**
@@ -195,7 +195,7 @@ public function getBoolean($key, $default = false)
195195
*
196196
* @return mixed
197197
*/
198-
public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = [])
198+
public function filter($key, $default = null, $filter = \FILTER_DEFAULT, $options = [])
199199
{
200200
$value = $this->get($key, $default);
201201

@@ -206,7 +206,7 @@ public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options
206206

207207
// Add a convenience check for arrays.
208208
if (\is_array($value) && !isset($options['flags'])) {
209-
$options['flags'] = FILTER_REQUIRE_ARRAY;
209+
$options['flags'] = \FILTER_REQUIRE_ARRAY;
210210
}
211211

212212
return filter_var($value, $filter, $options);

RedirectResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct($url, $status = 302, $headers = [])
4242
throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status));
4343
}
4444

45-
if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, CASE_LOWER))) {
45+
if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, \CASE_LOWER))) {
4646
$this->headers->remove('cache-control');
4747
}
4848
}
@@ -100,7 +100,7 @@ public function setTargetUrl($url)
100100
<body>
101101
Redirecting to <a href="%1$s">%1$s</a>.
102102
</body>
103-
</html>', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')));
103+
</html>', htmlspecialchars($url, \ENT_QUOTES, 'UTF-8')));
104104

105105
$this->headers->set('Location', $url);
106106

0 commit comments

Comments
 (0)