SplitAndSecurityAttributeToIsGrantedRector

Split #[Security] attribute with "and" condition string to multiple #[IsGranted] attributes with sole values

-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
+use Symfony\Component\Security\Http\Attribute\IsGranted;

-#[Security("is_granted('ROLE_USER') and has_role('ROLE_ADMIN')")]
+#[IsGranted('ROLE_USER')]
+#[IsGranted('ROLE_ADMIN')]
 class SomeClass
 {
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Symfony\CodeQuality\Rector\Class_\SplitAndSecurityAttributeToIsGrantedRector;

return RectorConfig::configure()
    ->withRules([
        SplitAndSecurityAttributeToIsGrantedRector::class,
    ]);
SETS:  Code Quality