TypeHintTappableCallRector

Automatically type hints your tappable closures

-tap($collection, function ($collection) {}
+tap($collection, function (Collection $collection) {}

Configure your rector.php:

<?php

use RectorLaravel\Rector\FuncCall\TypeHintTappableCallRector;
use Rector\Config\RectorConfig;

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