mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 23:32:17 +02:00
N°8834 - Add compatibility with PHP 8.4 (#819)
* N°8834 - Add compatibility with PHP 8.4 * Rollback of scssphp/scssphp version upgrade due to compilation error
This commit is contained in:
@@ -19,13 +19,11 @@ class AutowiringFailedException extends RuntimeException
|
||||
private string $serviceId;
|
||||
private ?\Closure $messageCallback = null;
|
||||
|
||||
public function __construct(string $serviceId, string|\Closure $message = '', int $code = 0, \Throwable $previous = null)
|
||||
public function __construct(string $serviceId, string|\Closure $message = '', int $code = 0, ?\Throwable $previous = null)
|
||||
{
|
||||
$this->serviceId = $serviceId;
|
||||
|
||||
if ($message instanceof \Closure
|
||||
&& (\function_exists('xdebug_is_enabled') ? xdebug_is_enabled() : \function_exists('xdebug_info'))
|
||||
) {
|
||||
if ($message instanceof \Closure && \function_exists('xdebug_is_enabled') && xdebug_is_enabled()) {
|
||||
$message = $message();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace Symfony\Component\DependencyInjection\Exception;
|
||||
*/
|
||||
class EnvParameterException extends InvalidArgumentException
|
||||
{
|
||||
public function __construct(array $envs, \Throwable $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.')
|
||||
public function __construct(array $envs, ?\Throwable $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.')
|
||||
{
|
||||
parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous);
|
||||
parent::__construct(\sprintf($message, implode('", "', $envs)), 0, $previous);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ class InvalidParameterTypeException extends InvalidArgumentException
|
||||
|
||||
$function = $parameter->getDeclaringFunction();
|
||||
$functionName = $function instanceof \ReflectionMethod
|
||||
? sprintf('%s::%s', $function->getDeclaringClass()->getName(), $function->getName())
|
||||
? \sprintf('%s::%s', $function->getDeclaringClass()->getName(), $function->getName())
|
||||
: $function->getName();
|
||||
|
||||
parent::__construct(sprintf('Invalid definition for service "%s": argument %d of "%s()" accepts "%s", "%s" passed.', $serviceId, 1 + $parameter->getPosition(), $functionName, $acceptedType, $type));
|
||||
parent::__construct(\sprintf('Invalid definition for service "%s": argument %d of "%s()" accepts "%s", "%s" passed.', $serviceId, 1 + $parameter->getPosition(), $functionName, $acceptedType, $type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ class ParameterCircularReferenceException extends RuntimeException
|
||||
{
|
||||
private array $parameters;
|
||||
|
||||
public function __construct(array $parameters, \Throwable $previous = null)
|
||||
public function __construct(array $parameters, ?\Throwable $previous = null)
|
||||
{
|
||||
parent::__construct(sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]), 0, $previous);
|
||||
parent::__construct(\sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]), 0, $previous);
|
||||
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class ParameterNotFoundException extends InvalidArgumentException implements Not
|
||||
* @param string[] $alternatives Some parameter name alternatives
|
||||
* @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters
|
||||
*/
|
||||
public function __construct(string $key, string $sourceId = null, string $sourceKey = null, \Throwable $previous = null, array $alternatives = [], string $nonNestedAlternative = null)
|
||||
public function __construct(string $key, ?string $sourceId = null, ?string $sourceKey = null, ?\Throwable $previous = null, array $alternatives = [], ?string $nonNestedAlternative = null)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->sourceId = $sourceId;
|
||||
@@ -53,13 +53,13 @@ class ParameterNotFoundException extends InvalidArgumentException implements Not
|
||||
public function updateRepr()
|
||||
{
|
||||
if (null !== $this->sourceId) {
|
||||
$this->message = sprintf('The service "%s" has a dependency on a non-existent parameter "%s".', $this->sourceId, $this->key);
|
||||
$this->message = \sprintf('The service "%s" has a dependency on a non-existent parameter "%s".', $this->sourceId, $this->key);
|
||||
} elseif (null !== $this->sourceKey) {
|
||||
$this->message = sprintf('The parameter "%s" has a dependency on a non-existent parameter "%s".', $this->sourceKey, $this->key);
|
||||
$this->message = \sprintf('The parameter "%s" has a dependency on a non-existent parameter "%s".', $this->sourceKey, $this->key);
|
||||
} elseif ('.' === ($this->key[0] ?? '')) {
|
||||
$this->message = sprintf('Parameter "%s" not found. It was probably deleted during the compilation of the container.', $this->key);
|
||||
$this->message = \sprintf('Parameter "%s" not found. It was probably deleted during the compilation of the container.', $this->key);
|
||||
} else {
|
||||
$this->message = sprintf('You have requested a non-existent parameter "%s".', $this->key);
|
||||
$this->message = \sprintf('You have requested a non-existent parameter "%s".', $this->key);
|
||||
}
|
||||
|
||||
if ($this->alternatives) {
|
||||
|
||||
@@ -21,9 +21,9 @@ class ServiceCircularReferenceException extends RuntimeException
|
||||
private string $serviceId;
|
||||
private array $path;
|
||||
|
||||
public function __construct(string $serviceId, array $path, \Throwable $previous = null)
|
||||
public function __construct(string $serviceId, array $path, ?\Throwable $previous = null)
|
||||
{
|
||||
parent::__construct(sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)), 0, $previous);
|
||||
parent::__construct(\sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)), 0, $previous);
|
||||
|
||||
$this->serviceId = $serviceId;
|
||||
$this->path = $path;
|
||||
|
||||
@@ -24,14 +24,14 @@ class ServiceNotFoundException extends InvalidArgumentException implements NotFo
|
||||
private ?string $sourceId;
|
||||
private array $alternatives;
|
||||
|
||||
public function __construct(string $id, string $sourceId = null, \Throwable $previous = null, array $alternatives = [], string $msg = null)
|
||||
public function __construct(string $id, ?string $sourceId = null, ?\Throwable $previous = null, array $alternatives = [], ?string $msg = null)
|
||||
{
|
||||
if (null !== $msg) {
|
||||
// no-op
|
||||
} elseif (null === $sourceId) {
|
||||
$msg = sprintf('You have requested a non-existent service "%s".', $id);
|
||||
$msg = \sprintf('You have requested a non-existent service "%s".', $id);
|
||||
} else {
|
||||
$msg = sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id);
|
||||
$msg = \sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id);
|
||||
}
|
||||
|
||||
if ($alternatives) {
|
||||
|
||||
Reference in New Issue
Block a user