Change if throw to throw_if
-if ($condition) {
- throw new Exception();
-}
-if (!$condition) {
- throw new Exception();
-}
+throw_if($condition, new Exception());
+throw_unless($condition, new Exception());
Configure your rector.php
:
<?php
use RectorLaravel\Rector\If_\ThrowIfRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
ThrowIfRector::class,
]);