Leverage trigger_deprecation() from symfony/deprecation-contracts

This commit is contained in:
Nicolas Grekas 2020-02-01 12:00:36 +01:00
parent 55e2c5b37d
commit 3e35d8e9e3
60 changed files with 81 additions and 71 deletions

View File

@ -26,7 +26,7 @@
"psr/event-dispatcher": "^1.0",
"psr/link": "^1.0",
"psr/log": "~1.0",
"symfony/contracts": "^2",
"symfony/contracts": "^2.1",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-intl-grapheme": "~1.0",
"symfony/polyfill-intl-icu": "~1.0",

View File

@ -214,7 +214,7 @@ class FrameworkExtension extends Extension
}
if (!\extension_loaded('intl') && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
@trigger_error('Please install the "intl" PHP extension for best performance.', E_USER_DEPRECATED);
trigger_deprecation('', '', 'Please install the "intl" PHP extension for best performance.');
}
}
@ -857,7 +857,7 @@ class FrameworkExtension extends Extension
$loader->load('routing.xml');
if (null === $config['utf8']) {
@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);
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.');
}
if ($config['utf8']) {

View File

@ -174,7 +174,7 @@ trait MicroKernelTrait
}
}
@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);
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);
$routes = new RouteCollectionBuilder($loader);
$this->configureRoutes($routes);

View File

@ -227,7 +227,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
}
if ($child->isDeprecated()) {
@trigger_error($child->getDeprecationMessage($name, $this->getPath()), E_USER_DEPRECATED);
trigger_deprecation('', '', $child->getDeprecationMessage($name, $this->getPath()));
}
try {

View File

@ -17,6 +17,7 @@
],
"require": {
"php": "^7.2.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/filesystem": "^4.4|^5.0",
"symfony/polyfill-ctype": "~1.8"
},

View File

@ -62,7 +62,7 @@ class ResolveReferencesToAliasesPass extends AbstractRecursivePass
$alias = $container->getAlias($id);
if ($alias->isDeprecated()) {
@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);
trigger_deprecation('', '', '%s. It is being referenced by the "%s" %s.', rtrim($alias->getDeprecationMessage($id), '. '), $this->currentId, $container->hasDefinition($this->currentId) ? 'service' : 'alias');
}
$seen = [];

View File

@ -568,7 +568,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
$alias = $this->aliasDefinitions[$id];
if ($alias->isDeprecated()) {
@trigger_error($alias->getDeprecationMessage($id), E_USER_DEPRECATED);
trigger_deprecation('', '', $alias->getDeprecationMessage($id));
}
return $this->doGet((string) $alias, $invalidBehavior, $inlineServices, $isConstructorArgument);
@ -1037,7 +1037,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
}
if ($definition->isDeprecated()) {
@trigger_error($definition->getDeprecationMessage($id), E_USER_DEPRECATED);
trigger_deprecation('', '', $definition->getDeprecationMessage($id));
}
if ($tryProxy && $definition->isLazy() && !$tryProxy = !($proxy = $this->proxyInstantiator) || $proxy instanceof RealServiceInstantiator) {
@ -1080,7 +1080,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
$r = new \ReflectionClass($factory[0]);
if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
@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);
trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name);
}
}
} else {
@ -1089,7 +1089,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments);
if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
@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);
trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name);
}
}

View File

