SetTypeToCastRector

Changes settype() to (type) where possible

 class SomeClass
 {
     public function run($foo)
     {
-        settype($foo, 'string');
+        $foo = (string) $foo;

-        return settype($foo, 'integer');
+        return (int) $foo;
     }
 }

Configure your rector.php:

<?php

use Rector\CodeQuality\Rector\FuncCall\SetTypeToCastRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withRules([
        SetTypeToCastRector::class,
    ]);
SETS:  Code Quality