AliasConfigurator.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Routing\Loader\Configurator;
  11. use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  12. use Symfony\Component\Routing\Alias;
  13. class AliasConfigurator
  14. {
  15. private $alias;
  16. public function __construct(Alias $alias)
  17. {
  18. $this->alias = $alias;
  19. }
  20. /**
  21. * Whether this alias is deprecated, that means it should not be called anymore.
  22. *
  23. * @param string $package The name of the composer package that is triggering the deprecation
  24. * @param string $version The version of the package that introduced the deprecation
  25. * @param string $message The deprecation message to use
  26. *
  27. * @return $this
  28. *
  29. * @throws InvalidArgumentException when the message template is invalid
  30. */
  31. public function deprecate(string $package, string $version, string $message): self
  32. {
  33. $this->alias->setDeprecated($package, $version, $message);
  34. return $this;
  35. }
  36. }