From 407f9d4b0e035e6bb96e2b4f6e1ff6fa2653fdd1 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 7 Aug 2025 06:04:29 +0200 Subject: [PATCH] [Php85] Rename deprecated SplObjectStorage methods --- config/set/php85.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/config/set/php85.php b/config/set/php85.php index 03d0267f8fb..65cb5fe9ae7 100644 --- a/config/set/php85.php +++ b/config/set/php85.php @@ -4,7 +4,19 @@ use Rector\Config\RectorConfig; use Rector\Php85\Rector\ArrayDimFetch\ArrayFirstLastRector; +use Rector\Renaming\Rector\MethodCall\RenameMethodRector; +use Rector\Renaming\ValueObject\MethodCallRename; return static function (RectorConfig $rectorConfig): void { $rectorConfig->rules([ArrayFirstLastRector::class]); + + // https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_splobjectstoragecontains_splobjectstorageattach_and_splobjectstoragedetach + $rectorConfig->ruleWithConfiguration( + RenameMethodRector::class, + [ + new MethodCallRename('SplObjectStorage', 'contains', 'offsetExists'), + new MethodCallRename('SplObjectStorage', 'attach', 'offsetSet'), + new MethodCallRename('SplObjectStorage', 'detach', 'offsetUnset'), + ] + ); };