mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Check casing errors
This commit is contained in:
parent
03f7dc0651
commit
6365935850
@ -83,10 +83,25 @@ class ClassChecker implements StatementsSource
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset(self::$_existing_classes[$absolute_class]) && !class_exists($absolute_class, true) && !interface_exists($absolute_class, true)) {
|
||||
$absolute_class = preg_replace('/^\\\/', '', $absolute_class);
|
||||
|
||||
if (isset(self::$_existing_classes[$absolute_class])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!class_exists($absolute_class, true) && !interface_exists($absolute_class, true)) {
|
||||
throw new CodeException('Class ' . $absolute_class . ' does not exist', $file_name, $stmt->getLine());
|
||||
}
|
||||
|
||||
if (class_exists($absolute_class, true) && (strpos($absolute_class, 'Vimeo') === 0 || strpos($absolute_class, '\\') === false)) {
|
||||
$reflection_class = new \ReflectionClass($absolute_class);
|
||||
|
||||
if ($reflection_class->getName() !== $absolute_class) {
|
||||
var_dump($absolute_class, $reflection_class->getName());
|
||||
throw new CodeException('Class ' . $absolute_class . ' has wrong casing', $file_name, $stmt->getLine());
|
||||
}
|
||||
}
|
||||
|
||||
self::$_existing_classes[$absolute_class] = 1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user