File tree Expand file tree Collapse file tree 6 files changed +88
-5
lines changed 
src/Model/Resource/Attribute 
tests/Bridge/OpenAPI/Model Expand file tree Collapse file tree 6 files changed +88
-5
lines changed Original file line number Diff line number Diff line change 33declare (strict_types=1 );
44
55use  Rector \Config \RectorConfig ;
6+ use  Rector \Doctrine \Set \DoctrineSetList ;
7+ use  Rector \Php80 \Rector \Class_ \AnnotationToAttributeRector ;
8+ use  Rector \Php80 \ValueObject \AnnotationToAttribute ;
9+ use  Rector \Symfony \Set \SensiolabsSetList ;
10+ use  Rector \Symfony \Set \SymfonySetList ;
11+ use  Symfony \Bridge \Doctrine \Validator \Constraints \UniqueEntity ;
612
7- return  RectorConfig::configure ()
8-     ->withPaths ([
13+ return  static  function  (RectorConfig $ rectorConfigvoid  {
14+     // Paths for Rector to act upon 
15+     $ rectorConfigpaths ([
916        __DIR__  . '/src ' ,
1017        __DIR__  . '/tests ' ,
11-     ])
12-     ->withPhpSets (true )
13-     ->withRules ([
1418    ]);
19+ 
20+     $ rectorConfigsets ([
21+         DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES ,
22+         SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES ,
23+         SensiolabsSetList::ANNOTATIONS_TO_ATTRIBUTES ,
24+     ]);
25+     $ rectorConfigruleWithConfiguration (AnnotationToAttributeRector::class, [
26+         new  AnnotationToAttribute (UniqueEntity::class),
27+     ]);
28+ };
Original file line number Diff line number Diff line change 1+ <?php 
2+ 
3+ declare (strict_types=1 );
4+ 
5+ namespace  Undabot \SymfonyJsonApi \Model \Resource \Attribute ;
6+ 
7+ use  Attribute  as  PhpAttribute ;
8+ 
9+ #[PhpAttribute(PhpAttribute::TARGET_PROPERTY  | PhpAttribute::IS_REPEATABLE )]
10+ class  Attribute
11+ {
12+     public  function  __construct (
13+         public  string  $ name
14+         public  ?string  $ descriptionnull ,
15+         public  ?string  $ examplenull ,
16+         public  ?string  $ formatnull ,
17+         public  bool  $ nullablefalse 
18+     ) {}
19+ }
Original file line number Diff line number Diff line change 1+ <?php 
2+ 
3+ declare (strict_types=1 );
4+ 
5+ namespace  Undabot \SymfonyJsonApi \Model \Resource \Attribute ;
6+ 
7+ abstract  class  Relationship
8+ {
9+     public  function  __construct (
10+         public  string  $ name
11+         public  ?string  $ typenull ,
12+         public  ?string  $ descriptionnull ,
13+         public  bool  $ nullablefalse 
14+     ) {}
15+ 
16+     abstract  public  function  isToMany (): bool ;
17+ }
Original file line number Diff line number Diff line change 1+ <?php 
2+ 
3+ declare (strict_types=1 );
4+ 
5+ namespace  Undabot \SymfonyJsonApi \Model \Resource \Attribute ;
6+ 
7+ use  Attribute  as  PhpAttribute ;
8+ 
9+ #[PhpAttribute(PhpAttribute::TARGET_PROPERTY  | PhpAttribute::IS_REPEATABLE )]
10+ class  ToMany extends  Relationship
11+ {
12+     public  function  isToMany (): bool 
13+     {
14+         return  true ;
15+     }
16+ }
Original file line number Diff line number Diff line change 1+ <?php 
2+ 
3+ declare (strict_types=1 );
4+ 
5+ namespace  Undabot \SymfonyJsonApi \Model \Resource \Attribute ;
6+ 
7+ use  Attribute  as  PhpAttribute ;
8+ 
9+ #[PhpAttribute(PhpAttribute::TARGET_PROPERTY  | PhpAttribute::IS_REPEATABLE )]
10+ class  ToOne extends  Relationship
11+ {
12+     public  function  isToMany (): bool 
13+     {
14+         return  false ;
15+     }
16+ }
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ class Article implements ApiModel
4545     * 
4646     * @Attribute(name="eventDate") 
4747     */ 
48+     #[\Undabot \SymfonyJsonApi \Model \Resource \Attribute \Attribute('ovoJeIme ' )]
4849    private  $ date
4950
5051    /** 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments