SerializerAttributeGetterToPropertyRector

Replace deprecated Serializer attribute getters with public properties

 use Symfony\Component\Serializer\Attribute\Groups;

 function run(Groups $groups)
 {
-    return $groups->getGroups();
+    return $groups->groups;
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony80\Rector\MethodCall\SerializerAttributeGetterToPropertyRector;

return RectorConfig::configure()
    ->withRules([
        SerializerAttributeGetterToPropertyRector::class,
    ]);
PACKAGE:  symfony/serializer >=7.4

Other rules in the symfony/serializer set