1313use PHPUnit \Framework \Attributes \CoversClass ;
1414use PHPUnit \Framework \Attributes \DataProvider ;
1515use PHPUnit \Framework \Attributes \Group ;
16- use ReflectionClass ;
16+ use ReflectionProperty ;
1717
1818use function implode ;
1919
@@ -237,7 +237,7 @@ public function testFixPmaTablesNormal(): void
237237 $ dummyDbi ->addSelectDb ('db_pma ' );
238238
239239 $ _SESSION ['relation ' ] = [];
240- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
240+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
241241
242242 $ relation ->fixPmaTables ('db_pma ' , false );
243243
@@ -512,7 +512,7 @@ public function testFixPmaTablesNormalFixTables(): void
512512 $ this ->assertSame ('' , $ GLOBALS ['cfg ' ]['Server ' ]['pmadb ' ]);
513513
514514 $ _SESSION ['relation ' ] = [];
515- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
515+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
516516
517517 $ relation ->fixPmaTables ('db_pma ' , true );
518518 $ this ->assertArrayNotHasKey ('message ' , $ GLOBALS );
@@ -796,7 +796,7 @@ public function testFixPmaTablesNormalFixTablesWithCustomOverride(): void
796796 $ this ->assertSame ('db_pma ' , $ GLOBALS ['cfg ' ]['Server ' ]['pmadb ' ]);
797797
798798 $ _SESSION ['relation ' ] = [];
799- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
799+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
800800
801801 $ dummyDbi ->addSelectDb ('db_pma ' );
802802 $ dummyDbi ->addSelectDb ('db_pma ' );
@@ -875,7 +875,7 @@ public function testFixPmaTablesNormalFixTablesFails(): void
875875 $ this ->assertSame ('' , $ GLOBALS ['cfg ' ]['Server ' ]['pmadb ' ]);
876876
877877 $ _SESSION ['relation ' ] = [];
878- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
878+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
879879
880880 $ relation ->fixPmaTables ('db_pma ' , true );
881881
@@ -1437,7 +1437,7 @@ public function testInitRelationParamsCacheDefaultDbNameDbExistsServerZero(): vo
14371437 );
14381438
14391439 $ _SESSION ['relation ' ] = [];
1440- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
1440+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
14411441
14421442 $ relation = new Relation ($ dbi );
14431443 $ relation ->initRelationParamsCache ();
@@ -1503,7 +1503,7 @@ public function testInitRelationParamsCacheDefaultDbNameDbExistsFirstServer(): v
15031503 $ dummyDbi ->addResult ('SELECT NULL FROM `pma__userconfig` LIMIT 0 ' , [], ['NULL ' ]);
15041504
15051505 $ _SESSION ['relation ' ] = [];
1506- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
1506+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
15071507
15081508 $ dummyDbi ->addSelectDb ('phpmyadmin ' );
15091509 $ relation = new Relation ($ dbi );
@@ -1595,7 +1595,7 @@ public function testInitRelationParamsCacheDefaultDbNameDbExistsFirstServerNotWo
15951595 $ dummyDbi ->addResult ('SELECT NULL FROM `pma__userconfig` LIMIT 0 ' , false );
15961596
15971597 $ _SESSION ['relation ' ] = [];
1598- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
1598+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
15991599
16001600 $ dummyDbi ->addSelectDb ('phpmyadmin ' );
16011601 $ relation = new Relation ($ dbi );
@@ -1688,7 +1688,7 @@ public function testInitRelationParamsCacheDefaultDbNameDbExistsFirstServerOverr
16881688 $ dummyDbi ->addSelectDb ('PMA-storage ' );
16891689
16901690 $ _SESSION ['relation ' ] = [];
1691- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
1691+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
16921692
16931693 $ relation = new Relation ($ dbi );
16941694 $ relation ->initRelationParamsCache ();
@@ -1714,7 +1714,7 @@ public function testInitRelationParamsCacheDefaultDbNameDbExistsFirstServerOverr
17141714 $ dummyDbi ->addSelectDb ('PMA-storage ' );
17151715 /** @psalm-suppress EmptyArrayAccess */
17161716 unset($ _SESSION ['relation ' ][$ GLOBALS ['server ' ]]);
1717- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
1717+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
17181718 $ relationData = $ relation ->getRelationParameters ();
17191719 $ dummyDbi ->assertAllSelectsConsumed ();
17201720
@@ -1793,7 +1793,7 @@ public function testInitRelationParamsDisabledTracking(): void
17931793 );
17941794
17951795 $ _SESSION ['relation ' ] = [];
1796- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
1796+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
17971797
17981798 $ relation = new Relation ($ dbi );
17991799 $ relation ->initRelationParamsCache ();
@@ -1822,7 +1822,7 @@ public function testInitRelationParamsDisabledTracking(): void
18221822 $ dummyDbi ->addSelectDb ('PMA-storage ' );
18231823 /** @psalm-suppress EmptyArrayAccess */
18241824 unset($ _SESSION ['relation ' ][$ GLOBALS ['server ' ]]);
1825- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
1825+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
18261826 $ relationData = $ relation ->getRelationParameters ();
18271827 $ dummyDbi ->assertAllSelectsConsumed ();
18281828
@@ -1914,8 +1914,8 @@ public function testInitRelationParamsDisabledTrackingOthersExist(): void
19141914
19151915 $ _SESSION ['relation ' ] = [];
19161916 $ _SESSION ['tmpval ' ] = [];
1917- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
1918- (new ReflectionClass (RecentFavoriteTable::class))-> getProperty ( 'instances ' )->setValue (null , []);
1917+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
1918+ (new ReflectionProperty (RecentFavoriteTable::class, 'instances ' ) )->setValue (null , []);
19191919
19201920 $ relation = new Relation ($ dbi );
19211921 $ relation ->initRelationParamsCache ();
@@ -1998,7 +1998,7 @@ public function testArePmadbTablesDefinedAndArePmadbTablesAllDisabled(): void
19981998 $ GLOBALS ['dbi ' ] = $ dbi ;
19991999
20002000 $ _SESSION ['relation ' ] = [];
2001- (new ReflectionClass (Relation::class))-> getProperty ( 'cache ' )->setValue ([]);
2001+ (new ReflectionProperty (Relation::class, 'cache ' )) ->setValue (null , []);
20022002
20032003 $ relation = new Relation ($ dbi );
20042004
@@ -2135,7 +2135,8 @@ public function testRenameTable(array $params, array $queries): void
21352135
21362136 $ GLOBALS ['server ' ] = 1 ;
21372137 $ relationParameters = RelationParameters::fromArray ($ params );
2138- (new ReflectionClass (Relation::class))->getProperty ('cache ' )->setValue (
2138+ (new ReflectionProperty (Relation::class, 'cache ' ))->setValue (
2139+ null ,
21392140 [$ GLOBALS ['server ' ] => $ relationParameters ],
21402141 );
21412142
@@ -2205,7 +2206,8 @@ public function testRenameTableEscaping(): void
22052206 'pdf_pages ' => 'pdf_pages ' ,
22062207 'table_coords ' => 'table`coords ' ,
22072208 ]);
2208- (new ReflectionClass (Relation::class))->getProperty ('cache ' )->setValue (
2209+ (new ReflectionProperty (Relation::class, 'cache ' ))->setValue (
2210+ null ,
22092211 [$ GLOBALS ['server ' ] => $ relationParameters ],
22102212 );
22112213
0 commit comments