1515use Doctrine \Tests \Models \Cache \State ;
1616use ReflectionProperty ;
1717
18+ use const PHP_VERSION_ID ;
19+
1820/** @group DDC-2183 */
1921class ReadWriteCachedCollectionPersisterTest extends CollectionPersisterTestCase
2022{
@@ -121,7 +123,9 @@ public function testTransactionRollBackDeleteShouldClearQueue(): void
121123 $ key = new CollectionCacheKey (State::class, 'cities ' , ['id ' => 1 ]);
122124 $ property = new ReflectionProperty (ReadWriteCachedCollectionPersister::class, 'queuedCache ' );
123125
124- $ property ->setAccessible (true );
126+ if (PHP_VERSION_ID < 80100 ) {
127+ $ property ->setAccessible (true );
128+ }
125129
126130 $ this ->region ->expects (self ::once ())
127131 ->method ('lock ' )
@@ -153,7 +157,9 @@ public function testTransactionRollBackUpdateShouldClearQueue(): void
153157 $ key = new CollectionCacheKey (State::class, 'cities ' , ['id ' => 1 ]);
154158 $ property = new ReflectionProperty (ReadWriteCachedCollectionPersister::class, 'queuedCache ' );
155159
156- $ property ->setAccessible (true );
160+ if (PHP_VERSION_ID < 80100 ) {
161+ $ property ->setAccessible (true );
162+ }
157163
158164 $ this ->region ->expects (self ::once ())
159165 ->method ('lock ' )
@@ -185,7 +191,9 @@ public function testTransactionRollCommitDeleteShouldClearQueue(): void
185191 $ key = new CollectionCacheKey (State::class, 'cities ' , ['id ' => 1 ]);
186192 $ property = new ReflectionProperty (ReadWriteCachedCollectionPersister::class, 'queuedCache ' );
187193
188- $ property ->setAccessible (true );
194+ if (PHP_VERSION_ID < 80100 ) {
195+ $ property ->setAccessible (true );
196+ }
189197
190198 $ this ->region ->expects (self ::once ())
191199 ->method ('lock ' )
@@ -217,7 +225,9 @@ public function testTransactionRollCommitUpdateShouldClearQueue(): void
217225 $ key = new CollectionCacheKey (State::class, 'cities ' , ['id ' => 1 ]);
218226 $ property = new ReflectionProperty (ReadWriteCachedCollectionPersister::class, 'queuedCache ' );
219227
220- $ property ->setAccessible (true );
228+ if (PHP_VERSION_ID < 80100 ) {
229+ $ property ->setAccessible (true );
230+ }
221231
222232 $ this ->region ->expects (self ::once ())
223233 ->method ('lock ' )
@@ -248,7 +258,9 @@ public function testDeleteLockFailureShouldIgnoreQueue(): void
248258 $ key = new CollectionCacheKey (State::class, 'cities ' , ['id ' => 1 ]);
249259 $ property = new ReflectionProperty (ReadWriteCachedCollectionPersister::class, 'queuedCache ' );
250260
251- $ property ->setAccessible (true );
261+ if (PHP_VERSION_ID < 80100 ) {
262+ $ property ->setAccessible (true );
263+ }
252264
253265 $ this ->region ->expects (self ::once ())
254266 ->method ('lock ' )
@@ -273,7 +285,9 @@ public function testUpdateLockFailureShouldIgnoreQueue(): void
273285 $ key = new CollectionCacheKey (State::class, 'cities ' , ['id ' => 1 ]);
274286 $ property = new ReflectionProperty (ReadWriteCachedCollectionPersister::class, 'queuedCache ' );
275287
276- $ property ->setAccessible (true );
288+ if (PHP_VERSION_ID < 80100 ) {
289+ $ property ->setAccessible (true );
290+ }
277291
278292 $ this ->region ->expects (self ::once ())
279293 ->method ('lock ' )
0 commit comments