Configurable

BooleanInIfConditionRuleFixerRector

Fixer for PHPStan reports by strict type rule - "PHPStan\Rules\BooleansInConditions\BooleanInIfConditionRule"

 final class NegatedString
 {
     public function run(string $name)
     {
-        if ($name) {
+        if ($name !== '') {
             return 'name';
         }

         return 'no name';
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;

return RectorConfig::configure()
    ->withConfiguredRule(BooleanInIfConditionRuleFixerRector::class, [
        'treat_as_non_empty' => false,
    ]);
SETS:  Strict Booleans