/
PropertyMap.php
46 lines (37 loc) · 1.04 KB
/
PropertyMap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace Psalm\Internal\Codebase;
use function dirname;
use function strtolower;
/**
* @internal
*/
class PropertyMap
{
/**
* @var array<lowercase-string, array<string, string>>|null
*/
private static $property_map;
/**
* Gets the method/function call map
*
* @return array<lowercase-string, array<string, string>>
*/
public static function getPropertyMap(): array
{
if (self::$property_map !== null) {
return self::$property_map;
}
/** @var array<string, array<string, string>> */
$property_map = require(dirname(__DIR__, 4) . '/dictionaries/PropertyMap.php');
self::$property_map = [];
foreach ($property_map as $key => $value) {
$cased_key = strtolower($key);
self::$property_map[$cased_key] = $value;
}
return self::$property_map;
}
public static function inPropertyMap(string $class_name): bool
{
return isset(self::getPropertyMap()[strtolower($class_name)]);
}
}