Skip to content

Commit cd941f8

Browse files
Merge branch '10.5' into 11.5
2 parents 4b1f100 + a9c3242 commit cd941f8

File tree

7 files changed

+15
-17
lines changed

7 files changed

+15
-17
lines changed

ChangeLog-11.5.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes of the PHPUnit 11.5 release series are documented in this fi
77
### Changed
88

99
* [#6300](https://github.com/sebastianbergmann/phpunit/issues/6300): Emit warning when the name of a data provider method begins with `test`
10+
* Do not use `SplObjectStorage` methods that will be deprecated in PHP 8.5
1011

1112
## [11.5.29] - 2025-08-09
1213

src/Framework/Constraint/Traversable/TraversableContainsEqual.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class TraversableContainsEqual extends TraversableContains
2323
protected function matches(mixed $other): bool
2424
{
2525
if ($other instanceof SplObjectStorage) {
26-
return $other->contains($this->value());
26+
return $other->offsetExists($this->value());
2727
}
2828

2929
foreach ($other as $element) {

src/Framework/Constraint/Traversable/TraversableContainsIdentical.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class TraversableContainsIdentical extends TraversableContains
2323
protected function matches(mixed $other): bool
2424
{
2525
if ($other instanceof SplObjectStorage) {
26-
return $other->contains($this->value());
26+
return $other->offsetExists($this->value());
2727
}
2828

2929
foreach ($other as $element) {

tests/end-to-end/mock-objects/generator/return_type_declarations_generator_empty_by_default.phpt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@ $generator = new \PHPUnit\Framework\MockObject\Generator\Generator;
1919

2020
$mock = $generator->testDouble('Foo', false, false);
2121

22-
var_dump(iterator_to_array($mock->forTraversable()));
23-
var_dump(iterator_to_array($mock->forGenerator()));
24-
var_dump(iterator_to_array($mock->forIterable()));
22+
print count(iterator_to_array($mock->forTraversable())) . PHP_EOL;
23+
print count(iterator_to_array($mock->forGenerator())) . PHP_EOL;
24+
print count(iterator_to_array($mock->forIterable())) . PHP_EOL;
2525
--EXPECTF--
26-
array(0) {
27-
}
28-
array(0) {
29-
}
30-
array(0) {
31-
}
26+
0
27+
0
28+
0

tests/unit/Framework/Assert/assertEqualsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ public static function equalValues(): array
6565
$object1 = new SampleClass(4, 8, 15);
6666
$object2 = new SampleClass(4, 8, 15);
6767
$storage1 = new SplObjectStorage;
68-
$storage1->attach($object1);
68+
$storage1->offsetSet($object1);
6969
$storage2 = new SplObjectStorage;
70-
$storage2->attach($object1);
70+
$storage2->offsetSet($object1);
7171

7272
return [
7373
// arrays
@@ -159,9 +159,9 @@ public static function notEqualValues(): array
159159
$object2 = new SampleClass(16, 23, 42);
160160
$object3 = new SampleClass(4, 8, 15);
161161
$storage1 = new SplObjectStorage;
162-
$storage1->attach($object1);
162+
$storage1->offsetSet($object1);
163163
$storage2 = new SplObjectStorage;
164-
$storage2->attach($object3); // same content, different object
164+
$storage2->offsetSet($object3); // same content, different object
165165

166166
$file = TEST_FILES_PATH . 'foo.xml';
167167

tests/unit/Framework/Constraint/Traversable/TraversableContainsEqualTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static function provider(): array
2828
$o = new stdClass;
2929

3030
$s = new SplObjectStorage;
31-
$s->attach($o);
31+
$s->offsetSet($o);
3232

3333
return [
3434
[

tests/unit/Framework/Constraint/Traversable/TraversableContainsIdenticalTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static function provider(): array
2828
$o = new stdClass;
2929

3030
$s = new SplObjectStorage;
31-
$s->attach($o);
31+
$s->offsetSet($o);
3232

3333
return [
3434
[

0 commit comments

Comments
 (0)