@@ -91,7 +91,7 @@ public static function resolve(TypeNode $node, \ReflectionClass|\ReflectionFunct
9191
9292 if ($ node instanceof GenericTypeNode) {
9393 $ genericType = self ::resolve ($ node ->type , $ ref , $ thisObj );
94- $ innerTypes = array_map (fn ($ t ) => self ::resolve ($ t , $ ref , $ thisObj ), $ node ->genericTypes );
94+ $ innerTypes = array_map (fn ($ t ) => self ::resolve ($ t , $ ref , $ thisObj ), $ node ->genericTypes );
9595
9696 return new GenericTypeNode (
9797 $ genericType instanceof IdentifierTypeNode ? $ genericType : $ node ->type ,
@@ -145,11 +145,11 @@ public static function resolve(TypeNode $node, \ReflectionClass|\ReflectionFunct
145145 }
146146
147147 if ($ node instanceof UnionTypeNode) {
148- return new UnionTypeNode (array_map (fn ($ t ) => self ::resolve ($ t , $ ref , $ thisObj ), $ node ->types ));
148+ return new UnionTypeNode (array_map (fn ($ t ) => self ::resolve ($ t , $ ref , $ thisObj ), $ node ->types ));
149149 }
150150
151151 if ($ node instanceof IntersectionTypeNode) {
152- return new IntersectionTypeNode (array_map (fn ($ t ) => self ::resolve ($ t , $ ref , $ thisObj ), $ node ->types ));
152+ return new IntersectionTypeNode (array_map (fn ($ t ) => self ::resolve ($ t , $ ref , $ thisObj ), $ node ->types ));
153153 }
154154
155155 return $ node ;
@@ -181,7 +181,7 @@ public static function resolveForFile(TypeNode $node, string $file): TypeNode
181181
182182 if ($ node instanceof GenericTypeNode) {
183183 $ genericType = self ::resolveForFile ($ node ->type , $ file );
184- $ innerTypes = array_map (fn ($ t ) => self ::resolveForFile ($ t , $ file ), $ node ->genericTypes );
184+ $ innerTypes = array_map (fn ($ t ) => self ::resolveForFile ($ t , $ file ), $ node ->genericTypes );
185185
186186 return new GenericTypeNode (
187187 $ genericType instanceof IdentifierTypeNode ? $ genericType : $ node ->type ,
@@ -235,11 +235,11 @@ public static function resolveForFile(TypeNode $node, string $file): TypeNode
235235 }
236236
237237 if ($ node instanceof UnionTypeNode) {
238- return new UnionTypeNode (array_map (fn ($ t ) => self ::resolveForFile ($ t , $ file ), $ node ->types ));
238+ return new UnionTypeNode (array_map (fn ($ t ) => self ::resolveForFile ($ t , $ file ), $ node ->types ));
239239 }
240240
241241 if ($ node instanceof IntersectionTypeNode) {
242- return new IntersectionTypeNode (array_map (fn ($ t ) => self ::resolveForFile ($ t , $ file ), $ node ->types ));
242+ return new IntersectionTypeNode (array_map (fn ($ t ) => self ::resolveForFile ($ t , $ file ), $ node ->types ));
243243 }
244244
245245 return clone $ node ;
@@ -361,13 +361,32 @@ private static function resolveArrayShape(ArrayShapeNode $node, \ReflectionClass
361361 $ className = null ;
362362 $ constName = null ;
363363
364+ // --- LIVE CI DEBUG LOGGING ---
365+ $ debugClass = $ keyName !== null ? get_class ($ keyName ) : 'null ' ;
366+ $ debugVal = $ keyName !== null && method_exists ($ keyName , '__toString ' ) ? (string ) $ keyName : 'unknown ' ;
367+ fwrite (\STDERR , "\n[DEBUG] ArrayShapeItem KeyType: {$ debugClass } | Value: {$ debugVal }\n" );
368+
369+ if ($ keyName instanceof IdentifierTypeNode) {
370+ fwrite (\STDERR , "[DEBUG] IdentifierName: {$ keyName ->name }\n" );
371+ }
372+ // -----------------------------
373+
364374 if ($ keyName instanceof ConstFetchNode && $ keyName ->className !== '' ) {
365375 $ className = $ keyName ->className ;
366376 $ constName = $ keyName ->name ;
367377 } elseif ($ keyName instanceof IdentifierTypeNode && str_contains ($ keyName ->name , ':: ' )) {
378+ // Fallback for phpstan/phpdoc-parser v1.x/v2.0 which parses constants as Identifiers
368379 [$ className , $ constName ] = explode (':: ' , $ keyName ->name , 2 );
369380 }
370381
382+ // --- MORE DEBUG LOGGING ---
383+ if ($ className !== null && $ constName !== null ) {
384+ fwrite (\STDERR , "[DEBUG] Split into Class: {$ className } | Const: {$ constName }\n" );
385+ } else {
386+ fwrite (\STDERR , "[DEBUG] Did NOT split into Class and Const. \n" );
387+ }
388+ // --------------------------
389+
371390 if ($ className !== null && $ constName !== null ) {
372391 $ lowerClassName = strtolower ($ className );
373392 $ declaringClass = $ ref instanceof \ReflectionMethod ? $ ref ->getDeclaringClass ()->getName () : null ;
@@ -381,9 +400,14 @@ private static function resolveArrayShape(ArrayShapeNode $node, \ReflectionClass
381400 $ resolvedClass = self ::resolveFqcn ($ className , $ ref );
382401 }
383402
403+ fwrite (\STDERR , "[DEBUG] Resolved Target Class for Reflection: {$ resolvedClass }\n" );
404+
384405 $ resolvedKeyNode = self ::resolveConstantKeyValue ($ resolvedClass , $ constName );
385406 if ($ resolvedKeyNode !== null ) {
407+ fwrite (\STDERR , "[DEBUG] Successfully Reflected Constant! New Value: {$ resolvedKeyNode ->value }\n" );
386408 $ keyName = $ resolvedKeyNode ;
409+ } else {
410+ fwrite (\STDERR , "[DEBUG] FAILED to Reflect Constant! \n" );
387411 }
388412 }
389413
0 commit comments