Skip to content

Commit f9c45b1

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents e3e5a62 + d01f322 commit f9c45b1

30 files changed

+113
-113
lines changed

ApacheRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\HttpFoundation;
1313

14-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ApacheRequest::class, Request::class), E_USER_DEPRECATED);
14+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ApacheRequest::class, Request::class), \E_USER_DEPRECATED);
1515

1616
/**
1717
* Request represents an HTTP request from an Apache server.

Cookie.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static function create(string $name, string $value = null, $expire = 0, ?
9494
public function __construct(string $name, string $value = null, $expire = 0, ?string $path = '/', string $domain = null, ?bool $secure = false, bool $httpOnly = true, bool $raw = false, string $sameSite = null)
9595
{
9696
if (9 > \func_num_args()) {
97-
@trigger_error(sprintf('The default value of the "$secure" and "$samesite" arguments of "%s"\'s constructor will respectively change from "false" to "null" and from "null" to "lax" in Symfony 5.0, you should define their values explicitly or use "Cookie::create()" instead.', __METHOD__), E_USER_DEPRECATED);
97+
@trigger_error(sprintf('The default value of the "$secure" and "$samesite" arguments of "%s"\'s constructor will respectively change from "false" to "null" and from "null" to "lax" in Symfony 5.0, you should define their values explicitly or use "Cookie::create()" instead.', __METHOD__), \E_USER_DEPRECATED);
9898
}
9999

100100
// from PHP source code

File/MimeType/ExtensionGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\Mime\MimeTypes;
1515

16-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', ExtensionGuesser::class, MimeTypes::class), E_USER_DEPRECATED);
16+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', ExtensionGuesser::class, MimeTypes::class), \E_USER_DEPRECATED);
1717

1818
/**
1919
* A singleton mime type to file extension guesser.

File/MimeType/FileBinaryMimeTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
1616
use Symfony\Component\Mime\FileBinaryMimeTypeGuesser as NewFileBinaryMimeTypeGuesser;
1717

18-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', FileBinaryMimeTypeGuesser::class, NewFileBinaryMimeTypeGuesser::class), E_USER_DEPRECATED);
18+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', FileBinaryMimeTypeGuesser::class, NewFileBinaryMimeTypeGuesser::class), \E_USER_DEPRECATED);
1919

2020
/**
2121
* Guesses the mime type with the binary "file" (only available on *nix).

File/MimeType/FileinfoMimeTypeGuesser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
1616
use Symfony\Component\Mime\FileinfoMimeTypeGuesser as NewFileinfoMimeTypeGuesser;
1717

18-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', FileinfoMimeTypeGuesser::class, NewFileinfoMimeTypeGuesser::class), E_USER_DEPRECATED);
18+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', FileinfoMimeTypeGuesser::class, NewFileinfoMimeTypeGuesser::class), \E_USER_DEPRECATED);
1919

2020
/**
2121
* Guesses the mime type using the PECL extension FileInfo.
@@ -65,7 +65,7 @@ public function guess($path)
6565
return null;
6666
}
6767

68-
if (!$finfo = new \finfo(FILEINFO_MIME_TYPE, $this->magicFile)) {
68+
if (!$finfo = new \finfo(\FILEINFO_MIME_TYPE, $this->magicFile)) {
6969
return null;
7070
}
7171
$mimeType = $finfo->file($path);

File/MimeType/MimeTypeExtensionGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\Mime\MimeTypes;
1515

16-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', MimeTypeExtensionGuesser::class, MimeTypes::class), E_USER_DEPRECATED);
16+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', MimeTypeExtensionGuesser::class, MimeTypes::class), \E_USER_DEPRECATED);
1717

1818
/**
1919
* Provides a best-guess mapping of mime type to file extension.

File/MimeType/MimeTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
1616
use Symfony\Component\Mime\MimeTypes;
1717

18-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', MimeTypeGuesser::class, MimeTypes::class), E_USER_DEPRECATED);
18+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', MimeTypeGuesser::class, MimeTypes::class), \E_USER_DEPRECATED);
1919

2020
/**
2121
* A singleton mime type guesser.

File/UploadedFile.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ public function __construct(string $path, string $originalName, string $mimeType
6666
$this->mimeType = $mimeType ?: 'application/octet-stream';
6767

6868
if (4 < \func_num_args() ? !\is_bool($test) : null !== $error && @filesize($path) === $error) {
69-
@trigger_error(sprintf('Passing a size as 4th argument to the constructor of "%s" is deprecated since Symfony 4.1.', __CLASS__), E_USER_DEPRECATED);
69+
@trigger_error(sprintf('Passing a size as 4th argument to the constructor of "%s" is deprecated since Symfony 4.1.', __CLASS__), \E_USER_DEPRECATED);
7070
$error = $test;
7171
$test = 5 < \func_num_args() ? func_get_arg(5) : false;
7272
}
7373

74-
$this->error = $error ?: UPLOAD_ERR_OK;
74+
$this->error = $error ?: \UPLOAD_ERR_OK;
7575
$this->test = $test;
7676

77-
parent::__construct($path, UPLOAD_ERR_OK === $this->error);
77+
parent::__construct($path, \UPLOAD_ERR_OK === $this->error);
7878
}
7979

8080
/**
@@ -100,7 +100,7 @@ public function getClientOriginalName()
100100
*/
101101
public function getClientOriginalExtension()
102102
{
103-
return pathinfo($this->originalName, PATHINFO_EXTENSION);
103+
return pathinfo($this->originalName, \PATHINFO_EXTENSION);
104104
}
105105

