function Alias::setDeprecated
Same name in this branch
- 11.1.x vendor/symfony/dependency-injection/Alias.php \Symfony\Component\DependencyInjection\Alias::setDeprecated()
Whether this alias is deprecated, that means it should not be referenced anymore.
Parameters
string $package The name of the composer package that is triggering the deprecation:
string $version The version of the package that introduced the deprecation:
string $message The deprecation message to use:
Return value
$this
Throws
InvalidArgumentException when the message template is invalid
File
-
vendor/
symfony/ routing/ Alias.php, line 55
Class
Namespace
Symfony\Component\RoutingCode
public function setDeprecated(string $package, string $version, string $message) : static {
if ('' !== $message) {
if (preg_match('#[\\r\\n]|\\*/#', $message)) {
throw new InvalidArgumentException('Invalid characters found in deprecation template.');
}
if (!str_contains($message, '%alias_id%')) {
throw new InvalidArgumentException('The deprecation template must contain the "%alias_id%" placeholder.');
}
}
$this->deprecation = [
'package' => $package,
'version' => $version,
'message' => $message ?: 'The "%alias_id%" route alias is deprecated. You should stop using it, as it will be removed in the future.',
];
return $this;
}