Skip to content

Commit 87cdfb2

Browse files
Enable "native_constant_invocation" CS rule
1 parent 16620a5 commit 87cdfb2

38 files changed

+126
-126
lines changed

Bundle/Bundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function registerCommands(Application $application)
171171
}
172172
$r = new \ReflectionClass($class);
173173
if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) {
174-
@trigger_error(sprintf('Auto-registration of the command "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Use PSR-4 based service discovery instead.', $class), E_USER_DEPRECATED);
174+
@trigger_error(sprintf('Auto-registration of the command "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Use PSR-4 based service discovery instead.', $class), \E_USER_DEPRECATED);
175175

176176
$application->add($r->newInstance());
177177
}

CacheClearer/ChainCacheClearer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function clear($cacheDir)
4949
*/
5050
public function add(CacheClearerInterface $clearer)
5151
{
52-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED);
52+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), \E_USER_DEPRECATED);
5353

5454
$this->clearers[] = $clearer;
5555
}

CacheClearer/Psr6CacheClearer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(array $pools = [])
2727

2828
public function addPool(CacheItemPoolInterface $pool)
2929
{
30-
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead.', __METHOD__), E_USER_DEPRECATED);
30+
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead.', __METHOD__), \E_USER_DEPRECATED);
3131

3232
$this->pools[] = $pool;
3333
}

CacheWarmer/CacheWarmerAggregate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function isOptional()
6868
*/
6969
public function setWarmers(array $warmers)
7070
{
71-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED);
71+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), \E_USER_DEPRECATED);
7272

7373
$this->warmers = [];
7474
foreach ($warmers as $warmer) {
@@ -82,7 +82,7 @@ public function setWarmers(array $warmers)
8282
public function add(CacheWarmerInterface $warmer)
8383
{
8484
if ($this->triggerDeprecation) {
85-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED);
85+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), \E_USER_DEPRECATED);
8686
}
8787

8888
$this->warmers[] = $warmer;

Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ protected function filterFiles(array $files)
170170
$value->getClientOriginalName(),
171171
$value->getClientMimeType(),
172172
0,
173-
UPLOAD_ERR_INI_SIZE,
173+
\UPLOAD_ERR_INI_SIZE,
174174
true
175175
);
176176
} else {

Controller/ControllerResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function getController(Request $request)
101101
*/
102102
public function getArguments(Request $request, $controller)
103103
{
104-
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED);
104+
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), \E_USER_DEPRECATED);
105105

106106
if (\is_array($controller)) {
107107
$r = new \ReflectionMethod($controller[0], $controller[1]);
@@ -125,7 +125,7 @@ public function getArguments(Request $request, $controller)
125125
*/
126126
protected function doGetArguments(Request $request, $controller, array $parameters)
127127
{
128-
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED);
128+
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), \E_USER_DEPRECATED);
129129

130130
$attributes = $request->attributes->all();
131131
$arguments = [];

Controller/TraceableControllerResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getController(Request $request)
6060
*/
6161
public function getArguments(Request $request, $controller)
6262
{
63-
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Please use the %s instead.', __METHOD__, TraceableArgumentResolver::class), E_USER_DEPRECATED);
63+
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Please use the %s instead.', __METHOD__, TraceableArgumentResolver::class), \E_USER_DEPRECATED);
6464

6565
$ret = $this->argumentResolver->getArguments($request, $controller);
6666

DataCollector/ConfigDataCollector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public function collect(Request $request, Response $response, \Exception $except
6363
'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a',
6464
'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a',
6565
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
66-
'php_version' => PHP_VERSION,
66+
'php_version' => \PHP_VERSION,
6767
'php_architecture' => \PHP_INT_SIZE * 8,
6868
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
6969
'php_timezone' => date_default_timezone_get(),
7070
'xdebug_enabled' => \extension_loaded('xdebug'),
71-
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN),
72-
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN),
71+
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN),
72+
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN),
7373
'bundles' => [],
7474
'sapi_name' => \PHP_SAPI,
7575
];

DataCollector/DataCollector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
4545

4646
public function serialize()
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);
@@ -77,7 +77,7 @@ protected function cloneVar($var)
7777
$this->cloner->setMaxItems(-1);
7878
$this->cloner->addCasters($this->getCasters());
7979
} else {
80-
@trigger_error(sprintf('Using the %s() method without the VarDumper component is deprecated since Symfony 3.2 and won\'t be supported in 4.0. Install symfony/var-dumper version 3.2 or above.', __METHOD__), E_USER_DEPRECATED);
80+
@trigger_error(sprintf('Using the %s() method without the VarDumper component is deprecated since Symfony 3.2 and won\'t be supported in 4.0. Install symfony/var-dumper version 3.2 or above.', __METHOD__), \E_USER_DEPRECATED);
8181
$this->cloner = false;
8282
}
8383
}
@@ -103,7 +103,7 @@ protected function cloneVar($var)
103103
*/
104104
protected function varToString($var)
105105
{
106-
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use cloneVar() instead.', __METHOD__), E_USER_DEPRECATED);
106+
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use cloneVar() instead.', __METHOD__), \E_USER_DEPRECATED);
107107

108108
if (null === $this->valueExporter) {
109109
$this->valueExporter = new ValueExporter();

DataCollector/DumpDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function dump(Data $data)
7171
$this->isCollected = false;
7272
}
7373

74-
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 7);
74+
$trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 7);
7575

7676
$file = $trace[0]['file'];
7777
$line = $trace[0]['line'];

DataCollector/EventDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
2828
public function __construct(EventDispatcherInterface $dispatcher = null)
2929
{
3030
if ($dispatcher instanceof TraceableEventDispatcherInterface && !method_exists($dispatcher, 'reset')) {
31-
@trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', TraceableEventDispatcherInterface::class, \get_class($dispatcher)), E_USER_DEPRECATED);
31+
@trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', TraceableEventDispatcherInterface::class, \get_class($dispatcher)), \E_USER_DEPRECATED);
3232
}
3333
$this->dispatcher = $dispatcher;
3434
}

DataCollector/LoggerDataCollector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($logger = null, $containerPathPrefix = null)
3030
{
3131
if (null !== $logger && $logger instanceof DebugLoggerInterface) {
3232
if (!method_exists($logger, 'clear')) {
33-
@trigger_error(sprintf('Implementing "%s" without the "clear()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', DebugLoggerInterface::class, \get_class($logger)), E_USER_DEPRECATED);
33+
@trigger_error(sprintf('Implementing "%s" without the "clear()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "%s".', DebugLoggerInterface::class, \get_class($logger)), \E_USER_DEPRECATED);
3434
}
3535

3636
$this->logger = $logger;
@@ -148,7 +148,7 @@ private function getContainerCompilerLogs()
148148
}
149149

150150
$logs = [];
151-
foreach (file($file, FILE_IGNORE_NEW_LINES) as $log) {
151+
foreach (file($file, \FILE_IGNORE_NEW_LINES) as $log) {
152152
$log = explode(': ', $log, 2);
153153
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])) {
154154
$log = ['Unknown Compiler Pass', implode(': ', $log)];
@@ -221,7 +221,7 @@ private function isSilencedOrDeprecationErrorLog(array $log)
221221
return true;
222222
}
223223

224-
if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), [E_DEPRECATED, E_USER_DEPRECATED], true)) {
224+
if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), [\E_DEPRECATED, \E_USER_DEPRECATED], true)) {
225225
return true;
226226
}
227227

DataCollector/RequestDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public function collect(Request $request, Response $response, \Exception $except
6262
if ($request->hasSession()) {
6363
$session = $request->getSession();
6464
if ($session->isStarted()) {
65-
$sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated());
66-
$sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed());
65+
$sessionMetadata['Created'] = date(\DATE_RFC822, $session->getMetadataBag()->getCreated());
66+
$sessionMetadata['Last used'] = date(\DATE_RFC822, $session->getMetadataBag()->getLastUsed());
6767
$sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime();
6868
$sessionAttributes = $session->all();
6969
$flashes = $session->getFlashBag()->peekAll();

DataCollector/Util/ValueExporter.php

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

1212
namespace Symfony\Component\HttpKernel\DataCollector\Util;
1313

14-
@trigger_error('The '.__NAMESPACE__.'\ValueExporter class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the VarDumper component instead.', E_USER_DEPRECATED);
14+
@trigger_error('The '.__NAMESPACE__.'\ValueExporter class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the VarDumper component instead.', \E_USER_DEPRECATED);
1515

1616
/**
1717
* @author Bernhard Schussek <bschussek@gmail.com>

Debug/FileLinkFormatter.php

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

4242
$this->fileLinkFormat = $fileLinkFormat;

DependencyInjection/AddClassesToCachePass.php

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

1212
namespace Symfony\Component\HttpKernel\DependencyInjection;
1313

14-
@trigger_error('The '.__NAMESPACE__.'\AddClassesToCachePass class is deprecated since Symfony 3.3 and will be removed in 4.0.', E_USER_DEPRECATED);
14+
@trigger_error('The '.__NAMESPACE__.'\AddClassesToCachePass class is deprecated since Symfony 3.3 and will be removed in 4.0.', \E_USER_DEPRECATED);
1515

1616
/**
1717
* Sets the classes to compile in the cache for the container.

DependencyInjection/Extension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract class Extension extends BaseExtension
3333
public function getClassesToCompile()
3434
{
3535
if (\PHP_VERSION_ID >= 70000) {
36-
@trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED);
36+
@trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', \E_USER_DEPRECATED);
3737
}
3838

3939
return $this->classes;
@@ -59,7 +59,7 @@ public function getAnnotatedClassesToCompile()
5959
public function addClassesToCompile(array $classes)
6060
{
6161
if (\PHP_VERSION_ID >= 70000) {
62-
@trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', E_USER_DEPRECATED);
62+
@trigger_error(__METHOD__.'() is deprecated since Symfony 3.3, to be removed in 4.0.', \E_USER_DEPRECATED);
6363
}
6464

6565
$this->classes = array_merge($this->classes, $classes);

DependencyInjection/LazyLoadingFragmentHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(ContainerInterface $container, RequestStack $request
5151
*/
5252
public function addRendererService($name, $renderer)
5353
{
54-
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
54+
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED);
5555

5656
$this->rendererIds[$name] = $renderer;
5757
}

DependencyInjection/RegisterControllerArgumentLocatorsPass.php

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

EventListener/DebugHandlersListener.php

Lines changed: 4 additions & 4 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, $throwAt = E_ALL, $scream = true, $fileLinkFormat = null, $scope = true)
52+
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, $throwAt = \E_ALL, $scream = true, $fileLinkFormat = null, $scope = true)
5353
{
5454
$this->exceptionHandler = $exceptionHandler;
5555
$this->logger = $logger;
56-
$this->levels = null === $levels ? E_ALL : $levels;
57-
$this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? E_ALL : null));
56+
$this->levels = null === $levels ? \E_ALL : $levels;
57+
$this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? \E_ALL : null));
5858
$this->scream = (bool) $scream;
5959
$this->fileLinkFormat = $fileLinkFormat;
6060
$this->scope = (bool) $scope;
@@ -93,7 +93,7 @@ public function configure(Event $event = null)
9393
$handler->screamAt($levels);
9494
}
9595
if ($this->scope) {
96-
$handler->scopeAt($levels & ~E_USER_DEPRECATED & ~E_DEPRECATED);
96+
$handler->scopeAt($levels & ~\E_USER_DEPRECATED & ~\E_DEPRECATED);
9797
} else {
9898
$handler->scopeAt(0, true);
9999
}

Fragment/AbstractSurrogateFragmentRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function render($uri, Request $request, array $options = [])
6363
{
6464
if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) {
6565
if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) {
66-
@trigger_error('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated since Symfony 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', E_USER_DEPRECATED);
66+
@trigger_error('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated since Symfony 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', \E_USER_DEPRECATED);
6767
}
6868

6969
return $this->inlineStrategy->render($uri, $request, $options);

Fragment/HIncludeFragmentRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function render($uri, Request $request, array $options = [])
109109
}
110110
$renderedAttributes = '';
111111
if (\count($attributes) > 0) {
112-
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
112+
$flags = \ENT_QUOTES | \ENT_SUBSTITUTE;
113113
foreach ($attributes as $attribute => $value) {
114114
$renderedAttributes .= sprintf(
115115
' %s="%s"',

0 commit comments

Comments
 (0)