Narrow @return docblock "bool" to "false" or "true" when the native return type only allows one of them
class SomeClass
{
/**
- * @return bool|string[]
+ * @return false|string[]
*/
public function run(): false|array
{
return false;
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\NarrowBoolDocblockReturnTypeRector;
return RectorConfig::configure()
->withRules([
NarrowBoolDocblockReturnTypeRector::class,
]);