Skip to content

Instantly share code, notes, and snippets.

@cs278
Created September 4, 2026 09:46
Show Gist options
  • Select an option

  • Save cs278/efa30a8d29102580449af5d4672e52aa to your computer and use it in GitHub Desktop.

Select an option

Save cs278/efa30a8d29102580449af5d4672e52aa to your computer and use it in GitHub Desktop.
<?php
declare(strict_types=1);
use Symfony\Component\Yaml\Yaml;
require 'vendor/autoload.php';
$baseline = Yaml::parseFile('.phpstan-baseline.neon');
$errorFrequency = [];
foreach ($baseline['parameters']['ignoreErrors'] as $i => $ignoredError) {
$errorFrequency[$ignoredError['identifier']] = ($errorFrequency[$ignoredError['identifier']] ?? 0) + $ignoredError['count'];
if ($ignoredError['identifier'] === 'instanceof.alwaysTrue') {
unset($baseline['parameters']['ignoreErrors'][$i]);
}
}
$baseline['parameters']['ignoreErrors'] = array_values($baseline['parameters']['ignoreErrors']);
asort($errorFrequency, SORT_NUMERIC);
dump($errorFrequency);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment