function Alias::setDeprecated
Same name in this branch
- 11.1.x vendor/symfony/routing/Alias.php \Symfony\Component\Routing\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/ dependency-injection/ Alias.php, line 68
Class
Namespace
Symfony\Component\DependencyInjectionCode
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 ?: self::DEFAULT_DEPRECATION_TEMPLATE,
];
return $this;
}