1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-10 15:09:04 +01:00
psalm/src/Psalm/Internal/Codebase/PropertyMap.php

45 lines
1019 B
PHP
Raw Normal View History

2018-02-04 18:34:08 +01:00
<?php
namespace Psalm\Internal\Codebase;
2018-02-04 18:34:08 +01:00
use function strtolower;
/**
* @internal
*/
2018-02-04 18:34:08 +01:00
class PropertyMap
{
/**
* @var array<string, array<string, string>>|null
*/
private static $property_map;
/**
* Gets the method/function call map
*
* @return array<string, array<string, string>>
*/
public static function getPropertyMap(): array
2018-02-04 18:34:08 +01:00
{
if (self::$property_map !== null) {
return self::$property_map;
}
/** @var array<string, array<string, string>> */
2020-10-12 06:59:19 +02:00
$property_map = require(\dirname(__DIR__, 4) . '/dictionaries/PropertyMap.php');
2018-02-04 18:34:08 +01:00
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
2018-02-04 18:34:08 +01:00
{
return isset(self::getPropertyMap()[strtolower($class_name)]);
}
}