Change count array comparison to empty array comparison to improve performance
-count($array) === 0;
-count($array) > 0;
-! count($array);
+$array === [];
+$array !== [];
+$array === [];
Configure your rector.php
:
<?php
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
CountArrayToEmptyArrayComparisonRector::class,
]);