Changes redundant null check to instant return
$newNode = 'something';
-if ($newNode !== null) {
- return $newNode;
-}
-
-return null;
+return $newNode;
Configure your rector.php
:
<?php
use Rector\CodeQuality\Rector\If_\SimplifyIfNotNullReturnRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
SimplifyIfNotNullReturnRector::class,
]);