Add closure return type void if there is no return
-function () {
+function (): void {
};
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector;
return RectorConfig::configure()
->withRules([
AddClosureVoidReturnTypeWhereNoReturnRector::class,
]);