1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix #1173 - transform const X = true to a true type

This commit is contained in:
Matthew Brown 2019-01-21 16:55:50 -05:00
parent 930a8b2689
commit 99569e8ee3
2 changed files with 14 additions and 1 deletions

View File

@ -987,7 +987,7 @@ class StatementsAnalyzer extends SourceAnalyzer implements StatementsSource
if (strtolower($stmt->name->parts[0]) === 'false') {
return Type::getFalse();
} elseif (strtolower($stmt->name->parts[0]) === 'true') {
return Type::getBool();
return Type::getTrue();
} elseif (strtolower($stmt->name->parts[0]) === 'null') {
return Type::getNull();
}

View File

@ -833,6 +833,19 @@ class FunctionCallTest extends TestCase
'$a' => 'string',
],
],
'varExportConstFetch' => [
'<?php
class Foo {
const BOOL_VAR_EXPORT_RETURN = true;
/**
* @param mixed $mixed
*/
public static function Baz($mixed) : string {
return var_export($mixed, self::BOOL_VAR_EXPORT_RETURN);
}
}',
],
'key' => [
'<?php
$a = ["one" => 1, "two" => 3];