CollectionCountComparisonToIsEmptyRector

Convert collection count() comparisons against 0 or 1 to isEmpty() or isNotEmpty()

 use Illuminate\Support\Collection;

 $collection = new Collection([1, 2, 3]);
-$collection->count() > 0;
-$collection->count() === 0;
+$collection->isNotEmpty();
+$collection->isEmpty();

Configure your rector.php:

<?php

use RectorLaravel\Rector\Expr\CollectionCountComparisonToIsEmptyRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withRules([
        CollectionCountComparisonToIsEmptyRector::class,
    ]);

Other rules in the Collection set