Skip to content

Commit

Permalink
Split ProblemExceptionNormalizer forward-compatibilityinto separate f…
Browse files Browse the repository at this point in the history
…ile to be PHP 7.4 compatible
  • Loading branch information
niels-nijens committed Apr 9, 2024
1 parent 2d40bee commit f06c4aa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace Nijens\OpenapiBundle\ExceptionHandling\Normalizer;

use ArrayObject;
use Nijens\OpenapiBundle\NijensOpenapiBundle;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;

Expand All @@ -34,11 +33,5 @@ public function normalize($object, $format = null, array $context = [])
}
}
} else {
final class ProblemExceptionNormalizer extends AbstractProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface
{
public function normalize($object, $format = null, array $context = []): float|int|bool|ArrayObject|array|string|null
{
return $this->doNormalize($object, $format, $context);
}
}
require_once __DIR__.'/ProblemExceptionNormalizer.php8';
}
30 changes: 30 additions & 0 deletions src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php8
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

/*
* This file is part of the OpenapiBundle package.
*
* (c) Niels Nijens <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nijens\OpenapiBundle\ExceptionHandling\Normalizer;

use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;

/**
* Normalizes a {@see Throwable} implementing the {@see ProblemExceptionInterface}.
*
* @author Niels Nijens <[email protected]>
*/
final class ProblemExceptionNormalizer extends AbstractProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface
{
public function normalize($object, $format = null, array $context = []): float|int|bool|ArrayObject|array|string|null
{
return $this->doNormalize($object, $format, $context);
}
}

0 comments on commit f06c4aa

Please sign in to comment.