File tree Expand file tree Collapse file tree
CodeQuality/Rector/Attribute Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,6 +65,11 @@ public function getNodeTypes(): array
6565 */
6666 public function refactor (Node $ node ): ?Node
6767 {
68+ // no arguments to name
69+ if ($ node ->args === []) {
70+ return null ;
71+ }
72+
6873 $ methodReflection = $ this ->reflectionResolver ->resolveConstructorReflectionFromAttribute ($ node );
6974 if (! $ methodReflection instanceof MethodReflection) {
7075 return null ;
Original file line number Diff line number Diff line change @@ -102,31 +102,31 @@ public function refactor(Node $node): StaticCall|MethodCall|null
102102 return null ;
103103 }
104104
105- $ scope = ScopeFetcher ::fetch ($ node );
106-
107- $ arrayCallable = $ this ->arrayCallableMethodMatcher ->match ($ node , $ scope );
108- if (! $ arrayCallable instanceof ArrayCallable) {
105+ if ($ node ->getAttribute (AttributeKey::IS_CLASS_CONST_VALUE )) {
109106 return null ;
110107 }
111108
112- $ callerExpr = $ arrayCallable ->getCallerExpr ();
113- if (! $ callerExpr instanceof Variable && ! $ callerExpr instanceof PropertyFetch && ! $ callerExpr instanceof ClassConstFetch) {
109+ if ($ node ->getAttribute (AttributeKey::IS_DEFAULT_PROPERTY_VALUE )) {
114110 return null ;
115111 }
116112
117- if ($ node ->getAttribute (AttributeKey::IS_CLASS_CONST_VALUE )) {
113+ if ($ node ->getAttribute (AttributeKey::IS_PARAM_DEFAULT )) {
118114 return null ;
119115 }
120116
121- if ($ node ->getAttribute (AttributeKey::IS_DEFAULT_PROPERTY_VALUE )) {
117+ if ($ node ->getAttribute (AttributeKey::IS_UNPACKED_ARG_VALUE )) {
122118 return null ;
123119 }
124120
125- if ($ node ->getAttribute (AttributeKey::IS_PARAM_DEFAULT )) {
121+ $ scope = ScopeFetcher ::fetch ($ node );
122+
123+ $ arrayCallable = $ this ->arrayCallableMethodMatcher ->match ($ node , $ scope );
124+ if (! $ arrayCallable instanceof ArrayCallable) {
126125 return null ;
127126 }
128127
129- if ($ node ->getAttribute (AttributeKey::IS_UNPACKED_ARG_VALUE )) {
128+ $ callerExpr = $ arrayCallable ->getCallerExpr ();
129+ if (! $ callerExpr instanceof Variable && ! $ callerExpr instanceof PropertyFetch && ! $ callerExpr instanceof ClassConstFetch) {
130130 return null ;
131131 }
132132
You can’t perform that action at this time.
0 commit comments