106106
/**
@@ -155,7 +155,7 @@ public function guessClientExtension()
155155
*/
156156
public function getClientSize()
157157
{
158-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use getSize() instead.', __METHOD__), E_USER_DEPRECATED);
158+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use getSize() instead.', __METHOD__), \E_USER_DEPRECATED);
159159

160160
return $this->getSize();
161161
}
@@ -180,7 +180,7 @@ public function getError()
180180
*/
181181
public function isValid()
182182
{
183-
$isOk = UPLOAD_ERR_OK === $this->error;
183+
$isOk = \UPLOAD_ERR_OK === $this->error;
184184

185185
return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname());
186186
}
@@ -217,19 +217,19 @@ public function move($directory, $name = null)
217217
}
218218

219219
switch ($this->error) {
220-
case UPLOAD_ERR_INI_SIZE:
220+
case \UPLOAD_ERR_INI_SIZE:
221221
throw new IniSizeFileException($this->getErrorMessage());
222-
case UPLOAD_ERR_FORM_SIZE:
222+
case \UPLOAD_ERR_FORM_SIZE:
223223
throw new FormSizeFileException($this->getErrorMessage());
224-
case UPLOAD_ERR_PARTIAL:
224+
case \UPLOAD_ERR_PARTIAL:
225225
throw new PartialFileException($this->getErrorMessage());
226-
case UPLOAD_ERR_NO_FILE:
226+
case \UPLOAD_ERR_NO_FILE:
227227
throw new NoFileException($this->getErrorMessage());
228-
case UPLOAD_ERR_CANT_WRITE:
228+
case \UPLOAD_ERR_CANT_WRITE:
229229
throw new CannotWriteFileException($this->getErrorMessage());
230-
case UPLOAD_ERR_NO_TMP_DIR:
230+
case \UPLOAD_ERR_NO_TMP_DIR:
231231
throw new NoTmpDirFileException($this->getErrorMessage());
232-
case UPLOAD_ERR_EXTENSION:
232+
case \UPLOAD_ERR_EXTENSION:
233233
throw new ExtensionFileException($this->getErrorMessage());
234234
}
235235

