Skip to content

Commit 702f439

Browse files
Merge branch '4.4' into 5.1
* 4.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 340578d + 5b37581 commit 702f439

23 files changed

+120
-120
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(string $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(string $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) {

DataCollector/ConfigDataCollector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ public function collect(Request $request, Response $response, \Throwable $except
4848
'symfony_state' => 'unknown',
4949
'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a',
5050
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
51-
'php_version' => PHP_VERSION,
51+
'php_version' => \PHP_VERSION,
5252
'php_architecture' => \PHP_INT_SIZE * 8,
5353
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
5454
'php_timezone' => date_default_timezone_get(),
5555
'xdebug_enabled' => \extension_loaded('xdebug'),
56-
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN),
57-
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN),
56+
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN),
57+
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN),
5858
'bundles' => [],
5959
'sapi_name' => \PHP_SAPI,
6060
];

DataCollector/LoggerDataCollector.php

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

155155
$logs = [];
156-
foreach (file($compilerLogsFilepath, FILE_IGNORE_NEW_LINES) as $log) {
156+
foreach (file($compilerLogsFilepath, \FILE_IGNORE_NEW_LINES) as $log) {
157157
$log = explode(': ', $log, 2);
158158
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])) {
159159
$log = ['Unknown Compiler Pass', implode(': ', $log)];
@@ -226,7 +226,7 @@ private function isSilencedOrDeprecationErrorLog(array $log): bool
226226
return true;
227227
}
228228

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

DataCollector/RequestDataCollector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public function collect(Request $request, Response $response, \Throwable $except
6464
if ($request->hasSession()) {
6565
$session = $request->getSession();
6666
if ($session->isStarted()) {
67-
$sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated());
68-
$sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed());
67+
$sessionMetadata['Created'] = date(\DATE_RFC822, $session->getMetadataBag()->getCreated());
68+
$sessionMetadata['Last used'] = date(\DATE_RFC822, $session->getMetadataBag()->getLastUsed());
6969
$sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime();
7070
$sessionAttributes = $session->all();
7171
$flashes = $session->getFlashBag()->peekAll();
@@ -261,7 +261,7 @@ public function getPrettyJson()
261261
{
262262
$decoded = json_decode($this->getContent());
263263

264-
return JSON_ERROR_NONE === json_last_error() ? json_encode($decoded, JSON_PRETTY_PRINT) : null;
264+
return \JSON_ERROR_NONE === json_last_error() ? json_encode($decoded, \JSON_PRETTY_PRINT) : null;
265265
}
266266

267267
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
@@ -100,7 +100,7 @@ public function process(ContainerBuilder $container)
100100
}
101101
foreach (['action', 'argument', 'id'] as $k) {
102102
if (!isset($attributes[$k][0])) {
103-
throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, JSON_UNESCAPED_UNICODE), $id));
103+
throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, \JSON_UNESCAPED_UNICODE), $id));
104104
}
105105
}
106106
if (!isset($methods[$action = strtolower($attributes['action'])])) {

EventListener/DebugHandlersListener.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ class DebugHandlersListener implements EventSubscriberInterface
4949
* @param string|FileLinkFormatter|null $fileLinkFormat The format for links to source files
5050
* @param bool $scope Enables/disables scoping mode
5151
*/
52-
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, ?int $throwAt = E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, LoggerInterface $deprecationLogger = null)
52+
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, LoggerInterface $deprecationLogger = null)
5353
{
5454
$this->exceptionHandler = $exceptionHandler;
5555
$this->logger = $logger;
56-
$this->levels = null === $levels ? E_ALL : $levels;
57-
$this->throwAt = \is_int($throwAt) ? $throwAt : (null === $throwAt ? null : ($throwAt ? E_ALL : null));
56+
$this->levels = null === $levels ? \E_ALL : $levels;
57+
$this->throwAt = \is_int($throwAt) ? $throwAt : (null === $throwAt ? null : ($throwAt ? \E_ALL : null));
5858
$this->scream = $scream;
5959
$this->fileLinkFormat = $fileLinkFormat;
6060
$this->scope = $scope;
@@ -94,7 +94,7 @@ public function configure(object $event = null)
9494
$handler->screamAt($levels);
9595
}
9696
if ($this->scope) {
97-
$handler->scopeAt($levels & ~E_USER_DEPRECATED & ~E_DEPRECATED);
97+
$handler->scopeAt($levels & ~\E_USER_DEPRECATED & ~\E_DEPRECATED);
9898
} else {
9999
$handler->scopeAt(0, true);
100100
}
@@ -142,15 +142,15 @@ private function setDefaultLoggers(ErrorHandler $handler): void
142142
$levelsDeprecatedOnly = [];
143143
$levelsWithoutDeprecated = [];
144144
foreach ($this->levels as $type => $log) {
145-
if (E_DEPRECATED == $type || E_USER_DEPRECATED == $type) {
145+
if (\E_DEPRECATED == $type || \E_USER_DEPRECATED == $type) {
146146
$levelsDeprecatedOnly[$type] = $log;
147147
} else {
148148
$levelsWithoutDeprecated[$type] = $log;
149149
}
150150
}
151151
} else {
152-
$levelsDeprecatedOnly = $this->levels & (E_DEPRECATED | E_USER_DEPRECATED);
153-
$levelsWithoutDeprecated = $this->levels & ~E_DEPRECATED & ~E_USER_DEPRECATED;
152+
$levelsDeprecatedOnly = $this->levels & (\E_DEPRECATED | \E_USER_DEPRECATED);
153+
$levelsWithoutDeprecated = $this->levels & ~\E_DEPRECATED & ~\E_USER_DEPRECATED;
154154
}
155155

