Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SerafimArts committed Nov 9, 2024
1 parent b2582d0 commit 504821f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Node/Literal/IntLiteralNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ private static function split(string $literal): array
{
$literal = \str_replace('_', '', $literal);

if ($isNegative = ($literal[0] === '-')) {
if ($negative = ($literal[0] === '-')) {
$literal = \substr($literal, 1);
}

// One of: [ 0123, 0o23, 0x00, 0b01 ]
if ($literal[0] === '0' && isset($literal[1])) {
return [$isNegative, match ($literal[1]) {
/** @var array{bool, numeric-string} */
return [$negative, match ($literal[1]) {
// hexadecimal
'x', 'X' => \base_convert(\substr($literal, 2), 16, 10),
// binary
Expand All @@ -60,7 +61,8 @@ private static function split(string $literal): array
}];
}

return [$isNegative, $literal];
/** @var array{bool, numeric-string} */
return [$negative, $literal];
}

public function getValue(): int
Expand Down

0 comments on commit 504821f

Please sign in to comment.