Change $this->assertNull() on Collection object to $this->assertEmpty() in tests
use Doctrine\Common\Collections\Collection;
final class SomeClass extends \PHPUnit\Framework\TestCase
{
private Collection $items;
public function test(): void
{
- $this->assertNull($this->items);
+ $this->assertEmpty($this->items);
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Doctrine\TypedCollections\Rector\MethodCall\AssertNullOnCollectionToAssertEmptyRector;
return RectorConfig::configure()
->withRules([
AssertNullOnCollectionToAssertEmptyRector::class,
]);