Change dim assign on a Collection to clear ->set() call
use Doctrine\Common\Collections\Collection;
final class SomeClass
{
/**
* @var Collection<int, string>
*/
public $items;
public function setItem()
{
- $this->items['key'] = 'value';
+ $this->items->set('key', 'value');
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Doctrine\TypedCollections\Rector\Assign\ArrayOffsetSetToSetCollectionCallRector;
return RectorConfig::configure()
->withRules([
ArrayOffsetSetToSetCollectionCallRector::class,
]);