@@ -635,10 +635,9 @@ public static function dataProviderTestThatAssociationMethodsExists(): array
635635 // Get entity class meta data
636636 $ meta = $ entityManager ->getClassMetadata (static ::$ entityName );
637637
638- $ iterator = static function (array $ mapping ) use ($ meta ): array {
639- $ target = $ mapping[ ' targetEntity ' ] ;
638+ $ iterator = static function (AssociationMapping $ mapping ) use ($ meta ): array {
639+ $ target = $ mapping-> targetEntity ;
640640
641- self ::assertIsString ($ target );
642641 self ::assertTrue (class_exists ($ target ));
643642
644643 $ arguments = match ($ target ) {
@@ -652,35 +651,31 @@ public static function dataProviderTestThatAssociationMethodsExists(): array
652651 $ input = new $ target (...$ arguments );
653652
654653 $ methods = [
655- ['get ' . ucfirst (( string ) $ mapping[ ' fieldName ' ] ), $ mapping[ ' fieldName ' ] , false , null ],
654+ ['get ' . ucfirst ($ mapping-> fieldName ), $ mapping-> fieldName , false , null ],
656655 ];
657656
658- switch ($ mapping[ ' type ' ] ) {
657+ switch ($ mapping-> type () ) {
659658 case ClassMetadata::ONE_TO_MANY :
660659 case ClassMetadata::ONE_TO_ONE :
661660 break ;
662661 case ClassMetadata::MANY_TO_ONE :
663662 if ($ meta ->isReadOnly === false ) {
664663 $ methods [] = [
665- 'set ' . ucfirst (( string ) $ mapping[ ' fieldName ' ] ),
666- $ mapping[ ' fieldName ' ] ,
664+ 'set ' . ucfirst ($ mapping-> fieldName ),
665+ $ mapping-> fieldName ,
667666 $ input ,
668667 static ::$ entityName ,
669668 ];
670669 }
671670 break ;
672671 case ClassMetadata::MANY_TO_MANY :
673- self ::assertArrayHasKey ('fieldName ' , $ mapping );
674-
675- $ singular = $ mapping ['fieldName ' ][mb_strlen ((string )$ mapping ['fieldName ' ]) - 1 ] === 's '
676- ? mb_substr ((string )$ mapping ['fieldName ' ], 0 , -1 )
677- : $ mapping ['fieldName ' ];
678-
679- self ::assertIsString ($ singular );
672+ $ singular = mb_substr ($ mapping ->fieldName , -1 ) === 's '
673+ ? mb_substr ($ mapping ->fieldName , 0 , -1 )
674+ : $ mapping ->fieldName ;
680675
681676 $ methods = [
682677 [
683- 'get ' . ucfirst (( string ) $ mapping[ ' fieldName ' ] ),
678+ 'get ' . ucfirst ($ mapping-> fieldName ),
684679 $ mapping ['fieldName ' ],
685680 $ input ,
686681 ArrayCollection::class,
@@ -702,7 +697,7 @@ public static function dataProviderTestThatAssociationMethodsExists(): array
702697 static ::$ entityName ,
703698 ],
704699 [
705- 'clear ' . ucfirst (( string ) $ mapping[ ' fieldName ' ] ),
700+ 'clear ' . ucfirst ($ mapping-> fieldName ),
706701 $ mapping ['fieldName ' ],
707702 $ input ,
708703 static ::$ entityName ,
0 commit comments