@ -803,7 +803,7 @@ EOF;
$this->inlinedDefinitions = $this->getDefinitionsFromArguments([$definition], null, $this->serviceCalls);
if ($definition->isDeprecated()) {
$code .= sprintf(" @trigger_error(%s, E_USER_DEPRECATED);\n\n", $this->export($definition->getDeprecationMessage($id)));
$code .= sprintf(" trigger_deprecation('', '', %s);\n\n", $this->export($definition->getDeprecationMessage($id)));
}
if ($this->getProxyDumper()->isProxyCandidate($definition)) {
@ -1312,7 +1312,7 @@ EOF;
*/
protected function {$methodNameAlias}()
{
@trigger_error($messageExported, E_USER_DEPRECATED);
trigger_deprecation('', '', $messageExported);
return \$this->get($idExported);
}

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
@trigger_error('deprecated', E_USER_DEPRECATED);
trigger_deprecation('', '', 'deprecated');
class DeprecatedClass
{

View File

@ -66,7 +66,7 @@ class Symfony_DI_PhpDumper_Test_Aliases_Deprecation extends Container
*/
protected function getAliasForFooDeprecatedService()
{
@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);
trigger_deprecation('', '', 'The "alias_for_foo_deprecated" service alias is deprecated. You should stop using it, as it will be removed in the future.');
return $this->get('foo');
}

View File

@ -124,7 +124,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
// Returns the public 'deprecated_service' shared service.
@trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.', E_USER_DEPRECATED);
trigger_deprecation('', '', 'The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.');
return $this->services['deprecated_service'] = new \stdClass();
@ -156,7 +156,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException;
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
// Returns the private 'factory_simple' shared service.
@trigger_error('The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.', E_USER_DEPRECATED);
trigger_deprecation('', '', 'The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.');
return new \SimpleFactoryClass('foo');

View File

@ -210,7 +210,7 @@ class ProjectServiceContainer extends Container
*/
protected function getDeprecatedServiceService()
{
@trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.', E_USER_DEPRECATED);
trigger_deprecation('', '', 'The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.');
return $this->services['deprecated_service'] = new \stdClass();
}
@ -404,7 +404,7 @@ class ProjectServiceContainer extends Container
*/
protected function getFactorySimpleService()
{
@trigger_error('The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.', E_USER_DEPRECATED);
trigger_deprecation('', '', 'The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.');
return new \SimpleFactoryClass('foo');
}

View File

@ -231,7 +231,7 @@ class ProjectServiceContainer extends Container
*/
protected function getDeprecatedServiceService()
{
@trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.', E_USER_DEPRECATED);
trigger_deprecation('', '', 'The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.');
return $this->services['deprecated_service'] = new \stdClass();
}
@ -453,7 +453,7 @@ class ProjectServiceContainer extends Container
*/
protected function getFactorySimpleService()
{
@trigger_error('The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.', E_USER_DEPRECATED);
trigger_deprecation('', '', 'The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.');
return new \SimpleFactoryClass('foo');
}

View File

@ -210,7 +210,7 @@ class Symfony_DI_PhpDumper_Errored_Definition extends Container
*/
protected function getDeprecatedServiceService()
{
@trigger_error('The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.', E_USER_DEPRECATED);
trigger_deprecation('', '', 'The "deprecated_service" service is deprecated. You should stop using it, as it will be removed in the future.');
return $this->services['deprecated_service'] = new \stdClass();
}
@ -404,7 +404,7 @@ class Symfony_DI_PhpDumper_Errored_Definition extends Container
*/
protected function getFactorySimpleService()
{
@trigger_error('The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.', E_USER_DEPRECATED);
trigger_deprecation('', '', 'The "factory_simple" service is deprecated. You should stop using it, as it will be removed in the future.');
return new \SimpleFactoryClass('foo');
}

View File

@ -18,6 +18,7 @@
"require": {
"php": "^7.2.5",
"psr/container": "^1.0",
"symfony/deprecation-contracts": "^2.1",
"symfony/service-contracts": "^1.1.6|^2"
},
"require-dev": {

View File

@ -46,7 +46,7 @@ final class Dotenv
public function __construct($envKey = 'APP_ENV', string $debugKey = 'APP_DEBUG')
{
if (\in_array($envKey = (string) $envKey, ['1', ''], true)) {
@trigger_error(sprintf('Passing a boolean to the constructor of "%s" is deprecated since Symfony 5.1, use "Dotenv::usePutenv()".', __CLASS__), E_USER_DEPRECATED);
trigger_deprecation('symfony/dotenv', '5.1', 'Passing a boolean to the constructor of "%s" is deprecated, use "Dotenv::usePutenv()".', __CLASS__);
$this->usePutenv = (bool) $envKey;
$envKey = 'APP_ENV';
}

View File

@ -16,7 +16,8 @@
}
],
"require": {
"php": "^7.2.5"
"php": "^7.2.5",
"symfony/deprecation-contracts": "^2.1"
},
"require-dev": {
"symfony/process": "^4.4|^5.0"

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\EventDispatcher;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
@trigger_error(sprintf('%s is deprecated since Symfony 5.1, use the event dispatcher without the proxy.', LegacyEventDispatcherProxy::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/event-dispatcher', '5.1', '%s is deprecated, use the event dispatcher without the proxy.', LegacyEventDispatcherProxy::class);
/**
* A helper class to provide BC/FC with the legacy signature of EventDispatcherInterface::dispatch().

View File

@ -17,6 +17,7 @@
],
"require": {
"php": "^7.2.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/event-dispatcher-contracts": "^2"
},
"require-dev": {

View File

@ -61,7 +61,7 @@ class FormType extends BaseType
}
if (!method_exists($builder, 'setIsEmptyCallback')) {
@trigger_error(sprintf('Not implementing the "%s::setIsEmptyCallback()" method in "%s" is deprecated since Symfony 5.1.', FormConfigBuilderInterface::class, \get_class($builder)), E_USER_DEPRECATED);
trigger_deprecation('symfony/form', '5.1', 'Not implementing the "%s::setIsEmptyCallback()" method in "%s" is deprecated.', FormConfigBuilderInterface::class, \get_class($builder));
return;
}

View File

@ -727,7 +727,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
}
if (!method_exists($this->config, 'getIsEmptyCallback')) {
@trigger_error(sprintf('Not implementing the "%s::getIsEmptyCallback()" method in "%s" is deprecated since Symfony 5.1.', FormConfigInterface::class, \get_class($this->config)), E_USER_DEPRECATED);
trigger_deprecation('symfony/form', '5.1', 'Not implementing the "%s::getIsEmptyCallback()" method in "%s" is deprecated.', FormConfigInterface::class, \get_class($this->config));
$isEmptyCallback = null;
} else {

View File

@ -17,6 +17,7 @@
],
"require": {
"php": "^7.2.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/event-dispatcher": "^4.4|^5.0",
"symfony/intl": "^4.4|^5.0",
"symfony/options-resolver": "^5.0",

View File

@ -68,7 +68,7 @@ class JsonResponse extends Response
*/
public static function create($data = null, int $status = 200, array $headers = [])
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 5.1; use __construct() instead.', __METHOD__), E_USER_DEPRECATED);
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
return new static($data, $status, $headers);
}

View File

@ -58,7 +58,7 @@ class RedirectResponse extends Response
*/
public static function create($url = '', int $status = 302, array $headers = [])
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 5.1; use __construct() instead.', __METHOD__), E_USER_DEPRECATED);
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
return new static($url, $status, $headers);
}

View File

@ -213,7 +213,7 @@ class Response
*/
public static function create(?string $content = '', int $status = 200, array $headers = [])
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 5.1; use __construct() instead.', __METHOD__), E_USER_DEPRECATED);
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
return new static($content, $status, $headers);
}

View File

@ -52,7 +52,7 @@ class StreamedResponse extends Response
*/
public static function create($callback = null, int $status = 200, array $headers = [])
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 5.1; use __construct() instead.', __METHOD__), E_USER_DEPRECATED);
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
return new static($callback, $status, $headers);
}

View File

@ -17,6 +17,7 @@
],
"require": {
"php": "^7.2.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/polyfill-mbstring": "~1.1"
},
"require-dev": {

View File

@ -104,7 +104,7 @@ class ConnectionTest extends TestCase
/**
* @group legacy
* @expectedDeprecation Invalid option(s) "foo" passed to the AMQP Messenger transport. Passing invalid options is deprecated since Symfony 5.1.
* @expectedDeprecation Since symfony/messenger 5.1: Invalid option(s) "foo" passed to the AMQP Messenger transport. Passing invalid options is deprecated.
*/
public function testDeprecationIfInvalidOptionIsPassedWithDsn()
{
@ -113,7 +113,7 @@ class ConnectionTest extends TestCase
/**
* @group legacy
* @expectedDeprecation Invalid option(s) "foo" passed to the AMQP Messenger transport. Passing invalid options is deprecated since Symfony 5.1.
* @expectedDeprecation Since symfony/messenger 5.1: Invalid option(s) "foo" passed to the AMQP Messenger transport. Passing invalid options is deprecated.
*/
public function testDeprecationIfInvalidOptionIsPassedAsArgument()
{
@ -122,7 +122,7 @@ class ConnectionTest extends TestCase
/**
* @group legacy
* @expectedDeprecation Invalid queue option(s) "foo" passed to the AMQP Messenger transport. Passing invalid queue options is deprecated since Symfony 5.1.
* @expectedDeprecation Since symfony/messenger 5.1: Invalid queue option(s) "foo" passed to the AMQP Messenger transport. Passing invalid queue options is deprecated.
*/
public function testDeprecationIfInvalidQueueOptionIsPassed()
{
@ -131,7 +131,7 @@ class ConnectionTest extends TestCase
/**
* @group legacy
* @expectedDeprecation Invalid exchange option(s) "foo" passed to the AMQP Messenger transport. Passing invalid exchange options is deprecated since Symfony 5.1.
* @expectedDeprecation Since symfony/messenger 5.1: Invalid exchange option(s) "foo" passed to the AMQP Messenger transport. Passing invalid exchange options is deprecated.
*/
public function testDeprecationIfInvalidExchangeOptionIsPassed()
{

View File

@ -220,7 +220,7 @@ class Connection
private static function validateOptions(array $options): void
{
if (0 < \count($invalidOptions = array_diff(array_keys($options), self::AVAILABLE_OPTIONS))) {
@trigger_error(sprintf('Invalid option(s) "%s" passed to the AMQP Messenger transport. Passing invalid options is deprecated since Symfony 5.1.', implode('", "', $invalidOptions)), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'Invalid option(s) "%s" passed to the AMQP Messenger transport. Passing invalid options is deprecated.', implode('", "', $invalidOptions));
}
if (\is_array($options['queues'] ?? false)) {
@ -230,14 +230,14 @@ class Connection
}
if (0 < \count($invalidQueueOptions = array_diff(array_keys($queue), self::AVAILABLE_QUEUE_OPTIONS))) {
@trigger_error(sprintf('Invalid queue option(s) "%s" passed to the AMQP Messenger transport. Passing invalid queue options is deprecated since Symfony 5.1.', implode('", "', $invalidQueueOptions)), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'Invalid queue option(s) "%s" passed to the AMQP Messenger transport. Passing invalid queue options is deprecated.', implode('", "', $invalidQueueOptions));
}
}
}
if (\is_array($options['exchange'] ?? false)
&& 0 < \count($invalidExchangeOptions = array_diff(array_keys($options['exchange']), self::AVAILABLE_EXCHANGE_OPTIONS))) {
@trigger_error(sprintf('Invalid exchange option(s) "%s" passed to the AMQP Messenger transport. Passing invalid exchange options is deprecated since Symfony 5.1.', implode('", "', $invalidExchangeOptions)), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'Invalid exchange option(s) "%s" passed to the AMQP Messenger transport. Passing invalid exchange options is deprecated.', implode('", "', $invalidExchangeOptions));
}
}

View File

@ -109,7 +109,7 @@ class ConnectionTest extends TestCase
}
/**
* @expectedDeprecation Invalid option(s) "foo" passed to the Redis Messenger transport. Passing invalid options is deprecated since Symfony 5.1.
* @expectedDeprecation Since symfony/messenger 5.1: Invalid option(s) "foo" passed to the Redis Messenger transport. Passing invalid options is deprecated.
* @group legacy
*/
public function testDeprecationIfInvalidOptionIsPassedWithDsn()

View File

@ -174,7 +174,7 @@ class Connection
$availableOptions[] = 'serializer';
if (0 < \count($invalidOptions = array_diff(array_keys($options), $availableOptions))) {
@trigger_error(sprintf('Invalid option(s) "%s" passed to the Redis Messenger transport. Passing invalid options is deprecated since Symfony 5.1.', implode('", "', $invalidOptions)), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'Invalid option(s) "%s" passed to the Redis Messenger transport. Passing invalid options is deprecated.', implode('", "', $invalidOptions));
}
}

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\AmqpExt;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpFactory as BridgeAmqpFactory;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpFactory::class, BridgeAmqpFactory::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpFactory::class, BridgeAmqpFactory::class);
class_exists(BridgeAmqpFactory::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\AmqpExt;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceivedStamp as BridgeAmqpReceivedStamp;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpReceivedStamp::class, BridgeAmqpReceivedStamp::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated,use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpReceivedStamp::class, BridgeAmqpReceivedStamp::class);
class_exists(BridgeAmqpReceivedStamp::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\AmqpExt;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceiver as BridgeAmqpReceiver;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpReceiver::class, BridgeAmqpReceiver::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpReceiver::class, BridgeAmqpReceiver::class);
class_exists(BridgeAmqpReceiver::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\AmqpExt;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpSender as BridgeAmqpSender;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpSender::class, BridgeAmqpSender::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpSender::class, BridgeAmqpSender::class);
class_exists(BridgeAmqpSender::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\AmqpExt;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpStamp as BridgeAmqpStamp;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpStamp::class, BridgeAmqpStamp::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpStamp::class, BridgeAmqpStamp::class);
class_exists(BridgeAmqpStamp::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\AmqpExt;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransport as BridgeAmqpTransport;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpTransport::class, BridgeAmqpTransport::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpTransport::class, BridgeAmqpTransport::class);
class_exists(BridgeAmqpTransport::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\AmqpExt;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory as BridgeAmqpTransportFactory;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpTransportFactory::class, BridgeAmqpTransportFactory::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', AmqpTransportFactory::class, BridgeAmqpTransportFactory::class);
class_exists(BridgeAmqpTransportFactory::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\AmqpExt;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\Connection as BridgeConnection;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', Connection::class, BridgeConnection::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The AmqpExt transport has been moved to package "symfony/amqp-messenger" and will not be included by default in 6.0. Run "composer require symfony/amqp-messenger".', Connection::class, BridgeConnection::class);
class_exists(BridgeConnection::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\Doctrine;
use Symfony\Component\Messenger\Bridge\Doctrine\Transport\Connection as BridgeConnection;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', Connection::class, BridgeConnection::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', Connection::class, BridgeConnection::class);
class_exists(BridgeConnection::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\Doctrine;
use Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineReceivedStamp as BridgeDoctrineReceivedStamp;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', DoctrineReceivedStamp::class, BridgeDoctrineReceivedStamp::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', DoctrineReceivedStamp::class, BridgeDoctrineReceivedStamp::class);
class_exists(BridgeDoctrineReceivedStamp::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\Doctrine;
use Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineReceiver as BridgeDoctrineReceiver;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', DoctrineReceiver::class, BridgeDoctrineReceiver::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', DoctrineReceiver::class, BridgeDoctrineReceiver::class);
class_exists(BridgeDoctrineReceiver::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\Doctrine;
use Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineSender as BridgeDoctrineSender;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', DoctrineSender::class, BridgeDoctrineSender::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', DoctrineSender::class, BridgeDoctrineSender::class);
class_exists(BridgeDoctrineSender::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\Doctrine;
use Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineTransport as BridgeDoctrineTransport;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', DoctrineTransport::class, BridgeDoctrineTransport::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', DoctrineTransport::class, BridgeDoctrineTransport::class);
class_exists(BridgeDoctrineTransport::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\Doctrine;
use Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineTransportFactory as BridgeDoctrineTransportFactory;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', DoctrineTransportFactory::class, BridgeDoctrineTransportFactory::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The Doctrine transport has been moved to package "symfony/doctrine-messenger" and will not be included by default in 6.0. Run "composer require symfony/doctrine-messenger".', DoctrineTransportFactory::class, BridgeDoctrineTransportFactory::class);
class_exists(BridgeDoctrineTransportFactory::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\RedisExt;
use Symfony\Component\Messenger\Bridge\Redis\Transport\Connection as BridgeConnection;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', Connection::class, BridgeConnection::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', Connection::class, BridgeConnection::class);
class_exists(BridgeConnection::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\RedisExt;
use Symfony\Component\Messenger\Bridge\Redis\Transport\RedisReceivedStamp as BridgeRedisReceivedStamp;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', RedisReceivedStamp::class, BridgeRedisReceivedStamp::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated,use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', RedisReceivedStamp::class, BridgeRedisReceivedStamp::class);
class_exists(BridgeRedisReceivedStamp::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\RedisExt;
use Symfony\Component\Messenger\Bridge\Redis\Transport\RedisReceiver as BridgeRedisReceiver;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', RedisReceiver::class, BridgeRedisReceiver::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', RedisReceiver::class, BridgeRedisReceiver::class);
class_exists(BridgeRedisReceiver::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\RedisExt;
use Symfony\Component\Messenger\Bridge\Redis\Transport\RedisSender as BridgeRedisSender;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', RedisSender::class, BridgeRedisSender::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', RedisSender::class, BridgeRedisSender::class);
class_exists(BridgeRedisSender::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\RedisExt;
use Symfony\Component\Messenger\Bridge\Redis\Transport\RedisTransport as BridgeRedisTransport;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', RedisTransport::class, BridgeRedisTransport::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', RedisTransport::class, BridgeRedisTransport::class);
class_exists(BridgeRedisTransport::class);

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Transport\RedisExt;
use Symfony\Component\Messenger\Bridge\Redis\Transport\RedisTransportFactory as BridgeRedisTransportFactory;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', RedisTransportFactory::class, BridgeRedisTransportFactory::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/messenger', '5.1', 'The "%s" class is deprecated, use "%s" instead. The RedisExt transport has been moved to package "symfony/redis-messenger" and will not be included by default in 6.0. Run "composer require symfony/redis-messenger".', RedisTransportFactory::class, BridgeRedisTransportFactory::class);
class_exists(BridgeRedisTransportFactory::class);

View File

@ -19,6 +19,7 @@
"php": "^7.2.5",
"psr/log": "~1.0",
"symfony/amqp-messenger": "^5.1",
"symfony/deprecation-contracts": "^2.1",
"symfony/doctrine-messenger": "^5.1",
"symfony/redis-messenger": "^5.1"
},

View File

@ -863,7 +863,7 @@ class OptionsResolver implements Options
// Shortcut for resolved options
if (isset($this->resolved[$option]) || \array_key_exists($option, $this->resolved)) {
if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || $this->calling) && \is_string($this->deprecated[$option])) {
@trigger_error(strtr($this->deprecated[$option], ['%name%' => $option]), E_USER_DEPRECATED);
trigger_deprecation('', '', strtr($this->deprecated[$option], ['%name%' => $option]));
}
return $this->resolved[$option];
@ -1022,7 +1022,7 @@ class OptionsResolver implements Options
}
if ('' !== $deprecationMessage) {
@trigger_error(strtr($deprecationMessage, ['%name%' => $option]), E_USER_DEPRECATED);
trigger_deprecation('', '', strtr($deprecationMessage, ['%name%' => $option]));
}
}

View File

@ -16,7 +16,8 @@
}
],
"require": {
"php": "^7.2.5"
"php": "^7.2.5",
"symfony/deprecation-contracts": "^2.1"
},
"autoload": {
"psr-4": { "Symfony\\Component\\OptionsResolver\\": "" },

View File

@ -76,8 +76,8 @@ class RouteCollection implements \IteratorAggregate, \Countable
*/
public function add(string $name, Route $route/*, int $priority = 0*/)
{
if (\func_num_args() < 3 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
@trigger_error(sprintf('The "%s()" method will have a new "int $priority = 0" argument in version 6.0, not defining it is deprecated since Symfony 5.1.', __METHOD__), E_USER_DEPRECATED);
if (\func_num_args() < 3 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
trigger_deprecation('symfony/routing', '5.1', 'The "%s()" method will have a new "int $priority = 0" argument in version 6.0, not defining it is deprecated.', __METHOD__);
}
unset($this->routes[$name], $this->priorities[$name]);

View File

@ -16,7 +16,7 @@ use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\ResourceInterface;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 5.1, use "%s" instead.', RouteCollectionBuilder::class, RoutingConfigurator::class), E_USER_DEPRECATED);
trigger_deprecation('symfony/routing', '5.1', 'The "%s" class is deprecated, use "%s" instead.', RouteCollectionBuilder::class, RoutingConfigurator::class);
/**
* Helps add and import routes into a RouteCollection.

View File

@ -16,7 +16,8 @@
}
],
"require": {
"php": "^7.2.5"
"php": "^7.2.5",
"symfony/deprecation-contracts": "^2.1"
},
"require-dev": {
"symfony/config": "^5.0",

View File

@ -591,7 +591,7 @@ class Inline
case 0 === strncmp($scalar, '!php/object', 11):
if (self::$objectSupport) {
if (!isset($scalar[12])) {
@trigger_error('Using the !php/object tag without a value is deprecated since Symfony 5.1.', E_USER_DEPRECATED);
trigger_deprecation('symfony/yaml', '5.1', 'Using the !php/object tag without a value is deprecated.');
return false;
}
@ -607,7 +607,7 @@ class Inline
case 0 === strncmp($scalar, '!php/const', 10):
if (self::$constantSupport) {
if (!isset($scalar[11])) {
@trigger_error('Using the !php/const tag without a value is deprecated since Symfony 5.1.', E_USER_DEPRECATED);
trigger_deprecation('symfony/yaml', '5.1', 'Using the !php/const tag without a value is deprecated.');
return '';
}

View File

@ -743,7 +743,7 @@ class InlineTest extends TestCase
*
* @group legacy
*
* @expectedDeprecation Using the !php/object tag without a value is deprecated since Symfony 5.1.
* @expectedDeprecation Since symfony/yaml 5.1: Using the !php/object tag without a value is deprecated.
*/
public function testPhpObjectWithEmptyValue($expected, $value)
{
@ -767,7 +767,7 @@ class InlineTest extends TestCase
*
* @group legacy
*
* @expectedDeprecation Using the !php/const tag without a value is deprecated since Symfony 5.1.
* @expectedDeprecation Since symfony/yaml 5.1: Using the !php/const tag without a value is deprecated.
*/
public function testPhpConstTagWithEmptyValue($expected, $value)
{

View File

@ -17,6 +17,7 @@
],
"require": {
"php": "^7.2.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/polyfill-ctype": "~1.8"
},
"require-dev": {