mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-20 09:08:42 +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:
@@ -57,7 +57,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
private ArgumentResolverInterface $argumentResolver;
|
||||
private bool $handleAllThrowables;
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, RequestStack $requestStack = null, ArgumentResolverInterface $argumentResolver = null, bool $handleAllThrowables = false)
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, ?RequestStack $requestStack = null, ?ArgumentResolverInterface $argumentResolver = null, bool $handleAllThrowables = false)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->resolver = $resolver;
|
||||
@@ -118,7 +118,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function terminateWithException(\Throwable $exception, Request $request = null): void
|
||||
public function terminateWithException(\Throwable $exception, ?Request $request = null): void
|
||||
{
|
||||
if (!$request ??= $this->requestStack->getMainRequest()) {
|
||||
throw $exception;
|
||||
@@ -162,7 +162,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
|
||||
// load controller
|
||||
if (false === $controller = $this->resolver->getController($request)) {
|
||||
throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". The route is wrongly configured.', $request->getPathInfo()));
|
||||
throw new NotFoundHttpException(\sprintf('Unable to find the controller for path "%s". The route is wrongly configured.', $request->getPathInfo()));
|
||||
}
|
||||
|
||||
$event = new ControllerEvent($this, $controller, $request, $type);
|
||||
@@ -188,7 +188,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
if ($event->hasResponse()) {
|
||||
$response = $event->getResponse();
|
||||
} else {
|
||||
$msg = sprintf('The controller must return a "Symfony\Component\HttpFoundation\Response" object but it returned %s.', $this->varToString($response));
|
||||
$msg = \sprintf('The controller must return a "Symfony\Component\HttpFoundation\Response" object but it returned %s.', $this->varToString($response));
|
||||
|
||||
// the user may have forgotten to return something
|
||||
if (null === $response) {
|
||||
@@ -278,20 +278,20 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
private function varToString(mixed $var): string
|
||||
{
|
||||
if (\is_object($var)) {
|
||||
return sprintf('an object of type %s', $var::class);
|
||||
return \sprintf('an object of type %s', $var::class);
|
||||
}
|
||||
|
||||
if (\is_array($var)) {
|
||||
$a = [];
|
||||
foreach ($var as $k => $v) {
|
||||
$a[] = sprintf('%s => ...', $k);
|
||||
$a[] = \sprintf('%s => ...', $k);
|
||||
}
|
||||
|
||||
return sprintf('an array ([%s])', mb_substr(implode(', ', $a), 0, 255));
|
||||
return \sprintf('an array ([%s])', mb_substr(implode(', ', $a), 0, 255));
|
||||
}
|
||||
|
||||
if (\is_resource($var)) {
|
||||
return sprintf('a resource (%s)', get_resource_type($var));
|
||||
return \sprintf('a resource (%s)', get_resource_type($var));
|
||||
}
|
||||
|
||||
if (null === $var) {
|
||||
@@ -307,11 +307,11 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
}
|
||||
|
||||
if (\is_string($var)) {
|
||||
return sprintf('a string ("%s%s")', mb_substr($var, 0, 255), mb_strlen($var) > 255 ? '...' : '');
|
||||
return \sprintf('a string ("%s%s")', mb_substr($var, 0, 255), mb_strlen($var) > 255 ? '...' : '');
|
||||
}
|
||||
|
||||
if (is_numeric($var)) {
|
||||
return sprintf('a number (%s)', (string) $var);
|
||||
return \sprintf('a number (%s)', (string) $var);
|
||||
}
|
||||
|
||||
return (string) $var;
|
||||
|
||||
Reference in New Issue
Block a user