156156
$defaultLoggerLevels = $this->levels;

Fragment/HIncludeFragmentRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function render($uri, Request $request, array $options = [])
8686
}
8787
$renderedAttributes = '';
8888
if (\count($attributes) > 0) {
89-
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
89+
$flags = \ENT_QUOTES | \ENT_SUBSTITUTE;
9090
foreach ($attributes as $attribute => $value) {
9191
$renderedAttributes .= sprintf(
9292
' %s="%s"',

HttpCache/Esi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ public function process(Request $request, Response $response)
8080
$content = preg_replace('#<esi\:remove>.*?</esi\:remove>#s', '', $content);
8181
$content = preg_replace('#<esi\:comment[^>]+>#s', '', $content);
8282

83-
$chunks = preg_split('#<esi\:include\s+(.*?)\s*(?:/|</esi\:include)>#', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
83+
$chunks = preg_split('#<esi\:include\s+(.*?)\s*(?:/|</esi\:include)>#', $content, -1, \PREG_SPLIT_DELIM_CAPTURE);
8484
$chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]);
8585

8686
$i = 1;
8787
while (isset($chunks[$i])) {
8888
$options = [];
89-
preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER);
89+
preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, \PREG_SET_ORDER);
9090
foreach ($matches as $set) {
9191
$options[$set[1]] = $set[2];
9292
}

HttpCache/Ssi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ public function process(Request $request, Response $response)
6565
// we don't use a proper XML parser here as we can have SSI tags in a plain text response
6666
$content = $response->getContent();
6767

68-
$chunks = preg_split('#<!--\#include\s+(.*?)\s*-->#', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
68+
$chunks = preg_split('#<!--\#include\s+(.*?)\s*-->#', $content, -1, \PREG_SPLIT_DELIM_CAPTURE);
6969
$chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]);
7070

7171
$i = 1;
7272
while (isset($chunks[$i])) {
7373
$options = [];
74-
preg_match_all('/(virtual)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER);
74+
preg_match_all('/(virtual)="([^"]*?)"/', $chunks[$i], $matches, \PREG_SET_ORDER);
7575
foreach ($matches as $set) {
7676
$options[$set[1]] = $set[2];
7777
}

0 commit comments

Comments
 (0)