Fixer for PHPStan reports by strict type rule - "PHPStan\Rules\BooleansInConditions\BooleanInBooleanNotRule"
class SomeClass
{
public function run(string|null $name)
{
- if (! $name) {
+ if ($name === null) {
return 'no name';
}
return 'name';
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector;
return RectorConfig::configure()
->withConfiguredRule(BooleanInBooleanNotRuleFixerRector::class, [
'treat_as_non_empty' => true,
]);