AddReturnTypeWillChangeAttributeRector
Add #[\ReturnTypeWillChange] attribute to methods implementing PHP 8.1 interface methods with provisional return types, to suppress deprecation notices when running on PHP 8.1+ without the required return types
class SomeClass implements \ArrayAccess
{
+ #[\ReturnTypeWillChange]
public function offsetGet($offset)
{
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\DowngradePhp81\Rector\ClassMethod\AddReturnTypeWillChangeAttributeRector;
return RectorConfig::configure()
->withRules([
AddReturnTypeWillChangeAttributeRector::class,
]);