diff --git a/src/Resources/skeleton/serializer/Normalizer.tpl.php b/src/Resources/skeleton/serializer/Normalizer.tpl.php index d29478389..ae315454e 100644 --- a/src/Resources/skeleton/serializer/Normalizer.tpl.php +++ b/src/Resources/skeleton/serializer/Normalizer.tpl.php @@ -15,7 +15,7 @@ public function __construct(ObjectNormalizer $normalizer) $this->normalizer = $normalizer; } - public function normalize($object, $format = null, array $context = array()): array + public function normalize($object, $format = null, array $context = []): array { $data = $this->normalizer->normalize($object, $format, $context); @@ -26,7 +26,7 @@ public function normalize($object, $format = null, array $context = array()): ar public function supportsNormalization($data, $format = null): bool { - return $data instanceof \App\Entity\BlogPost; + return $data instanceof \App\Entity\; } diff --git a/tests/Maker/MakeSerializerNormalizerTest.php b/tests/Maker/MakeSerializerNormalizerTest.php new file mode 100644 index 000000000..c39cfb55d --- /dev/null +++ b/tests/Maker/MakeSerializerNormalizerTest.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\MakerBundle\Tests\Maker; + +use Symfony\Bundle\MakerBundle\Maker\MakeSerializerNormalizer; +use Symfony\Bundle\MakerBundle\Test\MakerTestCase; +use Symfony\Bundle\MakerBundle\Test\MakerTestDetails; + +class MakeSerializerNormalizerTest extends MakerTestCase +{ + public function getTestDetails() + { + yield 'serializer_normalizer' => [MakerTestDetails::createTest( + $this->getMakerInstance(MakeSerializerNormalizer::class), + [ + // normalizer class name + 'FooBarNormalizer', + ]), + ]; + } +}