Skip to content

Commit 94e6ea3

Browse files
Merge branch '4.4' into 5.1
* 4.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 41a4647 + f9c45b1 commit 94e6ea3

25 files changed

+103
-103
lines changed

File/UploadedFile.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ public function __construct(string $path, string $originalName, string $mimeType
6464
{
6565
$this->originalName = $this->getName($originalName);
6666
$this->mimeType = $mimeType ?: 'application/octet-stream';
67-
$this->error = $error ?: UPLOAD_ERR_OK;
67+
$this->error = $error ?: \UPLOAD_ERR_OK;
6868
$this->test = $test;
6969

70-
parent::__construct($path, UPLOAD_ERR_OK === $this->error);
70+
parent::__construct($path, \UPLOAD_ERR_OK === $this->error);
7171
}
7272

7373
/**
@@ -93,7 +93,7 @@ public function getClientOriginalName()
9393
*/
9494
public function getClientOriginalExtension()
9595
{
96-
return pathinfo($this->originalName, PATHINFO_EXTENSION);
96+
return pathinfo($this->originalName, \PATHINFO_EXTENSION);
9797
}
9898

9999
/**
@@ -160,7 +160,7 @@ public function getError()
160160
*/
161161
public function isValid()
162162
{
163-
$isOk = UPLOAD_ERR_OK === $this->error;
163+
$isOk = \UPLOAD_ERR_OK === $this->error;
164164

165165
return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname());
166166
}
@@ -194,19 +194,19 @@ public function move(string $directory, string $name = null)
194194
}
195195

196196
switch ($this->error) {
197-
case UPLOAD_ERR_INI_SIZE:
197+
case \UPLOAD_ERR_INI_SIZE:
198198
throw new IniSizeFileException($this->getErrorMessage());
199-
case UPLOAD_ERR_FORM_SIZE:
199+
case \UPLOAD_ERR_FORM_SIZE:
200200
throw new FormSizeFileException($this->getErrorMessage());
201-
case UPLOAD_ERR_PARTIAL:
201+
case \UPLOAD_ERR_PARTIAL:
202202
throw new PartialFileException($this->getErrorMessage());
203-
case UPLOAD_ERR_NO_FILE:
203+
case \UPLOAD_ERR_NO_FILE:
204204
throw new NoFileException($this->getErrorMessage());
205-
case UPLOAD_ERR_CANT_WRITE:
205+
case \UPLOAD_ERR_CANT_WRITE:
206206
throw new CannotWriteFileException($this->getErrorMessage());
207-
case UPLOAD_ERR_NO_TMP_DIR:
207+
case \UPLOAD_ERR_NO_TMP_DIR:
208208
throw new NoTmpDirFileException($this->getErrorMessage());
209-
case UPLOAD_ERR_EXTENSION:
209+
case \UPLOAD_ERR_EXTENSION:
210210
throw new ExtensionFileException($this->getErrorMessage());
211211
}
212212

@@ -223,7 +223,7 @@ public static function getMaxFilesize()
223223
$sizePostMax = self::parseFilesize(ini_get('post_max_size'));
224224
$sizeUploadMax = self::parseFilesize(ini_get('upload_max_filesize'));
225225

226-
return min($sizePostMax ?: PHP_INT_MAX, $sizeUploadMax ?: PHP_INT_MAX);
226+
return min($sizePostMax ?: \PHP_INT_MAX, $sizeUploadMax ?: \PHP_INT_MAX);
227227
}
228228

