Skip to content

Commit de9c37f

Browse files
author
Misley Márton
committed
Fix symfony 6.1 deprecations
- Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute - NormalizerInterface::supportsNormalization() method will require a new "array $context" argument, not defining it is deprecated.
1 parent 396b071 commit de9c37f

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

Command/DumpCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use FOS\JsRoutingBundle\Extractor\ExposedRoutesExtractorInterface;
1717
use FOS\JsRoutingBundle\Response\RoutesResponse;
18+
use Symfony\Component\Console\Attribute\AsCommand;
1819
use Symfony\Component\Console\Command\Command;
1920
use Symfony\Component\Console\Input\InputInterface;
2021
use Symfony\Component\Console\Input\InputOption;
@@ -26,10 +27,9 @@
2627
*
2728
* @author Benjamin Dulau <[email protected]>
2829
*/
30+
#[AsCommand('fos:js-routing:dump', 'Dumps exposed routes to the filesystem')]
2931
class DumpCommand extends Command
3032
{
31-
protected static $defaultName = 'fos:js-routing:dump';
32-
3333
public function __construct(private ExposedRoutesExtractorInterface $extractor, private SerializerInterface $serializer, private string $projectDir, private ?string $requestContextBaseUrl = null)
3434
{
3535
parent::__construct();

Command/RouterDebugExposedCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use FOS\JsRoutingBundle\Extractor\ExposedRoutesExtractorInterface;
1717
use Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper;
18+
use Symfony\Component\Console\Attribute\AsCommand;
1819
use Symfony\Component\Console\Command\Command;
1920
use Symfony\Component\Console\Input\InputArgument;
2021
use Symfony\Component\Console\Input\InputInterface;
@@ -29,10 +30,9 @@
2930
*
3031
* @author William DURAND <[email protected]>
3132
*/
33+
#[AsCommand('fos:js-routing:debug', 'Displays currently exposed routes for an application')]
3234
class RouterDebugExposedCommand extends Command
3335
{
34-
protected static $defaultName = 'fos:js-routing:debug';
35-
3636
public function __construct(private ExposedRoutesExtractorInterface $extractor, private RouterInterface $router)
3737
{
3838
parent::__construct();

Serializer/Denormalizer/RouteCollectionDenormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
4545
/**
4646
* {@inheritDoc}
4747
*/
48-
public function supportsDenormalization(mixed $data, string $type, string $format = null): bool
48+
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
4949
{
5050
if (!is_array($data)) {
5151
return false;

Serializer/Normalizer/RouteCollectionNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function normalize(mixed $object, string $format = null, array $context =
4747
/**
4848
* {@inheritDoc}
4949
*/
50-
public function supportsNormalization(mixed $data, string $format = null): bool
50+
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
5151
{
5252
return $data instanceof RouteCollection;
5353
}

Serializer/Normalizer/RoutesResponseNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function normalize(mixed $object, string $format = null, array $context =
4040
/**
4141
* {@inheritDoc}
4242
*/
43-
public function supportsNormalization(mixed $data, string $format = null): bool
43+
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
4444
{
4545
return $data instanceof RoutesResponse;
4646
}

0 commit comments

Comments
 (0)