mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 14:58:43 +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:
@@ -34,7 +34,7 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere
|
||||
*
|
||||
* @param FragmentRendererInterface $inlineStrategy The inline strategy to use when the surrogate is not supported
|
||||
*/
|
||||
public function __construct(?SurrogateInterface $surrogate, FragmentRendererInterface $inlineStrategy, UriSigner $signer = null)
|
||||
public function __construct(?SurrogateInterface $surrogate, FragmentRendererInterface $inlineStrategy, ?UriSigner $signer = null)
|
||||
{
|
||||
$this->surrogate = $surrogate;
|
||||
$this->inlineStrategy = $inlineStrategy;
|
||||
|
||||
@@ -73,7 +73,7 @@ class FragmentHandler
|
||||
}
|
||||
|
||||
if (!isset($this->renderers[$renderer])) {
|
||||
throw new \InvalidArgumentException(sprintf('The "%s" renderer does not exist.', $renderer));
|
||||
throw new \InvalidArgumentException(\sprintf('The "%s" renderer does not exist.', $renderer));
|
||||
}
|
||||
|
||||
if (!$request = $this->requestStack->getCurrentRequest()) {
|
||||
@@ -97,7 +97,7 @@ class FragmentHandler
|
||||
{
|
||||
if (!$response->isSuccessful()) {
|
||||
$responseStatusCode = $response->getStatusCode();
|
||||
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %d).', $this->requestStack->getCurrentRequest()->getUri(), $responseStatusCode), 0, new HttpException($responseStatusCode));
|
||||
throw new \RuntimeException(\sprintf('Error when rendering "%s" (Status code is %d).', $this->requestStack->getCurrentRequest()->getUri(), $responseStatusCode), 0, new HttpException($responseStatusCode));
|
||||
}
|
||||
|
||||
if (!$response instanceof StreamedResponse) {
|
||||
|
||||
@@ -28,14 +28,14 @@ final class FragmentUriGenerator implements FragmentUriGeneratorInterface
|
||||
private ?UriSigner $signer;
|
||||
private ?RequestStack $requestStack;
|
||||
|
||||
public function __construct(string $fragmentPath, UriSigner $signer = null, RequestStack $requestStack = null)
|
||||
public function __construct(string $fragmentPath, ?UriSigner $signer = null, ?RequestStack $requestStack = null)
|
||||
{
|
||||
$this->fragmentPath = $fragmentPath;
|
||||
$this->signer = $signer;
|
||||
$this->requestStack = $requestStack;
|
||||
}
|
||||
|
||||
public function generate(ControllerReference $controller, Request $request = null, bool $absolute = false, bool $strict = true, bool $sign = true): string
|
||||
public function generate(ControllerReference $controller, ?Request $request = null, bool $absolute = false, bool $strict = true, bool $sign = true): string
|
||||
{
|
||||
if (null === $request && (null === $this->requestStack || null === $request = $this->requestStack->getCurrentRequest())) {
|
||||
throw new \LogicException('Generating a fragment URL can only be done when handling a Request.');
|
||||
@@ -83,7 +83,7 @@ final class FragmentUriGenerator implements FragmentUriGeneratorInterface
|
||||
if (\is_array($value)) {
|
||||
$this->checkNonScalar($value);
|
||||
} elseif (!\is_scalar($value) && null !== $value) {
|
||||
throw new \LogicException(sprintf('Controller attributes cannot contain non-scalar/non-null values (value for key "%s" is not a scalar or null).', $key));
|
||||
throw new \LogicException(\sprintf('Controller attributes cannot contain non-scalar/non-null values (value for key "%s" is not a scalar or null).', $key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,5 @@ interface FragmentUriGeneratorInterface
|
||||
* @param bool $strict Whether to allow non-scalar attributes or not
|
||||
* @param bool $sign Whether to sign the URL or not
|
||||
*/
|
||||
public function generate(ControllerReference $controller, Request $request = null, bool $absolute = false, bool $strict = true, bool $sign = true): string;
|
||||
public function generate(ControllerReference $controller, ?Request $request = null, bool $absolute = false, bool $strict = true, bool $sign = true): string;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
||||
/**
|
||||
* @param string|null $globalDefaultTemplate The global default content (it can be a template name or the content)
|
||||
*/
|
||||
public function __construct(Environment $twig = null, UriSigner $signer = null, string $globalDefaultTemplate = null, string $charset = 'utf-8')
|
||||
public function __construct(?Environment $twig = null, ?UriSigner $signer = null, ?string $globalDefaultTemplate = null, string $charset = 'utf-8')
|
||||
{
|
||||
$this->twig = $twig;
|
||||
$this->globalDefaultTemplate = $globalDefaultTemplate;
|
||||
@@ -79,7 +79,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
||||
if (\count($attributes) > 0) {
|
||||
$flags = \ENT_QUOTES | \ENT_SUBSTITUTE;
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
$renderedAttributes .= sprintf(
|
||||
$renderedAttributes .= \sprintf(
|
||||
' %s="%s"',
|
||||
htmlspecialchars($attribute, $flags, $this->charset, false),
|
||||
htmlspecialchars($value, $flags, $this->charset, false)
|
||||
@@ -87,7 +87,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
||||
}
|
||||
}
|
||||
|
||||
return new Response(sprintf('<hx:include src="%s"%s>%s</hx:include>', $uri, $renderedAttributes, $content));
|
||||
return new Response(\sprintf('<hx:include src="%s"%s>%s</hx:include>', $uri, $renderedAttributes, $content));
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
|
||||
@@ -30,7 +30,7 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer
|
||||
private HttpKernelInterface $kernel;
|
||||
private ?EventDispatcherInterface $dispatcher;
|
||||
|
||||
public function __construct(HttpKernelInterface $kernel, EventDispatcherInterface $dispatcher = null)
|
||||
public function __construct(HttpKernelInterface $kernel, ?EventDispatcherInterface $dispatcher = null)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
$this->dispatcher = $dispatcher;
|
||||
|
||||
Reference in New Issue
Block a user