Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into update_dictionaries
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Nov 30, 2024
2 parents 99ff70c + e1ec5dd commit 8b3a70a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions bin/normalize-callmap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

require 'vendor/autoload.php';

use DG\BypassFinals;
use Psalm\Internal\Analyzer\ProjectAnalyzer;
use Psalm\Internal\Provider\FileProvider;
use Psalm\Internal\Provider\Providers;
use Psalm\Tests\TestConfig;
use Psalm\Type;

BypassFinals::enable();

new ProjectAnalyzer(new TestConfig, new Providers(new FileProvider));

$codebase = ProjectAnalyzer::getInstance()->getCodebase();

chdir(__DIR__.'/../');

foreach (glob("dictionaries/CallMap*.php") as $file) {
$callMap = require $file;

array_walk_recursive($callMap, function (string &$type): void {
$type = Type::parseString($type === '' ? 'mixed' : $type)->getId(true);
});

file_put_contents($file, '<?php // phpcs:ignoreFile
return '.var_export($callMap, true).';');
}

0 comments on commit 8b3a70a

Please sign in to comment.