Skip to content

Commit 8b3a70a

Browse files
committed
Merge remote-tracking branch 'origin/master' into update_dictionaries
2 parents 99ff70c + e1ec5dd commit 8b3a70a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

bin/normalize-callmap.php

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
require 'vendor/autoload.php';
6+
7+
use DG\BypassFinals;
8+
use Psalm\Internal\Analyzer\ProjectAnalyzer;
9+
use Psalm\Internal\Provider\FileProvider;
10+
use Psalm\Internal\Provider\Providers;
11+
use Psalm\Tests\TestConfig;
12+
use Psalm\Type;
13+
14+
BypassFinals::enable();
15+
16+
new ProjectAnalyzer(new TestConfig, new Providers(new FileProvider));
17+
18+
$codebase = ProjectAnalyzer::getInstance()->getCodebase();
19+
20+
chdir(__DIR__.'/../');
21+
22+
foreach (glob("dictionaries/CallMap*.php") as $file) {
23+
$callMap = require $file;
24+
25+
array_walk_recursive($callMap, function (string &$type): void {
26+
$type = Type::parseString($type === '' ? 'mixed' : $type)->getId(true);
27+
});
28+
29+
file_put_contents($file, '<?php // phpcs:ignoreFile
30+
31+
return '.var_export($callMap, true).';');
32+
}

0 commit comments

Comments
 (0)