Skip to content

Commit

Permalink
Fix PHP 8.4 deprecation notices
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlavtox authored and tobias-93 committed Nov 22, 2024
1 parent 571de55 commit 57ba412
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Extractor/ExposedRoutesExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function getScheme(): string
/**
* {@inheritDoc}
*/
public function getCachePath(string $locale = null): string
public function getCachePath(?string $locale = null): string
{
$cachePath = $this->cacheDir.DIRECTORY_SEPARATOR.'fosJsRouting';
if (!file_exists($cachePath)) {
Expand Down
2 changes: 1 addition & 1 deletion Response/RoutesResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RoutesResponse

public function __construct(
protected ?string $baseUrl = null,
RouteCollection $routes = null,
?RouteCollection $routes = null,
protected ?string $prefix = null,
protected ?string $host = null,
protected ?string $port = null,
Expand Down
4 changes: 2 additions & 2 deletions Serializer/Denormalizer/RouteCollectionDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RouteCollectionDenormalizer implements DenormalizerInterface
/**
* {@inheritDoc}
*/
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): RouteCollection
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): RouteCollection
{
$collection = new RouteCollection();

Expand All @@ -45,7 +45,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
/**
* {@inheritDoc}
*/
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
if (!is_array($data)) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions Serializer/Normalizer/RouteCollectionNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class RouteCollectionNormalizer implements NormalizerInterface
/**
* {@inheritDoc}
*/
public function normalize(mixed $object, string $format = null, array $context = []): array
public function normalize(mixed $object, ?string $format = null, array $context = []): array
{
$collection = [];

Expand All @@ -47,7 +47,7 @@ public function normalize(mixed $object, string $format = null, array $context =
/**
* {@inheritDoc}
*/
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return $data instanceof RouteCollection;
}
Expand Down
4 changes: 2 additions & 2 deletions Serializer/Normalizer/RoutesResponseNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class RoutesResponseNormalizer implements NormalizerInterface
/**
* {@inheritDoc}
*/
public function normalize(mixed $object, string $format = null, array $context = []): array
public function normalize(mixed $object, ?string $format = null, array $context = []): array
{
return [
'base_url' => $object->getBaseUrl(),
Expand All @@ -40,7 +40,7 @@ public function normalize(mixed $object, string $format = null, array $context =
/**
* {@inheritDoc}
*/
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return $data instanceof RoutesResponse;
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Controller/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function testExposeDomain(): void
$this->assertEquals('{"base_url":"","routes":{"homepage":{"tokens":[["text","\/"]],"defaults":[],"requirements":[],"hosttokens":[],"methods":[],"schemes":[]},"admin_index":{"tokens":[["text","\/admin"]],"defaults":[],"requirements":[],"hosttokens":[],"methods":[],"schemes":[]},"admin_pages":{"tokens":[["text","\/admin\/path"]],"defaults":[],"requirements":[],"hosttokens":[],"methods":[],"schemes":[]},"blog_index":{"tokens":[["text","\/blog"]],"defaults":[],"requirements":[],"hosttokens":[["text","localhost"]],"methods":[],"schemes":[]},"blog_post":{"tokens":[["variable","\/","[^\/]++","slug"],["text","\/blog"]],"defaults":[],"requirements":[],"hosttokens":[["text","localhost"]],"methods":[],"schemes":[]}},"prefix":"","host":"","port":null,"scheme":"","locale":"en"}', $response->getContent());
}

private function getExtractor(RouteCollection $exposedRoutes = null, $baseUrl = '')
private function getExtractor(?RouteCollection $exposedRoutes = null, $baseUrl = '')
{
if (null === $exposedRoutes) {
$exposedRoutes = new RouteCollection();
Expand Down

0 comments on commit 57ba412

Please sign in to comment.