Aggiornato Composer
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 = null, FragmentRendererInterface $inlineStrategy, UriSigner $signer = null)
|
||||
public function __construct(?SurrogateInterface $surrogate, FragmentRendererInterface $inlineStrategy, ?UriSigner $signer = null)
|
||||
{
|
||||
$this->surrogate = $surrogate;
|
||||
$this->inlineStrategy = $inlineStrategy;
|
||||
@@ -89,9 +89,11 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere
|
||||
private function containsNonScalars(array $values): bool
|
||||
{
|
||||
foreach ($values as $value) {
|
||||
if (\is_array($value)) {
|
||||
return $this->containsNonScalars($value);
|
||||
} elseif (!is_scalar($value) && null !== $value) {
|
||||
if (\is_scalar($value) || null === $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!\is_array($value) || $this->containsNonScalars($value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ final class FragmentUriGenerator implements FragmentUriGeneratorInterface
|
||||
private $signer;
|
||||
private $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;
|
||||
@@ -38,7 +38,7 @@ final class FragmentUriGenerator implements FragmentUriGeneratorInterface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
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.');
|
||||
@@ -85,7 +85,7 @@ final class FragmentUriGenerator implements FragmentUriGeneratorInterface
|
||||
foreach ($values as $key => $value) {
|
||||
if (\is_array($value)) {
|
||||
$this->checkNonScalar($value);
|
||||
} elseif (!is_scalar($value) && null !== $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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
||||
private $charset;
|
||||
|
||||
/**
|
||||
* @param string $globalDefaultTemplate The global default content (it can be a template name or the content)
|
||||
* @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;
|
||||
|
||||
@@ -30,7 +30,7 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer
|
||||
private $kernel;
|
||||
private $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