Review 12.4 Merged

90419[TASK] Replace deprecated `SplObjectStorage` method calls

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

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 1014

  1. Stefan Bürk uploaded patch set 1 08/16/25, 13:06

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

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

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

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

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

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

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

  9. Stefan Bürk rebased onto 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**")
  10. Stefan Bürk voted on patch set 3 CR 0 09/02/25, 12:49

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

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

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

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