2018-02-04 18:34:08 +01:00
|
|
|
<?php
|
2018-11-12 16:46:55 +01:00
|
|
|
namespace Psalm\Internal\Codebase;
|
2018-02-04 18:34:08 +01:00
|
|
|
|
2019-06-26 22:52:29 +02:00
|
|
|
use function strtolower;
|
|
|
|
|
2018-12-02 00:37:49 +01:00
|
|
|
/**
|
|
|
|
* @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()
|
|
|
|
{
|
|
|
|
if (self::$property_map !== null) {
|
|
|
|
return self::$property_map;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @var array<string, array<string, string>> */
|
2018-11-12 16:46:55 +01:00
|
|
|
$property_map = require_once(__DIR__ . '/../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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $class_name
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public static function inPropertyMap($class_name)
|
|
|
|
{
|
|
|
|
return isset(self::getPropertyMap()[strtolower($class_name)]);
|
|
|
|
}
|
|
|
|
}
|