Use null coalescing operator ??=
$array = [];
-$array['user_id'] = $array['user_id'] ?? 'value';
+$array['user_id'] ??= 'value';
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php74\Rector\Assign\NullCoalescingOperatorRector;
return RectorConfig::configure()
->withRules([
NullCoalescingOperatorRector::class,
]);