Skip to content

Preparing for 4.4 BETA, got compile error about declaring methods with missing type hints #34345

@Beyonit

Description

@Beyonit

I got this error:

Compile Error: Declaration of Symfony\Component\Serializer\Normalizer\ProblemNormalizer::normalize($exception, $format = NULL, array $context = Array) must be compatible with Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize($object, ?string $format = NULL, array $context = Array)

In Normalizer/ProblemNormalizer.php. The methods don't use the type hints as defined in NormalizerInterface. This is what I changed and then it works:

public function normalize($exception, $format = null, array $context = [])
to
public function normalize($object, string $format = null, array $context = [])

and

public function supportsNormalization($data, $format = null): bool
to
public function supportsNormalization($data, string $format = null): bool

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions