AliasConfigurator.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. public function __construct(
  16. private Alias $alias,
  17. ) {
  18. }
  19. /**
  20. * Whether this alias is deprecated, that means it should not be called anymore.
  21. *
  22. * @param string $package The name of the composer package that is triggering the deprecation
  23. * @param string $version The version of the package that introduced the deprecation
  24. * @param string $message The deprecation message to use
  25. *
  26. * @return $this
  27. *
  28. * @throws InvalidArgumentException when the message template is invalid
  29. */
  30. public function deprecate(string $package, string $version, string $message): static
  31. {
  32. $this->alias->setDeprecated($package, $version, $message);
  33. return $this;
  34. }
  35. }