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
4 changes: 2 additions & 2 deletions src/Resources/skeleton/serializer/Normalizer.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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\<?= str_replace('Normalizer', null, $class_name) ?>;
}
<?php if ($cacheable_interface): ?>

Expand Down
30 changes: 30 additions & 0 deletions tests/Maker/MakeSerializerNormalizerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/*
* This file is part of the Symfony MakerBundle package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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',
]),
];
}
}