Add return type to closures based on known return values
-function () {
+function (): int {
return 100;
};
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector;
return RectorConfig::configure()
->withRules([
ClosureReturnTypeRector::class,
]);