File tree Expand file tree Collapse file tree 3 files changed +54
-1
lines changed Expand file tree Collapse file tree 3 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ private function createDtoType(Class_|Enum_ $node): void
108108                    $ paramType$ paramtype ;
109109                    $ paramName$ paramvar ->name ;
110110
111-                     if  ($ paramType  ===  null  &&  $ classMethodComments
111+                     if  ($ classMethodComments
112112                        if  ($ classMethodCommentsParsednull ) {
113113                            $ classMethodCommentsParsed$ this phpDocTypeParser ->parseMethodParams ($ classMethodComments
114114                        }
Original file line number Diff line number Diff line change @@ -685,6 +685,41 @@ public function nestedGenericsSimpleType() {}
685685        $ this assertMatchesGeneratedTypeScriptApi ($ result
686686    }
687687
688+     public  function  testGenericDtoWithArrayField (): void 
689+     {
690+         $ code
691+ <?php 
692+ 
693+ use \Riverwaysoft\PhpConverter\ClassFilter\DtoEndpoint; 
694+ use \Riverwaysoft\PhpConverter\ClassFilter\Dto; 
695+ 
696+ /** 
697+  * @template T 
698+  */ 
699+ #[Dto] 
700+ class Paginated 
701+ { 
702+     /** 
703+      * @param T[] $items 
704+      */ 
705+     public function __construct( 
706+         public array $items, 
707+         public int $totalCount, 
708+         public int $pagesCount, 
709+         public int $page, 
710+     ) 
711+     { 
712+     } 
713+ } 
714+ CODE;
715+ 
716+         $ converternew  Converter ([
717+             new  DtoVisitor (new  PhpAttributeFilter ('Dto ' )),
718+         ]);
719+         $ result$ converterconvert ([$ code
720+         $ this assertMatchesGeneratedTypeScriptApi ($ result
721+     }
722+ 
688723    public  function  testApiClientGenerationWithApiPlatformLegacyResource (): void 
689724    {
690725        $ code
Original file line number Diff line number Diff line change 1+ // THE FILE WAS AUTOGENERATED USING PHP-CONVERTER. PLEASE DO NOT EDIT IT! 
2+ 
3+ import  axios  from  'axios' ; 
4+ 
5+ export  type  Paginated < T >  =  { 
6+   items : T [ ] ; 
7+   totalCount : number ; 
8+   pagesCount : number ; 
9+   page : number ; 
10+ } ; 
11+ 
12+ export  type  CollectionResponse < Resource  extends  { id : string } >  =  { 
13+   'hydra:member' : Resource [ ] ; 
14+   'hydra:totalItems' : number ; 
15+   'hydra:view' : {  '@id' : string ;  'hydra:last' : string  } ; 
16+   'hydra:search' : {  'hydra:mapping' : any [ ]  } ; 
17+   'hydra:last' : string ; 
18+ } ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments