Skip to content

Commit 5b37581

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 8b64594 + 87cdfb2 commit 5b37581

29 files changed

+131
-131
lines changed

CacheWarmer/CacheWarmerAggregate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function warmUp($cacheDir)
5353
if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
5454
$collectedLogs = [];
5555
$previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
56-
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
56+
if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type) {
5757
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
5858
}
5959

@@ -63,7 +63,7 @@ public function warmUp($cacheDir)
6363
return null;
6464
}
6565

66-
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
66+
$backtrace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 3);
6767
// Clean the trace by removing first frames added by the error handler itself.
6868
for ($i = 0; isset($backtrace[$i]); ++$i) {
6969
if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) {

Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ protected function filterFiles(array $files)
166166
'',
167167
$value->getClientOriginalName(),
168168
$value->getClientMimeType(),
169-
UPLOAD_ERR_INI_SIZE,
169+
\UPLOAD_ERR_INI_SIZE,
170170
true
171171
);
172172
} else {

Config/FileLocator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(KernelInterface $kernel/*, string $path = null, arra
4040
}
4141

4242
if (4 !== \func_num_args() || func_get_arg(3)) {
43-
@trigger_error(sprintf('Passing more than one argument to %s is deprecated since Symfony 4.4 and will be removed in 5.0.', __METHOD__), E_USER_DEPRECATED);
43+
@trigger_error(sprintf('Passing more than one argument to %s is deprecated since Symfony 4.4 and will be removed in 5.0.', __METHOD__), \E_USER_DEPRECATED);
4444
}
4545
} else {
4646
$paths = [];
@@ -63,7 +63,7 @@ public function locate($file, $currentPath = null, $first = true)
6363
if (isset($file[0]) && !(
6464
'/' === $file[0] || '\\' === $file[0]
6565
|| (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && ('\\' === $file[2] || '/' === $file[2]))
66-
|| null !== parse_url($file, PHP_URL_SCHEME)
66+
|| null !== parse_url($file, \PHP_URL_SCHEME)
6767
)) {
6868
$deprecation = false;
6969

@@ -81,7 +81,7 @@ public function locate($file, $currentPath = null, $first = true)
8181
}
8282

8383
if ($deprecation) {
84-
@trigger_error($deprecation, E_USER_DEPRECATED);
84+
@trigger_error($deprecation, \E_USER_DEPRECATED);
8585
}
8686
}
8787

DataCollector/ConfigDataCollector.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
3434
public function __construct(string $name = null, string $version = null)
3535
{
3636
if (1 <= \func_num_args()) {
37-
@trigger_error(sprintf('The "$name" argument in method "%s()" is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
37+
@trigger_error(sprintf('The "$name" argument in method "%s()" is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
3838
}
3939
if (2 <= \func_num_args()) {
40-
@trigger_error(sprintf('The "$version" argument in method "%s()" is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
40+
@trigger_error(sprintf('The "$version" argument in method "%s()" is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
4141
}
4242

4343
$this->name = $name;
@@ -67,13 +67,13 @@ public function collect(Request $request, Response $response/*, \Throwable $exce
6767
'symfony_state' => 'unknown',
6868
'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a',
6969
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
70-
'php_version' => PHP_VERSION,
70+
'php_version' => \PHP_VERSION,
7171
'php_architecture' => \PHP_INT_SIZE * 8,
7272
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
7373
'php_timezone' => date_default_timezone_get(),
7474
'xdebug_enabled' => \extension_loaded('xdebug'),
75-
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN),
76-
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN),
75+
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN),
76+
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN),
7777
'bundles' => [],
7878
'sapi_name' => \PHP_SAPI,
7979
];
@@ -116,7 +116,7 @@ public function lateCollect()
116116
*/
117117
public function getApplicationName()
118118
{
119-
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
119+
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
120120

121121
return $this->data['app_name'];
122122
}
@@ -126,7 +126,7 @@ public function getApplicationName()
126126
*/
127127
public function getApplicationVersion()
128128
{
129-
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
129+
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
130130

131131
return $this->data['app_version'];
132132
}
@@ -255,7 +255,7 @@ public function getPhpTimezone()
255255
*/
256256
public function getAppName()
257257
{
258-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
258+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
259259

260260
return 'n/a';
261261
}

DataCollector/DataCollector.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ abstract class DataCollector implements DataCollectorInterface
4343
*/
4444
public function serialize()
4545
{
46-
@trigger_error(sprintf('The "%s" method is deprecated since Symfony 4.3, store all the serialized state in the data property instead.', __METHOD__), E_USER_DEPRECATED);
46+
@trigger_error(sprintf('The "%s" method is deprecated since Symfony 4.3, store all the serialized state in the data property instead.', __METHOD__), \E_USER_DEPRECATED);
4747

48-
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
48+
$trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
4949
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
5050

5151
return $isCalledFromOverridingMethod ? $this->data : serialize($this->data);
@@ -56,7 +56,7 @@ public function serialize()
5656
*/
5757
public function unserialize($data)
5858
{
59-
@trigger_error(sprintf('The "%s" method is deprecated since Symfony 4.3, store all the serialized state in the data property instead.', __METHOD__), E_USER_DEPRECATED);
59+
@trigger_error(sprintf('The "%s" method is deprecated since Symfony 4.3, store all the serialized state in the data property instead.', __METHOD__), \E_USER_DEPRECATED);
6060

6161
$this->data = \is_array($data) ? $data : unserialize($data);
6262
}
@@ -113,7 +113,7 @@ protected function getCasters()
113113
public function __sleep()
114114
{
115115
if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'serialize'))->getDeclaringClass()->name) {
116-
@trigger_error(sprintf('Implementing the "%s::serialize()" method is deprecated since Symfony 4.3, store all the serialized state in the "data" property instead.', $c), E_USER_DEPRECATED);
116+
@trigger_error(sprintf('Implementing the "%s::serialize()" method is deprecated since Symfony 4.3, store all the serialized state in the "data" property instead.', $c), \E_USER_DEPRECATED);
117117
$this->data = $this->serialize();
118118
}
119119

@@ -123,7 +123,7 @@ public function __sleep()
123123
public function __wakeup()
124124
{
125125
if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'unserialize'))->getDeclaringClass()->name) {
126-
@trigger_error(sprintf('Implementing the "%s::unserialize()" method is deprecated since Symfony 4.3, store all the serialized state in the "data" property instead.', $c), E_USER_DEPRECATED);
126+
@trigger_error(sprintf('Implementing the "%s::unserialize()" method is deprecated since Symfony 4.3, store all the serialized state in the "data" property instead.', $c), \E_USER_DEPRECATED);
127127
$this->unserialize($this->data);
128128
}
129129
}

