Skip to content

Commit 47e3421

Browse files
Do not use SplObjectStorage methods that will be deprecated in PHP 8.5
1 parent b0b35ff commit 47e3421

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

ChangeLog.md

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

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

5+
## [5.0.1] - 2025-08-10
6+
7+
### Changed
8+
9+
* Do not use `SplObjectStorage` methods that will be deprecated in PHP 8.5
10+
511
## [5.0.0] - 2023-02-03
612

713
### Removed
@@ -39,6 +45,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
3945

4046
* Tests etc. are now ignored for archive exports
4147

48+
[5.0.1]: https://github.com/sebastianbergmann/recursion-context/compare/5.0.0...5.0.1
4249
[5.0.0]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.5...5.0.0
4350
[4.0.5]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.4...4.0.5
4451
[4.0.4]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.3...4.0.4

src/Context.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ private function addArray(array &$array): int
116116

117117
private function addObject(object $object): string
118118
{
119-
if (!$this->objects->contains($object)) {
120-
$this->objects->attach($object);
119+
if (!$this->objects->offsetExists($object)) {
120+
$this->objects->offsetSet($object);
121121
}
122122

123123
return spl_object_hash($object);
@@ -132,7 +132,7 @@ private function containsArray(array $array): false|int
132132

133133
private function containsObject(object $value): false|string
134134
{
135-
if ($this->objects->contains($value)) {
135+
if ($this->objects->offsetExists($value)) {
136136
return spl_object_hash($value);
137137
}
138138

0 commit comments

Comments
 (0)