Skip to content

Commit 4e216ed

Browse files
committed
Fix 8.1 compatibility on failing ci
1 parent 68014bb commit 4e216ed

1 file changed

Lines changed: 26 additions & 12 deletions

File tree

‎src/Internal/Generics/TemplateManager.php‎

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3369,19 +3369,33 @@ private static function extractLiteralConstValue(ConstTypeNode $node, bool &$ok)
33693369
$expr = $node->constExpr;
33703370
$ok = true;
33713371

3372-
return match (true) {
3373-
$expr instanceof ConstExprStringNode => $expr->value,
3374-
$expr instanceof ConstExprIntegerNode => (int) $expr->value,
3375-
$expr instanceof ConstExprFloatNode => (float) $expr->value,
3376-
$expr instanceof ConstExprTrueNode => true,
3377-
$expr instanceof ConstExprFalseNode => false,
3378-
$expr instanceof ConstExprNullNode => null,
3379-
default => (static function () use (&$ok): null {
3380-
$ok = false;
3372+
if ($expr instanceof ConstExprStringNode) {
3373+
return $expr->value;
3374+
}
33813375

3382-
return null;
3383-
})(),
3384-
};
3376+
if ($expr instanceof ConstExprIntegerNode) {
3377+
return (int) $expr->value;
3378+
}
3379+
3380+
if ($expr instanceof ConstExprFloatNode) {
3381+
return (float) $expr->value;
3382+
}
3383+
3384+
if ($expr instanceof ConstExprTrueNode) {
3385+
return true;
3386+
}
3387+
3388+
if ($expr instanceof ConstExprFalseNode) {
3389+
return false;
3390+
}
3391+
3392+
if ($expr instanceof ConstExprNullNode) {
3393+
return null;
3394+
}
3395+
3396+
$ok = false;
3397+
3398+
return null;
33853399
}
33863400

33873401
/**

0 commit comments

Comments
 (0)