DataCollector/LoggerDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private function getContainerCompilerLogs(string $compilerLogsFilepath = null):
155155
}
156156

157157
$logs = [];
158-
foreach (file($compilerLogsFilepath, FILE_IGNORE_NEW_LINES) as $log) {
158+
foreach (file($compilerLogsFilepath, \FILE_IGNORE_NEW_LINES) as $log) {
159159
$log = explode(': ', $log, 2);
160160
if (!isset($log[1]) || !preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $log[0])) {
161161
$log = ['Unknown Compiler Pass', implode(': ', $log)];
@@ -228,7 +228,7 @@ private function isSilencedOrDeprecationErrorLog(array $log): bool
228228
return true;
229229
}
230230

231-
if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), [E_DEPRECATED, E_USER_DEPRECATED], true)) {
231+
if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), [\E_DEPRECATED, \E_USER_DEPRECATED], true)) {
232232
return true;
233233
}
234234

DataCollector/RequestDataCollector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public function collect(Request $request, Response $response/*, \Throwable $exce
6666
if ($request->hasSession()) {
6767
$session = $request->getSession();
6868
if ($session->isStarted()) {
69-
$sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated());
70-
$sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed());
69+
$sessionMetadata['Created'] = date(\DATE_RFC822, $session->getMetadataBag()->getCreated());
70+
$sessionMetadata['Last used'] = date(\DATE_RFC822, $session->getMetadataBag()->getLastUsed());
7171
$sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime();
7272
$sessionAttributes = $session->all();
7373
$flashes = $session->getFlashBag()->peekAll();
@@ -263,7 +263,7 @@ public function getPrettyJson()
263263
{
264264
$decoded = json_decode($this->getContent());
265265

266-
return JSON_ERROR_NONE === json_last_error() ? json_encode($decoded, JSON_PRETTY_PRINT) : null;
266+
return \JSON_ERROR_NONE === json_last_error() ? json_encode($decoded, \JSON_PRETTY_PRINT) : null;
267267
}
268268

269269
public function getContentType()

Debug/FileLinkFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct($fileLinkFormat = null, RequestStack $requestStack =
3737
$fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
3838
if ($fileLinkFormat && !\is_array($fileLinkFormat)) {
3939
$i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f);
40-
$fileLinkFormat = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE);
40+
$fileLinkFormat = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, \PREG_SPLIT_DELIM_CAPTURE);
4141
}
4242

4343
$this->fileLinkFormat = $fileLinkFormat;

DependencyInjection/RegisterControllerArgumentLocatorsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function process(ContainerBuilder $container)
9393
}
9494
foreach (['action', 'argument', 'id'] as $k) {
9595
if (!isset($attributes[$k][0])) {
96-
throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, JSON_UNESCAPED_UNICODE), $id));
96+
throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, \JSON_UNESCAPED_UNICODE), $id));
9797
}
9898
}
9999
if (!isset($methods[$action = strtolower($attributes['action'])])) {

Event/GetResponseForExceptionEvent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function setThrowable(\Throwable $exception): void
5454
*/
5555
public function getException()
5656
{
57-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use "getThrowable()" instead.', __METHOD__), E_USER_DEPRECATED);
57+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use "getThrowable()" instead.', __METHOD__), \E_USER_DEPRECATED);
5858

5959
return $this->exception ?? $this->exception = $this->throwable instanceof \Exception ? $this->throwable : new FatalThrowableError($this->throwable);
6060
}
@@ -66,7 +66,7 @@ public function getException()
6666
*/
6767
public function setException(\Exception $exception)
6868
{
69-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use "setThrowable()" instead.', __METHOD__), E_USER_DEPRECATED);
69+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use "setThrowable()" instead.', __METHOD__), \E_USER_DEPRECATED);
7070

7171
$this->throwable = $this->exception = $exception;
7272
}

0 commit comments

Comments
 (0)