Configurable

DisallowedShortTernaryRuleFixerRector

Fixer for PHPStan reports by strict type rule - "PHPStan\Rules\DisallowedConstructs\DisallowedShortTernaryRule"

 final class ShortTernaryArray
 {
     public function run(array $array)
     {
-        return $array ?: 2;
+        return $array !== [] ? $array : 2;
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Strict\Rector\Ternary\DisallowedShortTernaryRuleFixerRector;

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