Skip to content

Commit fc9fd3b

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 384c260 + d50e945 commit fc9fd3b

26 files changed

+48
-48
lines changed

Compiler/AnalyzeServiceReferencesPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(bool $onlyConstructorArguments = false, bool $hasPro
5353
*/
5454
public function setRepeatedPass(RepeatedPass $repeatedPass)
5555
{
56-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
56+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
5757
}
5858

5959
/**

Compiler/DecoratorServicePass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DecoratorServicePass implements CompilerPassInterface
2929
public function process(ContainerBuilder $container)
3030
{
3131
$definitions = new \SplPriorityQueue();
32-
$order = PHP_INT_MAX;
32+
$order = \PHP_INT_MAX;
3333

3434
foreach ($container->getDefinitions() as $id => $definition) {
3535
if (!$decorated = $definition->getDecoratedService()) {

Compiler/InlineServiceDefinitionsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(AnalyzeServiceReferencesPass $analyzingPass = null)
4343
*/
4444
public function setRepeatedPass(RepeatedPass $repeatedPass)
4545
{
46-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
46+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
4747
$this->repeatedPass = $repeatedPass;
4848
}
4949

Compiler/RemoveUnusedDefinitionsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class RemoveUnusedDefinitionsPass extends AbstractRecursivePass implements Repea
2929
*/
3030
public function setRepeatedPass(RepeatedPass $repeatedPass)
3131
{
32-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
32+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
3333
}
3434

3535
/**

Compiler/RepeatedPass.php

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

1212
namespace Symfony\Component\DependencyInjection\Compiler;
1313

14-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', RepeatedPass::class), E_USER_DEPRECATED);
14+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', RepeatedPass::class), \E_USER_DEPRECATED);
1515

1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;

Compiler/ResolveReferencesToAliasesPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function getDefinitionId(string $id, ContainerBuilder $container): strin
6262
$alias = $container->getAlias($id);
6363

6464
if ($alias->isDeprecated()) {
65-
@trigger_error(sprintf('%s. It is being referenced by the "%s" %s.', rtrim($alias->getDeprecationMessage($id), '. '), $this->currentId, $container->hasDefinition($this->currentId) ? 'service' : 'alias'), E_USER_DEPRECATED);
65+
@trigger_error(sprintf('%s. It is being referenced by the "%s" %s.', rtrim($alias->getDeprecationMessage($id), '. '), $this->currentId, $container->hasDefinition($this->currentId) ? 'service' : 'alias'), \E_USER_DEPRECATED);
6666
}
6767

6868
$seen = [];

Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERE
231231
?? ('service_container' === $id ? $this : ($this->factories[$id] ?? [$this, 'make'])($id, $invalidBehavior));
232232

233233
if (!\is_object($service) && null !== $service) {
234-
@trigger_error(sprintf('Non-object services are deprecated since Symfony 4.4, please fix the "%s" service which is of type "%s" right now.', $id, \gettype($service)), E_USER_DEPRECATED);
234+
@trigger_error(sprintf('Non-object services are deprecated since Symfony 4.4, please fix the "%s" service which is of type "%s" right now.', $id, \gettype($service)), \E_USER_DEPRECATED);
235235
}
236236

237237
return $service;

ContainerBuilder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ public function getCompiler()
492492
public function set($id, $service)
493493
{
494494
if (!\is_object($service) && null !== $service) {
495-
@trigger_error(sprintf('Non-object services are deprecated since Symfony 4.4, setting the "%s" service to a value of type "%s" should be avoided.', $id, \gettype($service)), E_USER_DEPRECATED);
495+
@trigger_error(sprintf('Non-object services are deprecated since Symfony 4.4, setting the "%s" service to a value of type "%s" should be avoided.', $id, \gettype($service)), \E_USER_DEPRECATED);
496496
}
497497

498498
$id = (string) $id;
@@ -558,7 +558,7 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV
558558
$service = $this->doGet($id, $invalidBehavior);
559559

560560
if (!\is_object($service) && null !== $service) {
561-
@trigger_error(sprintf('Non-object services are deprecated since Symfony 4.4, please fix the "%s" service which is of type "%s" right now.', $id, \gettype($service)), E_USER_DEPRECATED);
561+
@trigger_error(sprintf('Non-object services are deprecated since Symfony 4.4, please fix the "%s" service which is of type "%s" right now.', $id, \gettype($service)), \E_USER_DEPRECATED);
562562
}
563563

564564
return $service;
@@ -590,7 +590,7 @@ private function doGet(string $id, int $invalidBehavior = ContainerInterface::EX
590590
$alias = $this->aliasDefinitions[$id];
591591

592592
if ($alias->isDeprecated()) {
593-
@trigger_error($alias->getDeprecationMessage($id), E_USER_DEPRECATED);
593+
@trigger_error($alias->getDeprecationMessage($id), \E_USER_DEPRECATED);
594594
}
595595

596596
return $this->doGet((string) $alias, $invalidBehavior, $inlineServices, $isConstructorArgument);
@@ -1092,7 +1092,7 @@ private function createService(Definition $definition, array &$inlineServices, b
10921092
}
10931093

10941094
if ($definition->isDeprecated()) {
1095-
@trigger_error($definition->getDeprecationMessage($id), E_USER_DEPRECATED);
1095+
@trigger_error($definition->getDeprecationMessage($id), \E_USER_DEPRECATED);
10961096
}
10971097

10981098
if ($tryProxy && $definition->isLazy() && !$tryProxy = !($proxy = $this->proxyInstantiator) || $proxy instanceof RealServiceInstantiator) {
@@ -1135,7 +1135,7 @@ private function createService(Definition $definition, array &$inlineServices, b
11351135
$r = new \ReflectionClass($factory[0]);
11361136

11371137
if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
1138-
@trigger_error(sprintf('The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name), E_USER_DEPRECATED);
1138+
@trigger_error(sprintf('The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name), \E_USER_DEPRECATED);
11391139
}
11401140
}
11411141
} else {
@@ -1144,7 +1144,7 @@ private function createService(Definition $definition, array &$inlineServices, b
11441144
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments);
11451145

11461146
if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
1147-
@trigger_error(sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), E_USER_DEPRECATED);
1147+
@trigger_error(sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), \E_USER_DEPRECATED);
11481148
}
11491149
}
11501150

Definition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ public function getDecoratedService()
186186
public function setClass($class)
187187
{
188188
if ($class instanceof Parameter) {
189-
@trigger_error(sprintf('Passing an instance of %s as class name to %s in deprecated in Symfony 4.4 and will result in a TypeError in 5.0. Please pass the string "%%%s%%" instead.', Parameter::class, __CLASS__, (string) $class), E_USER_DEPRECATED);
189+
@trigger_error(sprintf('Passing an instance of %s as class name to %s in deprecated in Symfony 4.4 and will result in a TypeError in 5.0. Please pass the string "%%%s%%" instead.', Parameter::class, __CLASS__, (string) $class), \E_USER_DEPRECATED);
190190
}
191191
if (null !== $class && !\is_string($class)) {
192-
@trigger_error(sprintf('The class name passed to %s is expected to be a string. Passing a %s is deprecated in Symfony 4.4 and will result in a TypeError in 5.0.', __CLASS__, \is_object($class) ? \get_class($class) : \gettype($class)), E_USER_DEPRECATED);
192+
@trigger_error(sprintf('The class name passed to %s is expected to be a string. Passing a %s is deprecated in Symfony 4.4 and will result in a TypeError in 5.0.', __CLASS__, \is_object($class) ? \get_class($class) : \gettype($class)), \E_USER_DEPRECATED);
193193
}
194194

195195
$this->changes['class'] = true;

Dumper/PhpDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2013,7 +2013,7 @@ private function isSingleUsePrivateNode(ServiceReferenceGraphNode $node): bool
20132013
*/
20142014
private function export($value)
20152015
{
2016-
if (null !== $this->targetDirRegex && \is_string($value) && preg_match($this->targetDirRegex, $value, $matches, PREG_OFFSET_CAPTURE)) {
2016+
if (null !== $this->targetDirRegex && \is_string($value) && preg_match($this->targetDirRegex, $value, $matches, \PREG_OFFSET_CAPTURE)) {
20172017
$suffix = $matches[0][1] + \strlen($matches[0][0]);
20182018
$matches[0][1] += \strlen($matches[1][0]);
20192019
$prefix = $matches[0][1] ? $this->doExport(substr($value, 0, $matches[0][1]), true).'.' : '';

EnvVarProcessor.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,19 @@ public function getEnv($prefix, $name, \Closure $getEnv)
192192
}
193193

194194
if ('bool' === $prefix) {
195-
return (bool) (filter_var($env, FILTER_VALIDATE_BOOLEAN) ?: filter_var($env, FILTER_VALIDATE_INT) ?: filter_var($env, FILTER_VALIDATE_FLOAT));
195+
return (bool) (filter_var($env, \FILTER_VALIDATE_BOOLEAN) ?: filter_var($env, \FILTER_VALIDATE_INT) ?: filter_var($env, \FILTER_VALIDATE_FLOAT));
196196
}
197197

198198
if ('int' === $prefix) {
199-
if (false === $env = filter_var($env, FILTER_VALIDATE_INT) ?: filter_var($env, FILTER_VALIDATE_FLOAT)) {
199+
if (false === $env = filter_var($env, \FILTER_VALIDATE_INT) ?: filter_var($env, \FILTER_VALIDATE_FLOAT)) {
200200
throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to int.', $name));
201201
}
202202

203203
return (int) $env;
204204
}
205205

206206
if ('float' === $prefix) {
207-
if (false === $env = filter_var($env, FILTER_VALIDATE_FLOAT)) {
207+
if (false === $env = filter_var($env, \FILTER_VALIDATE_FLOAT)) {
208208
throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to float.', $name));
209209
}
210210

@@ -226,7 +226,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
226226
if ('json' === $prefix) {
227227
$env = json_decode($env, true);
228228

229-
if (JSON_ERROR_NONE !== json_last_error()) {
229+
if (\JSON_ERROR_NONE !== json_last_error()) {
230230
throw new RuntimeException(sprintf('Invalid JSON in env var "%s": ', $name).json_last_error_msg());
231231
}
232232

@@ -262,7 +262,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
262262
}
263263

264264
if ('query_string' === $prefix) {
265-
$queryString = parse_url($env, PHP_URL_QUERY) ?: $env;
265+
$queryString = parse_url($env, \PHP_URL_QUERY) ?: $env;
266266
parse_str($queryString, $result);
267267

268268
return $result;

Extension/Extension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function getConfiguration(array $config, ContainerBuilder $container)
9393
}
9494

9595
if (!$class->implementsInterface(ConfigurationInterface::class)) {
96-
@trigger_error(sprintf('Not implementing "%s" in the extension configuration class "%s" is deprecated since Symfony 4.1.', ConfigurationInterface::class, $class->getName()), E_USER_DEPRECATED);
96+
@trigger_error(sprintf('Not implementing "%s" in the extension configuration class "%s" is deprecated since Symfony 4.1.', ConfigurationInterface::class, $class->getName()), \E_USER_DEPRECATED);
9797
//throw new LogicException(sprintf('The extension configuration class "%s" must implement "%s".', $class->getName(), ConfigurationInterface::class));
9898

9999
return null;

Loader/Configurator/ContainerConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function iterator(array $values): IteratorArgument
114114
*/
115115
function tagged(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null): TaggedIteratorArgument
116116
{
117-
@trigger_error(__NAMESPACE__.'\tagged() is deprecated since Symfony 4.4 and will be removed in 5.0, use '.__NAMESPACE__.'\tagged_iterator() instead.', E_USER_DEPRECATED);
117+
@trigger_error(__NAMESPACE__.'\tagged() is deprecated since Symfony 4.4 and will be removed in 5.0, use '.__NAMESPACE__.'\tagged_iterator() instead.', \E_USER_DEPRECATED);
118118

119119
return new TaggedIteratorArgument($tag, $indexAttribute, $defaultIndexMethod);
120120
}

Loader/FileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
5858
if ($ignoreNotFound = 'not_found' === $ignoreErrors) {
5959
$args[2] = false;
6060
} elseif (!\is_bool($ignoreErrors)) {
61-
@trigger_error(sprintf('Invalid argument $ignoreErrors provided to %s::import(): boolean or "not_found" expected, %s given.', static::class, \gettype($ignoreErrors)), E_USER_DEPRECATED);
61+
@trigger_error(sprintf('Invalid argument $ignoreErrors provided to %s::import(): boolean or "not_found" expected, %s given.', static::class, \gettype($ignoreErrors)), \E_USER_DEPRECATED);
6262
$args[2] = (bool) $ignoreErrors;
6363
}
6464

Loader/IniFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function load($resource, $type = null)
3737
}
3838

3939
// real raw parsing
40-
$result = parse_ini_file($path, true, INI_SCANNER_RAW);
40+
$result = parse_ini_file($path, true, \INI_SCANNER_RAW);
4141

4242
if (isset($result['parameters']) && \is_array($result['parameters'])) {
4343
foreach ($result['parameters'] as $key => $value) {
@@ -55,7 +55,7 @@ public function supports($resource, $type = null)
5555
return false;
5656
}
5757

58-
if (null === $type && 'ini' === pathinfo($resource, PATHINFO_EXTENSION)) {
58+
if (null === $type && 'ini' === pathinfo($resource, \PATHINFO_EXTENSION)) {
5959
return true;
6060
}
6161

Loader/PhpFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function supports($resource, $type = null)
6464
return false;
6565
}
6666

67-
if (null === $type && 'php' === pathinfo($resource, PATHINFO_EXTENSION)) {
67+
if (null === $type && 'php' === pathinfo($resource, \PATHINFO_EXTENSION)) {
6868
return true;
6969
}
7070

Loader/XmlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function supports($resource, $type = null)
8181
return false;
8282
}
8383

84-
if (null === $type && 'xml' === pathinfo($resource, PATHINFO_EXTENSION)) {
84+
if (null === $type && 'xml' === pathinfo($resource, \PATHINFO_EXTENSION)) {
8585
return true;
8686
}
8787

@@ -634,7 +634,7 @@ public function validateSchema(\DOMDocument $dom)
634634
EOF
635635
;
636636

637-
if (LIBXML_VERSION < 20900) {
637+
if (\LIBXML_VERSION < 20900) {
638638
$disableEntities = libxml_disable_entity_loader(false);
639639
$valid = @$dom->schemaValidateSource($source);
640640
libxml_disable_entity_loader($disableEntities);

Loader/YamlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function supports($resource, $type = null)
166166
return false;
167167
}
168168

169-
if (null === $type && \in_array(pathinfo($resource, PATHINFO_EXTENSION), ['yaml', 'yml'], true)) {
169+
if (null === $type && \in_array(pathinfo($resource, \PATHINFO_EXTENSION), ['yaml', 'yml'], true)) {
170170
return true;
171171
}
172172

@@ -637,7 +637,7 @@ private function parseCallable($callable, string $parameter, string $id, string
637637
if (false !== strpos($callable, ':') && false === strpos($callable, '::')) {
638638
$parts = explode(':', $callable);
639639

640-
@trigger_error(sprintf('Using short %s syntax for service "%s" is deprecated since Symfony 4.4, use "[\'@%s\', \'%s\']" instead.', $parameter, $id, ...$parts), E_USER_DEPRECATED);
640+
@trigger_error(sprintf('Using short %s syntax for service "%s" is deprecated since Symfony 4.4, use "[\'@%s\', \'%s\']" instead.', $parameter, $id, ...$parts), \E_USER_DEPRECATED);
641641

642642
return [$this->resolveServices('@'.$parts[0], $file), $parts[1]];
643643
}

ParameterBag/EnvPlaceholderParameterBag.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function get($name)
5555
//throw new RuntimeException(sprintf('The default value of an env() parameter must be a string or null, but "%s" given to "%s".', \gettype($defaultValue), $name));
5656
throw new RuntimeException(sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', \gettype($defaultValue), $name));
5757
} elseif (is_scalar($defaultValue) && !\is_string($defaultValue)) {
58-
@trigger_error(sprintf('A non-string default value of an env() parameter is deprecated since 4.3, cast "%s" to string instead.', $name), E_USER_DEPRECATED);
58+
@trigger_error(sprintf('A non-string default value of an env() parameter is deprecated since 4.3, cast "%s" to string instead.', $name), \E_USER_DEPRECATED);
5959
}
6060
}
6161

@@ -159,14 +159,14 @@ public function resolve()
159159
}
160160
if (is_numeric($default = $this->parameters[$name])) {
161161
if (!\is_string($default)) {
162-
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
162+
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), \E_USER_DEPRECATED);
163163
}
164164
$this->parameters[$name] = (string) $default;
165165
} elseif (null !== $default && !is_scalar($default)) { // !is_string in 5.0
166166
//throw new RuntimeException(sprintf('The default value of env parameter "%s" must be a string or null, "%s" given.', $env, \gettype($default)));
167167
throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, "%s" given.', $env, \gettype($default)));
168168
} elseif (is_scalar($default) && !\is_string($default)) {
169-
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
169+
@trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), \E_USER_DEPRECATED);
170170
}
171171
}
172172
}

ServiceLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private function createNotFoundException(string $id): NotFoundExceptionInterface
8484
return new ServiceNotFoundException($id, end($this->loading) ?: null, null, [], $msg);
8585
}
8686

87-
$class = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 4);
87+
$class = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 4);
8888
$class = isset($class[3]['object']) ? \get_class($class[3]['object']) : null;
8989
$externalId = $this->externalId ?: $class;
9090

Tests/EnvVarProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function validConsts()
196196
{
197197
return [
198198
['Symfony\Component\DependencyInjection\Tests\EnvVarProcessorTest::TEST_CONST', self::TEST_CONST],
199-
['E_ERROR', E_ERROR],
199+
['E_ERROR', \E_ERROR],
200200
];
201201
}
202202

Tests/Loader/FileLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testImportWithGlobPattern()
7575
['foo', 'bar'],
7676
],
7777
'mixedcase' => ['MixedCaseKey' => 'value'],
78-
'constant' => PHP_EOL,
78+
'constant' => \PHP_EOL,
7979
'bar' => '%foo%',
8080
'escape' => '@escapeme',
8181
'foo_bar' => new Reference('foo_bar'),

0 commit comments

Comments
 (0)