FlipNegatedTernaryInstanceofRector

Flip negated ternary of instanceof to direct use of object

 class SomeClass
 {
     public function resolvePrice(object $object): ?int
     {
-        return ! $object instanceof Product ? null : $object->getPrice();
+        return $object instanceof Product ? $object->getPrice() : null;
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Instanceof_\Rector\Ternary\FlipNegatedTernaryInstanceofRector;

return RectorConfig::configure()
    ->withRules([
        FlipNegatedTernaryInstanceofRector::class,
    ]);

Other rules in the Code Quality set