@@ -246,7 +246,7 @@ public static function getMaxFilesize()
246246
$sizePostMax = self::parseFilesize(ini_get('post_max_size'));
247247
$sizeUploadMax = self::parseFilesize(ini_get('upload_max_filesize'));
248248

249-
return min($sizePostMax ?: PHP_INT_MAX, $sizeUploadMax ?: PHP_INT_MAX);
249+
return min($sizePostMax ?: \PHP_INT_MAX, $sizeUploadMax ?: \PHP_INT_MAX);
250250
}
251251

252252
/**
@@ -290,17 +290,17 @@ private static function parseFilesize($size): int
290290
public function getErrorMessage()
291291
{
292292
static $errors = [
293-
UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
294-
UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
295-
UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
296-
UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
297-
UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
298-
UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
299-
UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
293+
\UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
294+
\UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
295+
\UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
296+
\UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
297+
\UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
298+
\UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
299+
\UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
300300
];
301301

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

306306
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function get($key, $default = null)
112112
{
113113
$headers = $this->all((string) $key);
114114
if (2 < \func_num_args()) {
115-
@trigger_error(sprintf('Passing a third argument to "%s()" is deprecated since Symfony 4.4, use method "all()" instead', __METHOD__), E_USER_DEPRECATED);
115+
@trigger_error(sprintf('Passing a third argument to "%s()" is deprecated since Symfony 4.4, use method "all()" instead', __METHOD__), \E_USER_DEPRECATED);
116116

117117
if (!func_get_arg(2)) {
118118
return $headers;
@@ -218,7 +218,7 @@ public function getDate($key, \DateTime $default = null)
218218
return $default;
219219
}
220220

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

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
}

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
@@ -159,11 +159,11 @@ public function setData($data = [])
159159
throw $e;
160160
}
161161

162-
if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $this->encodingOptions)) {
162+
if (\PHP_VERSION_ID >= 70300 && (\JSON_THROW_ON_ERROR & $this->encodingOptions)) {
163163
return $this->setJson($data);
164164
}
165165

166-
if (JSON_ERROR_NONE !== json_last_error()) {
166+
if (\JSON_ERROR_NONE !== json_last_error()) {
167167
throw new \InvalidArgumentException(json_last_error_msg());
168168
}
169169

ParameterBag.php

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

153153
/**
@@ -173,7 +173,7 @@ public function getInt($key, $default = 0)
173173
*/
174174
public function getBoolean($key, $default = false)
175175
{
176-
return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN);
176+
return $this->filter($key, $default, \FILTER_VALIDATE_BOOLEAN);
177177
}
178178

179179
/**
@@ -188,7 +188,7 @@ public function getBoolean($key, $default = false)
188188
*
189189
* @return mixed
190190
*/
191-
public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = [])
191+
public function filter($key, $default = null, $filter = \FILTER_DEFAULT, $options = [])
192192
{
193193
$value = $this->get($key, $default);
194194

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

200200
// Add a convenience check for arrays.
201201
if (\is_array($value) && !isset($options['flags'])) {
202-
$options['flags'] = FILTER_REQUIRE_ARRAY;
202+
$options['flags'] = \FILTER_REQUIRE_ARRAY;
203203
}
204204

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

RedirectResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class RedirectResponse extends Response
3535
public function __construct(?string $url, int $status = 302, array $headers = [])
3636
{
3737
if (null === $url) {
38-
@trigger_error(sprintf('Passing a null url when instantiating a "%s" is deprecated since Symfony 4.4.', __CLASS__), E_USER_DEPRECATED);
38+
@trigger_error(sprintf('Passing a null url when instantiating a "%s" is deprecated since Symfony 4.4.', __CLASS__), \E_USER_DEPRECATED);
3939
$url = '';
4040
}
4141

@@ -47,7 +47,7 @@ public function __construct(?string $url, int $status = 302, array $headers = []
4747
throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status));
4848
}
4949

