ext/spl: Deprecate SplObjectStorage::contains(), SplObjectStorage::attach(), and SplObjectStorage::detach()#19424
Conversation
* Prefer `offsetSet` over deprecated `attach` `SplObjectStorage::attach()` is deprecated since PHP v8.5; `SplObjectStorage::offsetSet()` should be used instead [1]. [1]: php/php-src#19424
|
Folks, I'm very glad about the effort to Improve language coherence for the behaviour of offsets and containers because there really are many inconsistencies here. However, I'm concerned that this change is a step in the wrong direction.
$storage[$obj] = 'value';
foreach ($storage as $key => $value) // $key = 'value' and $value = $objThis is very unfortunate. The only thing about the
I see this as a major step backward. If the goal is to solve the problem with method overriding in child classes, a better solution can certainly be found. Therefore, I ask you to please keep the |
`SplObjectStorage::attach()` was deprecated with PHP 8.5 [1]. Its usage is replaced by `SplObjectStorage::offsetSet()`, which provides the same functionality. [1]: php/php-src#19424
* Added php 8.5 tests * Updated keywords * Prefer `offsetSet` over deprecated `attach` (#161) * Prefer `offsetSet` over deprecated `attach` `SplObjectStorage::attach()` is deprecated since PHP v8.5; `SplObjectStorage::offsetSet()` should be used instead [1]. [1]: php/php-src#19424 * Added test * Updated README --------- Co-authored-by: Elias Häußler <elias@haeussler.dev>
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_splobjectstoragecontains_splobjectstorageattach_and_splobjectstoragedetach