mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 06:48:50 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -17,9 +17,9 @@ 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 $deprecation = [];
|
||||
private string $id;
|
||||
private bool $public;
|
||||
private array $deprecation = [];
|
||||
|
||||
public function __construct(string $id, bool $public = false)
|
||||
{
|
||||
@@ -29,10 +29,8 @@ class Alias
|
||||
|
||||
/**
|
||||
* Checks if this DI Alias should be public or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPublic()
|
||||
public function isPublic(): bool
|
||||
{
|
||||
return $this->public;
|
||||
}
|
||||
@@ -42,33 +40,17 @@ class Alias
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPublic(bool $boolean)
|
||||
public function setPublic(bool $boolean): static
|
||||
{
|
||||
$this->public = $boolean;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if this Alias is private.
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since Symfony 5.2, use setPublic() instead
|
||||
*/
|
||||
public function setPrivate(bool $boolean)
|
||||
{
|
||||
trigger_deprecation('symfony/dependency-injection', '5.2', 'The "%s()" method is deprecated, use "setPublic()" instead.', __METHOD__);
|
||||
|
||||
return $this->setPublic(!$boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this alias is private.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPrivate()
|
||||
public function isPrivate(): bool
|
||||
{
|
||||
return !$this->public;
|
||||
}
|
||||
@@ -85,28 +67,8 @@ class Alias
|
||||
*
|
||||
* @throws InvalidArgumentException when the message template is invalid
|
||||
*/
|
||||
public function setDeprecated(/* string $package, string $version, string $message */)
|
||||
public function setDeprecated(string $package, string $version, string $message): static
|
||||
{
|
||||
$args = \func_get_args();
|
||||
|
||||
if (\func_num_args() < 3) {
|
||||
trigger_deprecation('symfony/dependency-injection', '5.1', 'The signature of method "%s()" requires 3 arguments: "string $package, string $version, string $message", not defining them is deprecated.', __METHOD__);
|
||||
|
||||
$status = $args[0] ?? true;
|
||||
|
||||
if (!$status) {
|
||||
trigger_deprecation('symfony/dependency-injection', '5.1', 'Passing a null message to un-deprecate a node is deprecated.');
|
||||
}
|
||||
|
||||
$message = (string) ($args[1] ?? null);
|
||||
$package = $version = '';
|
||||
} else {
|
||||
$status = true;
|
||||
$package = (string) $args[0];
|
||||
$version = (string) $args[1];
|
||||
$message = (string) $args[2];
|
||||
}
|
||||
|
||||
if ('' !== $message) {
|
||||
if (preg_match('#[\r\n]|\*/#', $message)) {
|
||||
throw new InvalidArgumentException('Invalid characters found in deprecation template.');
|
||||
@@ -117,7 +79,7 @@ class Alias
|
||||
}
|
||||
}
|
||||
|
||||
$this->deprecation = $status ? ['package' => $package, 'version' => $version, 'message' => $message ?: self::DEFAULT_DEPRECATION_TEMPLATE] : [];
|
||||
$this->deprecation = ['package' => $package, 'version' => $version, 'message' => $message ?: self::DEFAULT_DEPRECATION_TEMPLATE];
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -127,16 +89,6 @@ class Alias
|
||||
return (bool) $this->deprecation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 5.1, use "getDeprecation()" instead.
|
||||
*/
|
||||
public function getDeprecationMessage(string $id): string
|
||||
{
|
||||
trigger_deprecation('symfony/dependency-injection', '5.1', 'The "%s()" method is deprecated, use "getDeprecation()" instead.', __METHOD__);
|
||||
|
||||
return $this->getDeprecation($id)['message'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id Service id relying on this definition
|
||||
*/
|
||||
@@ -149,12 +101,7 @@ class Alias
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Id of this alias.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user