File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
rules/CodeQuality/Rector/Trait_ Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1515use Rector \BetterPhpDocParser \PhpDocInfo \PhpDocInfoFactory ;
1616use Rector \Php80 \NodeAnalyzer \PhpAttributeAnalyzer ;
1717use Rector \Rector \AbstractRector ;
18+ use Rector \Symfony \Enum \SymfonyAttribute ;
19+ use Rector \Symfony \Enum \SymfonyClass ;
1820use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
1921use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
2022
2325 */
2426final class AddTraitGetterReturnTypeBasedOnSetterRequiredRector extends AbstractRector
2527{
26- /**
27- * @var string
28- */
29- private const REQUIRED_ATTRIBUTE = 'Symfony\Contracts\Service\Attribute\Required ' ;
30-
3128 public function __construct (
3229 private readonly PhpDocInfoFactory $ phpDocInfoFactory ,
3330 private readonly PhpAttributeAnalyzer $ phpAttributeAnalyzer
@@ -181,6 +178,6 @@ private function shouldProcess(ClassMethod $classMethod): bool
181178 return true ;
182179 }
183180
184- return $ this ->phpAttributeAnalyzer ->hasPhpAttribute ($ classMethod , self :: REQUIRED_ATTRIBUTE );
181+ return $ this ->phpAttributeAnalyzer ->hasPhpAttribute ($ classMethod , SymfonyAttribute:: REQUIRED );
185182 }
186183}
Original file line number Diff line number Diff line change @@ -40,4 +40,9 @@ final class SymfonyAttribute
4040 * @var string
4141 */
4242 public const IS_GRANTED = 'Symfony\Component\Security\Http\Attribute\IsGranted ' ;
43+
44+ /**
45+ * @var string
46+ */
47+ public const REQUIRED = 'Symfony\Contracts\Service\Attribute\Required ' ;
4348}
You can’t perform that action at this time.
0 commit comments