Skip to content

Commit

Permalink
Fix non-dec int literal overflow behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
SerafimArts committed Nov 9, 2024
1 parent 22f7cec commit b2582d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Node/Literal/IntLiteralNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ private static function split(string $literal): array
if ($literal[0] === '0' && isset($literal[1])) {
return [$isNegative, match ($literal[1]) {

Check failure on line 51 in src/Node/Literal/IntLiteralNode.php

View workflow job for this annotation

GitHub Actions / Linter (8.3, ubuntu-latest)

Method TypeLang\Parser\Node\Literal\IntLiteralNode::split() should return array{bool, numeric-string} but returns array{bool, string}.
// hexadecimal
'x', 'X' => \hexdec(\substr($literal, 2)),
'x', 'X' => \base_convert(\substr($literal, 2), 16, 10),
// binary
'b', 'B' => \bindec(\substr($literal, 2)),
'b', 'B' => \base_convert(\substr($literal, 2), 2, 10),
// octal
'o', 'O' => \octdec(\substr($literal, 2)),
'o', 'O' => \base_convert(\substr($literal, 2), 8, 10),
// octal (legacy)
default => \octdec($literal),
default => \base_convert($literal, 8, 10),
}];
}

Expand Down

0 comments on commit b2582d0

Please sign in to comment.