229229
/**
@@ -267,17 +267,17 @@ private static function parseFilesize($size): int
267267
public function getErrorMessage()
268268
{
269269
static $errors = [
270-
UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
271-
UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
272-
UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
273-
UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
274-
UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
275-
UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
276-
UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
270+
\UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
271+
\UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
272+
\UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
273+
\UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
274+
\UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
275+
\UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
276+
\UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
277277
];
278278

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

283283
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['error'], false);

HeaderBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function getDate(string $key, \DateTime $default = null)
198198
return $default;
199199
}
200200

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

HeaderUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function split(string $header, string $separators): array
6262
\s*
6363
(?<separator>['.$quotedSeparators.'])
6464
\s*
65-
/x', trim($header), $matches, PREG_SET_ORDER);
65+
/x', trim($header), $matches, \PREG_SET_ORDER);
6666

6767
return self::groupParts($matches, $separators);
6868
}

InputBag.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function set(string $key, $value)
8686
/**
8787
* {@inheritdoc}
8888
*/
89-
public function filter(string $key, $default = null, int $filter = FILTER_DEFAULT, $options = [])
89+
public function filter(string $key, $default = null, int $filter = \FILTER_DEFAULT, $options = [])
9090
{
9191
$value = $this->has($key) ? $this->all()[$key] : $default;
9292

@@ -95,11 +95,11 @@ public function filter(string $key, $default = null, int $filter = FILTER_DEFAUL
9595
$options = ['flags' => $options];
9696
}
9797

98-
if (\is_array($value) && !(($options['flags'] ?? 0) & (FILTER_REQUIRE_ARRAY | FILTER_FORCE_ARRAY))) {
98+
if (\is_array($value) && !(($options['flags'] ?? 0) & (\FILTER_REQUIRE_ARRAY | \FILTER_FORCE_ARRAY))) {
9999
trigger_deprecation('symfony/http-foundation', '5.1', 'Filtering an array value with "%s()" without passing the FILTER_REQUIRE_ARRAY or FILTER_FORCE_ARRAY flag is deprecated', __METHOD__);
100100

101101
if (!isset($options['flags'])) {
102-
$options['flags'] = FILTER_REQUIRE_ARRAY;
102+
$options['flags'] = \FILTER_REQUIRE_ARRAY;
103103
}
104104
}
105105

IpUtils.php

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

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

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

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

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

JsonResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ public function setData($data = [])
161161
throw $e;
162162
}
163163

164-
if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $this->encodingOptions)) {
164+
if (\PHP_VERSION_ID >= 70300 && (\JSON_THROW_ON_ERROR & $this->encodingOptions)) {
165165
return $this->setJson($data);
166166
}
167167

168-
if (JSON_ERROR_NONE !== json_last_error()) {
168+
if (\JSON_ERROR_NONE !== json_last_error()) {
169169
throw new \InvalidArgumentException(json_last_error_msg());
170170
}
171171

ParameterBag.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function getAlnum(string $key, string $default = '')
146146
public function getDigits(string $key, string $default = '')
147147
{
148148
// we need to remove - and + because they're allowed in the filter
149-
return str_replace(['-', '+'], '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT));
149+
return str_replace(['-', '+'], '', $this->filter($key, $default, \FILTER_SANITIZE_NUMBER_INT));
150150
}
151151

152152
/**
@@ -166,7 +166,7 @@ public function getInt(string $key, int $default = 0)
166166
*/
167167
public function getBoolean(string $key, bool $default = false)
168168
{
169-
return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN);
169+
return $this->filter($key, $default, \FILTER_VALIDATE_BOOLEAN);
170170
}
171171

172172
/**
@@ -180,7 +180,7 @@ public function getBoolean(string $key, bool $default = false)
180180
*
181181
* @return mixed
182182
*/
183-
public function filter(string $key, $default = null, int $filter = FILTER_DEFAULT, $options = [])
183+
public function filter(string $key, $default = null, int $filter = \FILTER_DEFAULT, $options = [])
184184
{
185185
$value = $this->get($key, $default);
186186

@@ -191,7 +191,7 @@ public function filter(string $key, $default = null, int $filter = FILTER_DEFAUL
191191

192192
// Add a convenience check for arrays.
193193
if (\is_array($value) && !isset($options['flags'])) {
194-
$options['flags'] = FILTER_REQUIRE_ARRAY;
194+
$options['flags'] = \FILTER_REQUIRE_ARRAY;
195195
}
196196

197197
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(string $url, int $status = 302, array $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(string $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

Request.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ public function __toString()
517517
throw $e;
518518
}
519519

520-
return trigger_error($e, E_USER_ERROR);
520+
return trigger_error($e, \E_USER_ERROR);
521521
}
522522

523523
$cookieHeader = '';
@@ -663,7 +663,7 @@ public static function normalizeQueryString(?string $qs)
663663
parse_str($qs, $qs);
664664
ksort($qs);
665665

666-
return http_build_query($qs, '', '&', PHP_QUERY_RFC3986);
666+
return http_build_query($qs, '', '&', \PHP_QUERY_RFC3986);
667667
}
668668

669669
/**
@@ -1554,7 +1554,7 @@ public function getContent(bool $asResource = false)
15541554
*/
15551555
public function getETags()
15561556
{
1557-
return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY);
1557+
return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, \PREG_SPLIT_NO_EMPTY);
15581558
}
15591559

15601560
/**
@@ -2076,7 +2076,7 @@ private function normalizeAndFilterClientIps(array $clientIps, string $ip): arra
20762076
$clientIps[$key] = $clientIp = substr($clientIp, 1, $i - 1);
20772077
}
20782078

2079-
if (!filter_var($clientIp, FILTER_VALIDATE_IP)) {
2079+
if (!filter_var($clientIp, \FILTER_VALIDATE_IP)) {
20802080
unset($clientIps[$key]);
20812081

20822082
continue;

0 commit comments

Comments
 (0)