Update besar apk finance

This commit is contained in:
Wian Drs
2026-09-11 16:03:00 +07:00
parent d42483b350
commit 4ef15c22ae
897 changed files with 98056 additions and 15979 deletions
+1 -2
View File
@@ -15,8 +15,7 @@
"require": {
"php": ">=7.4",
"ext-tokenizer": "*",
"ext-json": "*",
"ext-ctype": "*"
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
@@ -215,9 +215,7 @@ class ConstExprEvaluator {
case '<': return $this->evaluate($l) < $this->evaluate($r);
case '<=': return $this->evaluate($l) <= $this->evaluate($r);
case '<=>': return $this->evaluate($l) <=> $this->evaluate($r);
case '|>':
$lval = $this->evaluate($l);
return $this->evaluate($r)($lval);
case '|>': return ($this->fallbackEvaluator)($expr);
}
throw new \Exception('Should not happen');
@@ -9,6 +9,7 @@ use PhpParser\Lexer\TokenEmulator\AsymmetricVisibilityTokenEmulator;
use PhpParser\Lexer\TokenEmulator\AttributeEmulator;
use PhpParser\Lexer\TokenEmulator\EnumTokenEmulator;
use PhpParser\Lexer\TokenEmulator\ExplicitOctalEmulator;
use PhpParser\Lexer\TokenEmulator\FnTokenEmulator;
use PhpParser\Lexer\TokenEmulator\MatchTokenEmulator;
use PhpParser\Lexer\TokenEmulator\NullsafeTokenEmulator;
use PhpParser\Lexer\TokenEmulator\PipeOperatorEmulator;
@@ -40,6 +41,7 @@ class Emulative extends Lexer {
$this->hostPhpVersion = PhpVersion::getHostVersion();
$emulators = [
new FnTokenEmulator(),
new MatchTokenEmulator(),
new NullsafeTokenEmulator(),
new AttributeEmulator(),
@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
namespace PhpParser\Lexer\TokenEmulator;
use PhpParser\PhpVersion;
// Retained for reverse emulation support only.
final class FnTokenEmulator extends KeywordEmulator {
public function getPhpVersion(): PhpVersion {
return PhpVersion::fromString('7.4');
}
public function getKeywordString(): string {
return 'fn';
}
public function getKeywordToken(): int {
return \T_FN;
}
}
@@ -14,7 +14,7 @@ abstract class KeywordEmulator extends TokenEmulator {
/** @param Token[] $tokens */
protected function isKeywordContext(array $tokens, int $pos): bool {
$prevToken = $this->getPreviousNonSpaceToken($tokens, $pos);
$prevToken = $this->getPreviousNonIgnorableToken($tokens, $pos);
if ($prevToken === null) {
return false;
}
@@ -35,13 +35,14 @@ abstract class KeywordEmulator extends TokenEmulator {
}
/** @param Token[] $tokens */
private function getPreviousNonSpaceToken(array $tokens, int $start): ?Token {
private function getPreviousNonIgnorableToken(array $tokens, int $start): ?Token {
for ($i = $start - 1; $i >= 0; --$i) {
if ($tokens[$i]->id === T_WHITESPACE) {
$token = $tokens[$i];
if ($token->id === T_WHITESPACE || $token->id == T_COMMENT || $token->id === T_DOC_COMMENT) {
continue;
}
return $tokens[$i];
return $token;
}
return null;
@@ -1078,6 +1078,13 @@ abstract class ParserAbstract implements Parser {
$node->default->getAttributes()
));
}
if ($node->type instanceof Identifier && $node->type->name === 'void') {
$this->emitError(new Error(
'void cannot be used as a parameter type',
$node->type->getAttributes()
));
}
}
protected function checkTryCatch(TryCatch $node): void {
@@ -1006,9 +1006,25 @@ abstract class PrettyPrinterAbstract implements PrettyPrinter {
list($findToken, $extraLeft, $extraRight) = $this->emptyListInsertionMap[$mapKey];
if (null !== $findToken) {
$insertPos = $this->origTokens->findRight($pos, $findToken) + 1;
$result .= $this->origTokens->getTokenCode($pos, $insertPos, $indentAdjustment);
$pos = $insertPos;
// For anon classes skip to the class keyword.
$isAnonClassArgs = $mapKey === PrintableNewAnonClassNode::class . '->args';
if ($isAnonClassArgs) {
$insertPos = $this->origTokens->findRight($pos, \T_CLASS) + 1;
$result .= $this->origTokens->getTokenCode($pos, $insertPos, $indentAdjustment);
$pos = $insertPos;
}
// If "new Foo" was used without arguments, we need to convert to "new Foo()".
if (($mapKey === Expr\New_::class . '->args' || $isAnonClassArgs) &&
!$this->origTokens->haveTokenImmediatelyAfter($pos - 1, '(')
) {
$extraLeft = '(';
$extraRight = ')';
} else {
$insertPos = $this->origTokens->findRight($pos, $findToken) + 1;
$result .= $this->origTokens->getTokenCode($pos, $insertPos, $indentAdjustment);
$pos = $insertPos;
}
}
$first = true;
@@ -1293,7 +1309,7 @@ abstract class PrettyPrinterAbstract implements PrettyPrinter {
$this->labelCharMap = [];
for ($i = 0; $i < 256; $i++) {
$chr = chr($i);
$this->labelCharMap[$chr] = $i >= 0x80 || ctype_alnum($chr);
$this->labelCharMap[$chr] = (bool) preg_match('/^[a-zA-Z0-9_\x80-\xff]$/', $chr);
}
if ($this->phpVersion->allowsDelInIdentifiers()) {