Configurable

ReplaceSessionWritesWithRequestSessionRector

Replace deprecated $_SESSION writes with \Drupal::request()->getSession()->set() (drupal:11.2.0)

-$_SESSION['my_key'] = $value;
+\Drupal::request()->getSession()->set('my_key', $value);

Configure your rector.php:

<?php

use DrupalRector\Drupal11\Rector\Deprecation\ReplaceSessionWritesWithRequestSessionRector;
use DrupalRector\Rector\ValueObject\DrupalIntroducedVersionConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(ReplaceSessionWritesWithRequestSessionRector::class, [
        new DrupalIntroducedVersionConfiguration('11.2.0'),
    ]);