Skip to content

Commit 95305a7

Browse files
committed
Normalize callmap
1 parent cdfeaaa commit 95305a7

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

bin/normalize-callmap.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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\Codebase\Reflection;
10+
use Psalm\Internal\Provider\FileProvider;
11+
use Psalm\Internal\Provider\Providers;
12+
use Psalm\Internal\Type\Comparator\UnionTypeComparator;
13+
use Psalm\Tests\TestConfig;
14+
use Psalm\Type;
15+
use Psalm\Type\Atomic\TNull;
16+
17+
BypassFinals::enable();
18+
19+
new ProjectAnalyzer(new TestConfig, new Providers(new FileProvider));
20+
21+
$codebase = ProjectAnalyzer::getInstance()->getCodebase();
22+
23+
chdir(__DIR__.'/../');
24+
25+
foreach (glob("dictionaries/CallMap*.php") as $file) {
26+
$callMap = require $file;
27+
28+
array_walk_recursive($callMap, function (string &$type): void {
29+
$type = Type::parseString($type === '' ? 'mixed' : $type)->getId(true);
30+
});
31+
32+
file_put_contents($file, '<?php // phpcs:ignoreFile
33+
34+
return '.var_export($callMap, true).';');
35+
36+
}
37+
38+

0 commit comments

Comments
 (0)