Skip to content
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: 2 additions & 0 deletions src/ServiceFactory/SlimServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
Expand All @@ -39,6 +40,7 @@ final class SlimServiceFactory implements ServiceFactory {
public function __invoke(ServicesBuilder $builder): iterable {
yield Serializer::class => static fn () => new Serializer([
new ArrayDenormalizer(),
new BackedEnumNormalizer(),
new ObjectNormalizer(
propertyTypeExtractor: new PropertyInfoExtractor(
typeExtractors: [
Expand Down
1 change: 1 addition & 0 deletions tests/Http/Serializer/DeserializeParameterResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function testDeserialize(): void {
'tag' => [
'name' => 'alpha',
],
'enum' => 'foo',
];
$get = [
'page' => 3,
Expand Down
9 changes: 9 additions & 0 deletions tests/Http/Serializer/SampleEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace WonderNetwork\SlimKernel\Http\Serializer;

enum SampleEnum: string {
case Foo = 'foo';
}
1 change: 1 addition & 0 deletions tests/Http/Serializer/SamplePostInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ final class SamplePostInput {
/** @var TagInput[] */
public array $tags;
public TagInput $tag;
public SampleEnum $enum;
}