Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DependencyInjection] Turn $defaultDeprecationTemplate into a constant #41933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Symfony/Component/DependencyInjection/Alias.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

class Alias
{
private const DEFAULT_DEPRECATION_TEMPLATE = 'The "%alias_id%" service alias is deprecated. You should stop using it, as it will be removed in the future.';

private $id;
private $public;
private $private;
private $deprecated;
private $deprecationTemplate;

private static $defaultDeprecationTemplate = 'The "%alias_id%" service alias is deprecated. You should stop using it, as it will be removed in the future.';

public function __construct(string $id, bool $public = true)
{
$this->id = $id;
Expand Down Expand Up @@ -122,7 +122,7 @@ public function isDeprecated(): bool

public function getDeprecationMessage(string $id): string
{
return str_replace('%alias_id%', $id, $this->deprecationTemplate ?: self::$defaultDeprecationTemplate);
return str_replace('%alias_id%', $id, $this->deprecationTemplate ?: self::DEFAULT_DEPRECATION_TEMPLATE);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/DependencyInjection/Definition.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
*/
class Definition
{
private const DEFAULT_DEPRECATION_TEMPLATE = 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.';

private $class;
private $file;
private $factory;
Expand All @@ -47,8 +49,6 @@ class Definition

protected $arguments = [];

private static $defaultDeprecationTemplate = 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.';

/**
* @internal
*
Expand Down Expand Up @@ -799,7 +799,7 @@ public function isDeprecated()
*/
public function getDeprecationMessage($id)
{
return str_replace('%service_id%', $id, $this->deprecationTemplate ?: self::$defaultDeprecationTemplate);
return str_replace('%service_id%', $id, $this->deprecationTemplate ?: self::DEFAULT_DEPRECATION_TEMPLATE);
}

/**
Expand Down