mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +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:
@@ -30,7 +30,7 @@ class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
|
||||
|
||||
private ?\Closure $getEnv;
|
||||
|
||||
public function __construct(callable $serviceCompiler = null, \Closure $getEnv = null)
|
||||
public function __construct(?callable $serviceCompiler = null, ?\Closure $getEnv = null)
|
||||
{
|
||||
$this->serviceCompiler = null === $serviceCompiler ? null : $serviceCompiler(...);
|
||||
$this->getEnv = $getEnv;
|
||||
@@ -39,19 +39,19 @@ class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
new ExpressionFunction('service', $this->serviceCompiler ?? fn ($arg) => sprintf('$container->get(%s)', $arg), fn (array $variables, $value) => $variables['container']->get($value)),
|
||||
new ExpressionFunction('service', $this->serviceCompiler ?? fn ($arg) => \sprintf('$container->get(%s)', $arg), fn (array $variables, $value) => $variables['container']->get($value)),
|
||||
|
||||
new ExpressionFunction('parameter', fn ($arg) => sprintf('$container->getParameter(%s)', $arg), fn (array $variables, $value) => $variables['container']->getParameter($value)),
|
||||
new ExpressionFunction('parameter', fn ($arg) => \sprintf('$container->getParameter(%s)', $arg), fn (array $variables, $value) => $variables['container']->getParameter($value)),
|
||||
|
||||
new ExpressionFunction('env', fn ($arg) => sprintf('$container->getEnv(%s)', $arg), function (array $variables, $value) {
|
||||
new ExpressionFunction('env', fn ($arg) => \sprintf('$container->getEnv(%s)', $arg), function (array $variables, $value) {
|
||||
if (!$this->getEnv) {
|
||||
throw new LogicException('You need to pass a getEnv closure to the expression langage provider to use the "env" function.');
|
||||
throw new LogicException('You need to pass a getEnv closure to the expression language provider to use the "env" function.');
|
||||
}
|
||||
|
||||
return ($this->getEnv)($value);
|
||||
}),
|
||||
|
||||
new ExpressionFunction('arg', fn ($arg) => sprintf('$args?->get(%s)', $arg), fn (array $variables, $value) => $variables['args']?->get($value)),
|
||||
new ExpressionFunction('arg', fn ($arg) => \sprintf('$args?->get(%s)', $arg), fn (array $variables, $value) => $variables['args']?->get($value)),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user