@@ -31,7 +31,9 @@ public function testClosingStreamEmitsErrorForCurrentCommand()
3131
3232 // hack to inject command as current command
3333 $ ref = new \ReflectionProperty ($ parser , 'currCommand ' );
34- $ ref ->setAccessible (true );
34+ if (PHP_VERSION_ID < 80100 ) {
35+ $ ref ->setAccessible (true );
36+ }
3537 $ ref ->setValue ($ parser , $ command );
3638
3739 $ stream ->close ();
@@ -62,7 +64,9 @@ public function testParseValidAuthPluginWillSendAuthResponse()
6264 $ stream ->write ("\x49\0\0\0\x0a\x38\x2e\x34\x2e\x35\0\x5e\0\0\0\x08\x0c\x41\x44\x12\x5e\x69\x59\0\xff\xff\xff\x02\0\xff\xdf\x15\0\0\0\0\0\0\0\0\0\0\x3c\x2c\x5e\x54\x06\x04\x01\x61\x01\x20\x79\x1b\0\x63\x61\x63\x68\x69\x6e\x67\x5f\x73\x68\x61\x32\x5f\x70\x61\x73\x73\x77\x6f\x72\x64\0" );
6365
6466 $ ref = new \ReflectionProperty ($ parser , 'authPlugin ' );
65- $ ref ->setAccessible (true );
67+ if (PHP_VERSION_ID < 80100 ) {
68+ $ ref ->setAccessible (true );
69+ }
6670 $ this ->assertEquals ('caching_sha2_password ' , $ ref ->getValue ($ parser ));
6771 }
6872
@@ -100,11 +104,15 @@ public function testParseAuthSwitchRequestWillSendAuthSwitchResponsePacket()
100104 $ parser ->start ();
101105
102106 $ ref = new \ReflectionProperty ($ parser , 'phase ' );
103- $ ref ->setAccessible (true );
107+ if (PHP_VERSION_ID < 80100 ) {
108+ $ ref ->setAccessible (true );
109+ }
104110 $ ref ->setValue ($ parser , Parser::PHASE_AUTH_SENT );
105111
106112 $ ref = new \ReflectionProperty ($ parser , 'currCommand ' );
107- $ ref ->setAccessible (true );
113+ if (PHP_VERSION_ID < 80100 ) {
114+ $ ref ->setAccessible (true );
115+ }
108116 $ ref ->setValue ($ parser , $ command );
109117
110118 $ stream ->write ("\x20\0\0\0" . "\xfe" . "caching_sha2_password " . "\0" . "scramble " . "\0" );
@@ -127,11 +135,15 @@ public function testParseAuthSwitchRequestWithUnexpectedAuthPluginWillEmitErrorA
127135 $ parser ->start ();
128136
129137 $ ref = new \ReflectionProperty ($ parser , 'phase ' );
130- $ ref ->setAccessible (true );
138+ if (PHP_VERSION_ID < 80100 ) {
139+ $ ref ->setAccessible (true );
140+ }
131141 $ ref ->setValue ($ parser , Parser::PHASE_AUTH_SENT );
132142
133143 $ ref = new \ReflectionProperty ($ parser , 'currCommand ' );
134- $ ref ->setAccessible (true );
144+ if (PHP_VERSION_ID < 80100 ) {
145+ $ ref ->setAccessible (true );
146+ }
135147 $ ref ->setValue ($ parser , $ command );
136148
137149 $ stream ->write ("\x19\0\0\0" . "\xfe" . "sha256_password " . "\0" . "scramble " . "\0" );
@@ -151,15 +163,21 @@ public function testParseAuthMoreDataWithFastAuthSuccessWillPrintDebugLogAndWait
151163 $ parser ->start ();
152164
153165 $ ref = new \ReflectionProperty ($ parser , 'debug ' );
154- $ ref ->setAccessible (true );
166+ if (PHP_VERSION_ID < 80100 ) {
167+ $ ref ->setAccessible (true );
168+ }
155169 $ ref ->setValue ($ parser , true );
156170
157171 $ ref = new \ReflectionProperty ($ parser , 'phase ' );
158- $ ref ->setAccessible (true );
172+ if (PHP_VERSION_ID < 80100 ) {
173+ $ ref ->setAccessible (true );
174+ }
159175 $ ref ->setValue ($ parser , Parser::PHASE_AUTH_SENT );
160176
161177 $ ref = new \ReflectionProperty ($ parser , 'authPlugin ' );
162- $ ref ->setAccessible (true );
178+ if (PHP_VERSION_ID < 80100 ) {
179+ $ ref ->setAccessible (true );
180+ }
163181 $ ref ->setValue ($ parser , 'caching_sha2_password ' );
164182
165183 $ this ->expectOutputRegex ('/Fast auth success\n$/ ' );
@@ -180,11 +198,15 @@ public function testParseAuthMoreDataWithFastAuthFailureWillSendCertificateReque
180198 $ parser ->start ();
181199
182200 $ ref = new \ReflectionProperty ($ parser , 'phase ' );
183- $ ref ->setAccessible (true );
201+ if (PHP_VERSION_ID < 80100 ) {
202+ $ ref ->setAccessible (true );
203+ }
184204 $ ref ->setValue ($ parser , Parser::PHASE_AUTH_SENT );
185205
186206 $ ref = new \ReflectionProperty ($ parser , 'authPlugin ' );
187- $ ref ->setAccessible (true );
207+ if (PHP_VERSION_ID < 80100 ) {
208+ $ ref ->setAccessible (true );
209+ }
188210 $ ref ->setValue ($ parser , 'caching_sha2_password ' );
189211
190212 $ stream ->write ("\x02\0\0\0" . "\x01\x04" );
@@ -207,15 +229,21 @@ public function testParseAuthMoreDataWithCertificateWillSendEncryptedPassword()
207229 $ parser ->start ();
208230
209231 $ ref = new \ReflectionProperty ($ parser , 'phase ' );
210- $ ref ->setAccessible (true );
232+ if (PHP_VERSION_ID < 80100 ) {
233+ $ ref ->setAccessible (true );
234+ }
211235 $ ref ->setValue ($ parser , Parser::PHASE_AUTH_SENT );
212236
213237 $ ref = new \ReflectionProperty ($ parser , 'authPlugin ' );
214- $ ref ->setAccessible (true );
238+ if (PHP_VERSION_ID < 80100 ) {
239+ $ ref ->setAccessible (true );
240+ }
215241 $ ref ->setValue ($ parser , 'caching_sha2_password ' );
216242
217243 $ ref = new \ReflectionProperty ($ parser , 'currCommand ' );
218- $ ref ->setAccessible (true );
244+ if (PHP_VERSION_ID < 80100 ) {
245+ $ ref ->setAccessible (true );
246+ }
219247 $ ref ->setValue ($ parser , $ command );
220248
221249 $ stream ->write ("\x04\0\0\0" . "\x01--- " );
@@ -239,15 +267,21 @@ public function testParseAuthMoreDataWithCertificateWillEmitErrorAndCloseConnect
239267 $ parser ->start ();
240268
241269 $ ref = new \ReflectionProperty ($ parser , 'phase ' );
242- $ ref ->setAccessible (true );
270+ if (PHP_VERSION_ID < 80100 ) {
271+ $ ref ->setAccessible (true );
272+ }
243273 $ ref ->setValue ($ parser , Parser::PHASE_AUTH_SENT );
244274
245275 $ ref = new \ReflectionProperty ($ parser , 'authPlugin ' );
246- $ ref ->setAccessible (true );
276+ if (PHP_VERSION_ID < 80100 ) {
277+ $ ref ->setAccessible (true );
278+ }
247279 $ ref ->setValue ($ parser , 'caching_sha2_password ' );
248280
249281 $ ref = new \ReflectionProperty ($ parser , 'currCommand ' );
250- $ ref ->setAccessible (true );
282+ if (PHP_VERSION_ID < 80100 ) {
283+ $ ref ->setAccessible (true );
284+ }
251285 $ ref ->setValue ($ parser , $ command );
252286
253287 $ stream ->write ("\x04\0\0\0" . "\x01--- " );
@@ -352,11 +386,15 @@ public function testReceivingErrorFrameForQueryAfterResultSetHeadersShouldEmitEr
352386 $ this ->assertEquals ('Query execution was interrupted ' , $ error ->getMessage ());
353387
354388 $ ref = new \ReflectionProperty ($ parser , 'rsState ' );
355- $ ref ->setAccessible (true );
389+ if (PHP_VERSION_ID < 80100 ) {
390+ $ ref ->setAccessible (true );
391+ }
356392 $ this ->assertEquals (0 , $ ref ->getValue ($ parser ));
357393
358394 $ ref = new \ReflectionProperty ($ parser , 'resultFields ' );
359- $ ref ->setAccessible (true );
395+ if (PHP_VERSION_ID < 80100 ) {
396+ $ ref ->setAccessible (true );
397+ }
360398 $ this ->assertEquals ([], $ ref ->getValue ($ parser ));
361399 }
362400
@@ -380,7 +418,9 @@ public function testReceivingInvalidPacketWithMissingDataShouldEmitErrorAndClose
380418
381419 // hack to inject command as current command
382420 $ ref = new \ReflectionProperty ($ parser , 'currCommand ' );
383- $ ref ->setAccessible (true );
421+ if (PHP_VERSION_ID < 80100 ) {
422+ $ ref ->setAccessible (true );
423+ }
384424 $ ref ->setValue ($ parser , $ command );
385425
386426 $ stream ->on ('close ' , $ this ->expectCallableOnce ());
@@ -413,7 +453,9 @@ public function testReceivingInvalidPacketWithExcessiveDataShouldEmitErrorAndClo
413453
414454 // hack to inject command as current command
415455 $ ref = new \ReflectionProperty ($ parser , 'currCommand ' );
416- $ ref ->setAccessible (true );
456+ if (PHP_VERSION_ID < 80100 ) {
457+ $ ref ->setAccessible (true );
458+ }
417459 $ ref ->setValue ($ parser , $ command );
418460
419461 $ stream ->on ('close ' , $ this ->expectCallableOnce ());
0 commit comments