Review 13.4 Merged

90418[TASK] Replace deprecated `SplObjectStorage` method calls

Stefan Bürk CR +2 V +2 Normal +39 −39 updated 09/02/25, 15:36

Commit message

PHP8.5.0beta1 deprecated following `SplObjectStorage` methods:

* `SplObjectStorage::contains()` => `SplObjectStorage::offsetExists()`
* `SplObjectStorage::attach()` => `SplObjectStorage::offsetSet()`
* `SplObjectStorage::detach() => `SplObjectStorage::offsetUnset()`

Using these method emits deprecation notices considered as breaking by
us and are now replaced with the recommend replacements throughout or
codebase.

Used rector configuration:

  declare(strict_types=1);

  use Rector\Config\RectorConfig;
  use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
  use Rector\Renaming\ValueObject\MethodCallRename;

  return RectorConfig::configure()
    ->withPaths([
      __DIR__ . '/typo3/sysext',
    ])
    ->withConfiguredRule(RenameMethodRector::class, [
      new MethodCallRename(
        \SplObjectStorage::class,
       'contains',
       'offsetExists'
      ),
      new MethodCallRename(
        \SplObjectStorage::class,
       'attach',
       'offsetSet'
      ),
      new MethodCallRename(
        \SplObjectStorage::class,
        'detach',
        'offsetUnset'
      ),
    ]);

Used command(s):

> Build/Scripts/runTests.sh -s cglGit \
  && Build/Scripts/runTests.sh -s phpstan

[1] https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_splobjectstoragecontains_splobjectstorageattach_and_splobjectstoragedetach
[2] https://github.com/php/php-src/blob/5f477d9457de1d78536961fa5679b638102b6631/UPGRADING#L410-L414

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 14

Review log 1013

  1. Stefan Bürk uploaded patch set 1 08/16/25, 12:59

  2. Stefan Bürk updated the commit message in patch set 2 08/16/25, 13:01

  3. core-ci voted on patch set 1 V +1 08/16/25, 13:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83493

  4. core-ci voted on patch set 2 V +1 08/16/25, 13:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83495

  5. Simon Schaufelberger voted on patch set 2 CR +1 V +1 08/17/25, 06:25

  6. Oliver Klee voted on patch set 2 CR +1 V +1 08/17/25, 07:54

  7. Stefan Bürk voted on patch set 2 CR -2 08/17/25, 22:36

  8. Stefan Bürk uploaded patch set 3 CR +1 V +1 09/02/25, 12:47

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  9. Stefan Bürk voted on patch set 3 CR 0 09/02/25, 12:49

  10. core-ci voted on patch set 3 V +1 09/02/25, 12:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84249

  11. Garvin Hicking voted on patch set 3 CR +1 V +1 09/02/25, 15:06

  12. Stefan Bürk voted on patch set 3 CR +2 V +2 09/02/25, 15:36

  13. Stefan Bürk merged patch set 4 09/02/25, 15:36