DeprecateTrait.php 892 B

123456789101112131415161718192021222324252627282930313233
  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\DependencyInjection\Loader\Configurator\Traits;
  11. use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  12. trait DeprecateTrait
  13. {
  14. /**
  15. * Whether this definition is deprecated, that means it should not be called anymore.
  16. *
  17. * @param string $template Template message to use if the definition is deprecated
  18. *
  19. * @return $this
  20. *
  21. * @throws InvalidArgumentException when the message template is invalid
  22. */
  23. final public function deprecate(string $template = null): self
  24. {
  25. $this->definition->setDeprecated(true, $template);
  26. return $this;
  27. }
  28. }