50-
if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, CASE_LOWER))) {
50+
if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, \CASE_LOWER))) {
5151
$this->headers->remove('cache-control');
5252
}
5353
}
@@ -105,7 +105,7 @@ public function setTargetUrl($url)
105105
<body>
106106
Redirecting to <a href="%1$s">%1$s</a>.
107107
</body>
108-
</html>', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')));
108+
</html>', htmlspecialchars($url, \ENT_QUOTES, 'UTF-8')));
109109

110110
$this->headers->set('Location', $url);
111111

Request.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ public function __toString()
511511
throw $e;
512512
}
513513

514-
return trigger_error($e, E_USER_ERROR);
514+
return trigger_error($e, \E_USER_ERROR);
515515
}
516516

517517
$cookieHeader = '';
@@ -659,7 +659,7 @@ public static function normalizeQueryString($qs)
659659
parse_str($qs, $qs);
660660
ksort($qs);
661661

662-
return http_build_query($qs, '', '&', PHP_QUERY_RFC3986);
662+
return http_build_query($qs, '', '&', \PHP_QUERY_RFC3986);
663663
}
664664

665665
/**
@@ -732,7 +732,7 @@ public function getSession()
732732
}
733733

734734
if (null === $session) {
735-
@trigger_error(sprintf('Calling "%s()" when no session has been set is deprecated since Symfony 4.1 and will throw an exception in 5.0. Use "hasSession()" instead.', __METHOD__), E_USER_DEPRECATED);
735+
@trigger_error(sprintf('Calling "%s()" when no session has been set is deprecated since Symfony 4.1 and will throw an exception in 5.0. Use "hasSession()" instead.', __METHOD__), \E_USER_DEPRECATED);
736736
// throw new \BadMethodCallException('Session has not been set.');
737737
}
738738

@@ -1469,7 +1469,7 @@ public function isMethod($method)
14691469
public function isMethodSafe()
14701470
{
14711471
if (\func_num_args() > 0) {
1472-
@trigger_error(sprintf('Passing arguments to "%s()" has been deprecated since Symfony 4.4; use "%s::isMethodCacheable()" to check if the method is cacheable instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
1472+
@trigger_error(sprintf('Passing arguments to "%s()" has been deprecated since Symfony 4.4; use "%s::isMethodCacheable()" to check if the method is cacheable instead.', __METHOD__, __CLASS__), \E_USER_DEPRECATED);
14731473
}
14741474

14751475
return \in_array($this->getMethod(), ['GET', 'HEAD', 'OPTIONS', 'TRACE']);
@@ -1575,7 +1575,7 @@ public function getContent($asResource = false)
15751575
*/
15761576
public function getETags()
15771577
{
1578-
return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY);
1578+
return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, \PREG_SPLIT_NO_EMPTY);
15791579
}
15801580

15811581
/**
@@ -2074,7 +2074,7 @@ private function normalizeAndFilterClientIps(array $clientIps, string $ip): arra
20742074
$clientIps[$key] = $clientIp = substr($clientIp, 1, $i - 1);
20752075
}
20762076

2077-
if (!filter_var($clientIp, FILTER_VALIDATE_IP)) {
2077+
if (!filter_var($clientIp, \FILTER_VALIDATE_IP)) {
20782078
unset($clientIps[$key]);
20792079

20802080
continue;

Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ public static function closeOutputBuffers(int $targetLevel, bool $flush): void
12171217
{
12181218
$status = ob_get_status(true);
12191219
$level = \count($status);
1220-
$flags = PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE);
1220+
$flags = \PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? \PHP_OUTPUT_HANDLER_FLUSHABLE : \PHP_OUTPUT_HANDLER_CLEANABLE);
12211221

12221222
while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || ($s['flags'] & $flags) === $flags : $s['del'])) {
12231223
if ($flush) {

0 commit comments

Comments
 (0)