Add declare(strict_types=1) if missing and only if the file is type-safe (no scalar type coercions).
+declare(strict_types=1);
+
function acceptsInt(int $value): void
{
}
acceptsInt(5);
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\SafeDeclareStrictTypesRector;
return RectorConfig::configure()
->withRules([
SafeDeclareStrictTypesRector::class,
]);