Skip to content

Fix PHP 8.4 deprecation notices #489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading