DateWhereClauseToShorthandRector

Replace date comparison where clauses with Laravel query builder shorthand methods.

 use Carbon\Carbon;

-$query->where('published_at', '<', Carbon::now());
-$query->whereDate('published_at', '=', Carbon::today());
-$query->where('published_at', '<=', now());
-$query->whereDate('published_at', '>=', today());
+$query->wherePast('published_at');
+$query->whereToday('published_at');
+$query->whereNowOrPast('published_at');
+$query->whereTodayOrAfter('published_at');

Configure your rector.php:

<?php

use RectorLaravel\Rector\MethodCall\DateWhereClauseToShorthandRector;
use Rector\Config\RectorConfig;

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