Convert empty() on a Collection to ->isEmpty() call
class SomeClass
{
/**
* @var Collection<int, string>
*/
private $collection;
public function someMethod()
{
- if (empty($this->collection)) {
+ if ($this->collection->isEmpty()) {
// ...
}
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Doctrine\TypedCollections\Rector\Empty_\EmptyOnCollectionToIsEmptyCallRector;
return RectorConfig::configure()
->withRules([
EmptyOnCollectionToIsEmptyCallRector::class,
]);