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