Skip to content

Commit d7dee6b

Browse files
Do not use SplObjectStorage methods that will be deprecated in PHP 8.5
1 parent 6835552 commit d7dee6b

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

ChangeLog-9.6.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes of the PHPUnit 9.6 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
44

5+
## [9.6.24] - 2025-MM-DD
6+
7+
### Changed
8+
9+
* Do not use `SplObjectStorage` methods that will be deprecated in PHP 8.5
10+
511
## [9.6.23] - 2025-05-02
612

713
### Changed
@@ -169,6 +175,7 @@ All notable changes of the PHPUnit 9.6 release series are documented in this fil
169175
* [#5064](https://github.com/sebastianbergmann/phpunit/issues/5064): Deprecate `PHPUnit\Framework\TestCase::getMockClass()`
170176
* [#5132](https://github.com/sebastianbergmann/phpunit/issues/5132): Deprecate `Test` suffix for abstract test case classes
171177

178+
[9.6.24]: https://github.com/sebastianbergmann/phpunit/compare/9.6.23...9.6
172179
[9.6.23]: https://github.com/sebastianbergmann/phpunit/compare/9.6.22...9.6.23
173180
[9.6.22]: https://github.com/sebastianbergmann/phpunit/compare/9.6.21...9.6.22
174181
[9.6.21]: https://github.com/sebastianbergmann/phpunit/compare/9.6.20...9.6.21

src/Framework/Constraint/Traversable/TraversableContainsEqual.php

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

3131
foreach ($other as $element) {

src/Framework/Constraint/Traversable/TraversableContainsIdentical.php

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

3131
foreach ($other as $element) {

tests/unit/Framework/Constraint/TraversableContainsEqualTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ public function test_SplObjectStorage_ContainsObject(): void
7474
$c->foo = 'baz';
7575

7676
$storageWithA = new SplObjectStorage;
77-
$storageWithA->attach($a);
77+
$storageWithA->offsetSet($a);
7878

7979
$storageWithoutA = new SplObjectStorage;
80-
$storageWithoutA->attach($b);
80+
$storageWithoutA->offsetSet($b);
8181

8282
$constraint = new TraversableContainsEqual($a);
8383

tests/unit/Framework/Constraint/TraversableContainsIdenticalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ public function test_SplObjectStorage_ContainsObject(): void
7575
$c->foo = 'baz';
7676

7777
$storageWithA = new SplObjectStorage;
78-
$storageWithA->attach($a);
78+
$storageWithA->offsetSet($a);
7979

8080
$storageWithoutA = new SplObjectStorage;
81-
$storageWithoutA->attach($b);
81+
$storageWithoutA->offsetSet($b);
8282

8383
$constraint = new TraversableContainsIdentical($a);
8484

0 commit comments

Comments
 (0)