diff --git a/code_samples/back_office/images/src/SvgExtension.php b/code_samples/back_office/images/src/SvgExtension.php index de6826d22ff..351661e476c 100644 --- a/code_samples/back_office/images/src/SvgExtension.php +++ b/code_samples/back_office/images/src/SvgExtension.php @@ -5,10 +5,9 @@ namespace App\Twig; use Symfony\Component\Routing\RouterInterface; -use Twig\Extension\AbstractExtension; -use Twig\TwigFunction; +use Twig\Attribute\AsTwigFunction; -class SvgExtension extends AbstractExtension +class SvgExtension { /** * SvgExtension constructor. @@ -17,17 +16,7 @@ public function __construct(protected RouterInterface $router) { } - /** - * @return \Twig\TwigFunction[] - */ - #[\Override] - public function getFunctions(): array - { - return [ - new TwigFunction('ibexa_svg_link', $this->generateLink(...)), - ]; - } - + #[AsTwigFunction(name: 'ibexa_svg_link')] public function generateLink(int $contentId, string $fieldIdentifier, string $filename): string { return $this->router->generate('app.svg_download', [ diff --git a/docs/update_and_migration/from_4.6/update_to_5.0.md b/docs/update_and_migration/from_4.6/update_to_5.0.md index 9217395f37e..7d601806881 100644 --- a/docs/update_and_migration/from_4.6/update_to_5.0.md +++ b/docs/update_and_migration/from_4.6/update_to_5.0.md @@ -470,7 +470,6 @@ As this update spans across a broad range of versions, multiple rules can be con //… use Ibexa\Contracts\Rector\Sets\IbexaSetList; use Rector\Config\RectorConfig; -use Rector\Symfony\Set\SensiolabsSetList; use Rector\Symfony\Set\SymfonySetList; return RectorConfig::configure() @@ -489,7 +488,6 @@ return RectorConfig::configure() SymfonySetList::SYMFONY_72, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-symfonysymfony-72 SymfonySetList::SYMFONY_73, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-symfonysymfony-73 SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES, - SensiolabsSetList::ANNOTATIONS_TO_ATTRIBUTES, ] ) ->withPhpSets() @@ -504,7 +502,6 @@ return RectorConfig::configure() naming: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-naming instanceOf: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-instanceof earlyReturn: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-early-return - strictBooleans: true, // https://getrector.com/find-rule?activeRectorSetGroup=core&rectorSet=core-strict-booleans rectorPreset: true, symfonyCodeQuality: true, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-code-quality symfonyConfigs: true, // https://getrector.com/find-rule?activeRectorSetGroup=symfony&rectorSet=symfony-configs diff --git a/rector.php b/rector.php index 091043e174c..fb17a9d1d89 100644 --- a/rector.php +++ b/rector.php @@ -25,4 +25,6 @@ SymfonySetList::SYMFONY_70, SymfonySetList::SYMFONY_71, SymfonySetList::SYMFONY_72, + SymfonySetList::SYMFONY_73, + SymfonySetList::SYMFONY_74, ]);