Skip to content
Permalink
Browse files

Apply @ShiraNai7’s fix for null const values

  • Loading branch information
muglug committed Nov 29, 2019
1 parent dc78e9c commit 6a98108deb32383640e01ee1c9fb749088347a67
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php
@@ -103,8 +103,8 @@ public static function getGlobalConstType(
$predefined_constants = $codebase->config->getPredefinedConstants();
if (($fq_const_name && isset($predefined_constants[$fq_const_name]))
|| isset($predefined_constants[$const_name])
if ($fq_const_name && array_key_exists($fq_const_name, $predefined_constants)
|| array_key_exists($const_name, $predefined_constants)
) {
switch ($const_name) {
case 'PHP_VERSION':
@@ -149,7 +149,7 @@ public static function getGlobalConstType(
return Type::getFloat();
}
if ($fq_const_name && isset($predefined_constants[$fq_const_name])) {
if ($fq_const_name && array_key_exists($fq_const_name, $predefined_constants)) {
return ClassLikeAnalyzer::getTypeFromValue($predefined_constants[$fq_const_name]);
}

0 comments on commit 6a98108

Please sign in to comment.
You can’t perform that action at this time.