Skip to content

Commit d6bdbae

Browse files
Leverage trigger_deprecation() from symfony/deprecation-contracts
1 parent 55e2c5b commit d6bdbae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+73
-63
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"psr/event-dispatcher": "^1.0",
2727
"psr/link": "^1.0",
2828
"psr/log": "~1.0",
29-
"symfony/contracts": "^2",
29+
"symfony/contracts": "^2.1",
3030
"symfony/polyfill-ctype": "~1.8",
3131
"symfony/polyfill-intl-grapheme": "~1.0",
3232
"symfony/polyfill-intl-icu": "~1.0",

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function load(array $configs, ContainerBuilder $container)
214214
}
215215

216216
if (!\extension_loaded('intl') && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
217-
@trigger_error('Please install the "intl" PHP extension for best performance.', E_USER_DEPRECATED);
217+
deprecated('', '', 'Please install the "intl" PHP extension for best performance.');
218218
}
219219
}
220220

@@ -857,7 +857,7 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
857857
$loader->load('routing.xml');
858858

859859
if (null === $config['utf8']) {
860-
@trigger_error('Not setting the "framework.router.utf8" configuration option is deprecated since Symfony 5.1, it will default to "true" in Symfony 6.0.', E_USER_DEPRECATED);
860+
trigger_deprecation('symfony/framework-bundle', '5.1', 'Not setting the "framework.router.utf8" configuration option is deprecated, it will default to "true" in version 6.0.');
861861
}
862862

863863
if ($config['utf8']) {

src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function loadRoutes(LoaderInterface $loader)
174174
}
175175
}
176176

177-
@trigger_error(sprintf('Using type "%s" for argument 1 of method "%s:configureRoutes()" is deprecated since Symfony 5.1, use "%s" instead.', RouteCollectionBuilder::class, self::class, RoutingConfigurator::class), E_USER_DEPRECATED);
177+
trigger_deprecation('symfony/framework-bundle', '5.1', 'Using type "%s" for argument 1 of method "%s:configureRoutes()" is deprecated, use "%s" instead.', RouteCollectionBuilder::class, self::class, RoutingConfigurator::class);
178178

179179
$routes = new RouteCollectionBuilder($loader);
180180
$this->configureRoutes($routes);

src/Symfony/Component/Config/Definition/ArrayNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ protected function finalizeValue($value)
227227
}
228228

229229
if ($child->isDeprecated()) {
230-
@trigger_error($child->getDeprecationMessage($name, $this->getPath()), E_USER_DEPRECATED);
230+
deprecated('', '', $child->getDeprecationMessage($name, $this->getPath()));
231231
}
232232

233233
try {

src/Symfony/Component/Config/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": "^7.2.5",
20+
"symfony/deprecation-contracts": "^2.1",
2021
"symfony/filesystem": "^4.4|^5.0",
2122
"symfony/polyfill-ctype": "~1.8"
2223
},

src/Symfony/Component/DependencyInjection/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+
deprecated('', '', '%s. It is being referenced by the "%s" %s.', rtrim($alias->getDeprecationMessage($id), '. '), $this->currentId, $container->hasDefinition($this->currentId) ? 'service' : 'alias');
6666
}
6767

6868
$seen = [];

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ private function doGet(string $id, int $invalidBehavior = ContainerInterface::EX
568568
$alias = $this->aliasDefinitions[$id];
569569

570570
if ($alias->isDeprecated()) {
571-
@trigger_error($alias->getDeprecationMessage($id), E_USER_DEPRECATED);
571+
deprecated('', '', $alias->getDeprecationMessage($id));
572572
}
573573

574574
return $this->doGet((string) $alias, $invalidBehavior, $inlineServices, $isConstructorArgument);
@@ -1037,7 +1037,7 @@ private function createService(Definition $definition, array &$inlineServices, b
10371037
}
10381038

10391039
if ($definition->isDeprecated()) {
1040-
@trigger_error($definition->getDeprecationMessage($id), E_USER_DEPRECATED);
1040+
deprecated('', '', $definition->getDeprecationMessage($id));
10411041
}
10421042

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

10821082
if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
1083-
@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);
1083+
deprecated('', '', 'The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name);
10841084
}
10851085
}
10861086
} else {
@@ -1089,7 +1089,7 @@ private function createService(Definition $definition, array &$inlineServices, b
10891089
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments);
10901090

10911091
if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
1092-
@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);
1092+
deprecated('', '', 'The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name);
10931093
}
10941094
}
10951095

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ protected function {$methodName}($lazyInitialization)
803803
$this->inlinedDefinitions = $this->getDefinitionsFromArguments([$definition], null, $this->serviceCalls);
804804

805805
if ($definition->isDeprecated()) {
806-
$code .= sprintf(" @trigger_error(%s, E_USER_DEPRECATED);\n\n", $this->export($definition->getDeprecationMessage($id)));
806+
$code .= sprintf(" deprecated('', '', %s);\n\n", $this->export($definition->getDeprecationMessage($id)));
807807
}
808808

809809
if ($this->getProxyDumper()->isProxyCandidate($definition)) {
@@ -1312,7 +1312,7 @@ private function addDeprecatedAliases(): string
13121312
*/
13131313
protected function {$methodNameAlias}()
13141314
{
1315-
@trigger_error($messageExported, E_USER_DEPRECATED);
1315+
deprecated('', '', $messageExported);
13161316
13171317
return \$this->get($idExported);
13181318
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/DeprecatedClass.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\Tests\Fixtures;
1313

14-
@trigger_error('deprecated', E_USER_DEPRECATED);
14+
deprecated('', '', 'deprecated');
1515

1616
class DeprecatedClass
1717
{

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/container_alias_deprecation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function getFooService()
6666
*/
6767
protected function getAliasForFooDeprecatedService()
6868
{
69-
@trigger_error('The "alias_for_foo_deprecated" service alias is deprecated. You should stop using it, as it will be removed in the future.', E_USER_DEPRECATED);
69+
deprecated('', '', 'The "alias_for_foo_deprecated" service alias is deprecated. You should stop using it, as it will be removed in the future.');
7070

7171
return $this->get('foo');
7272
}

0 commit comments

Comments
 (0)