diff --git a/Form/Type/SiteType.php b/Form/Type/SiteType.php index 586bc98..f9ae88a 100644 --- a/Form/Type/SiteType.php +++ b/Form/Type/SiteType.php @@ -26,7 +26,7 @@ public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'choices' => $this->siteRepository->findAll(), - 'choice_label' => static function (SiteInterface $site = null) { + 'choice_label' => static function (?SiteInterface $site = null) { return (string) $site; }, 'choice_value' => 'id', diff --git a/Router/HostnameIdentifiedLoader.php b/Router/HostnameIdentifiedLoader.php index f7791b2..8003e13 100644 --- a/Router/HostnameIdentifiedLoader.php +++ b/Router/HostnameIdentifiedLoader.php @@ -30,7 +30,7 @@ public function __construct(IdentifierMappingInterface $identifierMapping) $this->identifierMapping = $identifierMapping; } - public function load($resource, string $type = null): RouteCollection + public function load($resource, ?string $type = null): RouteCollection { $this->resourceStack[] = $resource; @@ -52,7 +52,7 @@ public function load($resource, string $type = null): RouteCollection return $collection; } - public function supports($resource, string $type = null): bool + public function supports($resource, ?string $type = null): bool { return null === $type && !\in_array($resource, $this->resourceStack, true); } diff --git a/Router/PathIdentifiedUrlGenerator.php b/Router/PathIdentifiedUrlGenerator.php index 899060c..2411239 100644 --- a/Router/PathIdentifiedUrlGenerator.php +++ b/Router/PathIdentifiedUrlGenerator.php @@ -18,7 +18,7 @@ final class PathIdentifiedUrlGenerator implements UrlGeneratorInterface private $defaultIdentifier; private $urlGenerator; - public function __construct(UrlGeneratorInterface $urlGenerator, string $routeParameter = 'site', string $defaultIdentifier = null) + public function __construct(UrlGeneratorInterface $urlGenerator, string $routeParameter = 'site', ?string $defaultIdentifier = null) { $this->routeParameter = $routeParameter; $this->defaultIdentifier = $defaultIdentifier; diff --git a/Site/IdentifierMapping.php b/Site/IdentifierMapping.php index 7b1be03..7798ac3 100644 --- a/Site/IdentifierMapping.php +++ b/Site/IdentifierMapping.php @@ -39,7 +39,7 @@ public function findIdentifierByHostname(string $hostname): ?string return null; } - public function findHostnamesByIdentifier(string $identifier, string $locale = null): array + public function findHostnamesByIdentifier(string $identifier, ?string $locale = null): array { if (!isset($this->mapping[$identifier])) { return []; diff --git a/Site/IdentifierMappingInterface.php b/Site/IdentifierMappingInterface.php index eba8ad6..4be91c4 100644 --- a/Site/IdentifierMappingInterface.php +++ b/Site/IdentifierMappingInterface.php @@ -11,5 +11,5 @@ public function findIdentifierByHostname(string $hostname): ?string; /** * @return string[] */ - public function findHostnamesByIdentifier(string $identifier, string $locale = null): array; + public function findHostnamesByIdentifier(string $identifier, ?string $locale = null): array; } diff --git a/Site/PrefixedPathIdentifiedSiteResolver.php b/Site/PrefixedPathIdentifiedSiteResolver.php index d4bb518..2f2c98c 100644 --- a/Site/PrefixedPathIdentifiedSiteResolver.php +++ b/Site/PrefixedPathIdentifiedSiteResolver.php @@ -17,9 +17,8 @@ final class PrefixedPathIdentifiedSiteResolver implements SiteResolverInterface /** * @param string[] $identifiers - * @param string $defaultIdentifier */ - public function __construct(SiteRepositoryInterface $siteRepository, array $identifiers, string $defaultIdentifier = null) + public function __construct(SiteRepositoryInterface $siteRepository, array $identifiers, ?string $defaultIdentifier = null) { $this->siteRepository = $siteRepository; $this->defaultIdentifier = $defaultIdentifier; diff --git a/Tests/Site/IdentifierMappingTest.php b/Tests/Site/IdentifierMappingTest.php index 4b1b306..2568e45 100644 --- a/Tests/Site/IdentifierMappingTest.php +++ b/Tests/Site/IdentifierMappingTest.php @@ -47,7 +47,7 @@ protected function setUp(): void /** * @dataProvider identifierMappingData */ - public function testFindIdentifierByHostnameReturnsCorrectIdentifier(string $hostname, string $expectedIdentifier = null): void + public function testFindIdentifierByHostnameReturnsCorrectIdentifier(string $hostname, ?string $expectedIdentifier = null): void { $identifier = $this->identifierMapping->findIdentifierByHostname($hostname);