Narrow #[Security] attribute with inner sigle "is_granted/has_role" condition string to #[IsGranted] attribute
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
+use Symfony\Component\Security\Http\Attribute\IsGranted;
-#[Security("is_granted('ROLE_USER')")]
+#[IsGranted('ROLE_USER')]
class SomeClass
{
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\CodeQuality\Rector\AttributeGroup\SingleConditionSecurityAttributeToIsGrantedRector;
return RectorConfig::configure()
->withRules([
SingleConditionSecurityAttributeToIsGrantedRector::class,
]);