File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424final class AttributesCheck
2525{
2626
27+ public const IS_ATTRIBUTE = 'isAttribute ' ;
28+
2729 public function __construct (
2830 private ReflectionProvider $ reflectionProvider ,
2931 private FunctionCallParametersCheck $ functionCallParametersCheck ,
@@ -146,7 +148,7 @@ public function check(
146148 $ attributeClassName = SprintfHelper ::escapeFormatString ($ attributeClass ->getDisplayName ());
147149
148150 $ nodeAttributes = $ attribute ->getAttributes ();
149- $ nodeAttributes [' isAttribute ' ] = true ;
151+ $ nodeAttributes [self :: IS_ATTRIBUTE ] = true ;
150152
151153 $ parameterErrors = $ this ->functionCallParametersCheck ->check (
152154 ParametersAcceptorSelector ::selectFromArgs (
Original file line number Diff line number Diff line change @@ -272,7 +272,11 @@ public function check(
272272 ];
273273 }
274274
275- if ($ hasNamedArguments && !$ scope ->getPhpVersion ()->supportsNamedArguments ()->yes () && !(bool ) $ funcCall ->getAttribute ('isAttribute ' , false )) {
275+ if (
276+ $ hasNamedArguments
277+ && !$ scope ->getPhpVersion ()->supportsNamedArguments ()->yes ()
278+ && !(bool ) $ funcCall ->getAttribute (AttributesCheck::IS_ATTRIBUTE , false )
279+ ) {
276280 $ errors [] = RuleErrorBuilder ::message ('Named arguments are supported only on PHP 8.0 and later. ' )
277281 ->identifier ('argument.namedNotSupported ' )
278282 ->line ($ funcCallLine )
@@ -920,7 +924,7 @@ private function createPositionalArgumentsFix(
920924 {
921925 if (
922926 // the call was created from an attribute, it is not in the file
923- (bool ) $ funcCall ->getAttribute (' isAttribute ' , false )
927+ (bool ) $ funcCall ->getAttribute (AttributesCheck:: IS_ATTRIBUTE , false )
924928 || (bool ) $ funcCall ->getAttribute (self ::NOT_FIXABLE_CALL_ATTRIBUTE , false )
925929 ) {
926930 return false ;
You can’t perform that action at this time.
0 commit comments