1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-15 02:47:02 +01:00
psalm/src/Psalm/Internal/Codebase/PropertyMap.php

50 lines
1.1 KiB
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
/**
* @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>>
* @psalm-suppress MixedInferredReturnType as the use of require buggers things up
* @psalm-suppress MixedAssignment
*/
public static function getPropertyMap()
{
if (self::$property_map !== null) {
return self::$property_map;
}
/** @var array<string, array<string, string>> */
$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)]);
}
}