File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -2209,9 +2209,9 @@ protected function notEqualValues(): array
2209
2209
$ object2 = new SampleClass (16 , 23 , 42 );
2210
2210
$ object3 = new SampleClass (4 , 8 , 15 );
2211
2211
$ storage1 = new SplObjectStorage ;
2212
- $ storage1 ->attach ($ object1 );
2212
+ $ storage1 ->offsetSet ($ object1 );
2213
2213
$ storage2 = new SplObjectStorage ;
2214
- $ storage2 ->attach ($ object3 ); // same content, different object
2214
+ $ storage2 ->offsetSet ($ object3 ); // same content, different object
2215
2215
2216
2216
$ file = TEST_FILES_PATH . 'foo.xml ' ;
2217
2217
@@ -2350,9 +2350,9 @@ protected function equalValues(): array
2350
2350
$ object1 = new SampleClass (4 , 8 , 15 );
2351
2351
$ object2 = new SampleClass (4 , 8 , 15 );
2352
2352
$ storage1 = new SplObjectStorage ;
2353
- $ storage1 ->attach ($ object1 );
2353
+ $ storage1 ->offsetSet ($ object1 );
2354
2354
$ storage2 = new SplObjectStorage ;
2355
- $ storage2 ->attach ($ object1 );
2355
+ $ storage2 ->offsetSet ($ object1 );
2356
2356
2357
2357
return [
2358
2358
// arrays
Original file line number Diff line number Diff line change @@ -105,10 +105,10 @@ public function isEqualProvider(): array
105
105
$ d ->c = $ c ;
106
106
107
107
$ storage1 = new SplObjectStorage ;
108
- $ storage1 ->attach ($ a );
109
- $ storage1 ->attach ($ b );
108
+ $ storage1 ->offsetSet ($ a );
109
+ $ storage1 ->offsetSet ($ b );
110
110
$ storage2 = new SplObjectStorage ;
111
- $ storage2 ->attach ($ b );
111
+ $ storage2 ->offsetSet ($ b );
112
112
$ storage1hash = spl_object_hash ($ storage1 );
113
113
$ storage2hash = spl_object_hash ($ storage2 );
114
114
Original file line number Diff line number Diff line change 9
9
*/
10
10
namespace PHPUnit \Framework \MockObject ;
11
11
12
+ use const PHP_VERSION ;
12
13
use function class_uses ;
13
14
use function func_get_args ;
14
15
use function get_class ;
15
16
use function get_parent_class ;
16
17
use function sprintf ;
18
+ use function version_compare ;
17
19
use Exception ;
18
20
use PHPUnit \Framework \ExpectationFailedException ;
19
21
use PHPUnit \Framework \TestCase ;
@@ -1352,7 +1354,11 @@ private function resetMockObjects(): void
1352
1354
$ refl = new ReflectionObject ($ this );
1353
1355
$ refl = $ refl ->getParentClass ();
1354
1356
$ prop = $ refl ->getProperty ('mockObjects ' );
1355
- $ prop ->setAccessible (true );
1357
+
1358
+ if (version_compare (PHP_VERSION , '8.1.0 ' , '< ' )) {
1359
+ $ prop ->setAccessible (true );
1360
+ }
1361
+
1356
1362
$ prop ->setValue ($ this , []);
1357
1363
}
1358
1364
}
You can’t perform that action at this time.
0 commit comments