@appthreat/atom-parsetools 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,4 +19,4 @@ if (PHP_VERSION_ID < 50600) {
19
19
 
20
20
  require_once __DIR__ . '/composer/autoload_real.php';
21
21
 
22
- return ComposerAutoloaderInit4ada460927b79cef097dac97641f1695::getLoader();
22
+ return ComposerAutoloaderInitb1096a2b08d571b985540b4492c44680::getLoader();
@@ -46,6 +46,7 @@ return array(
46
46
  'PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php',
47
47
  'PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php',
48
48
  'PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php',
49
+ 'PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php',
49
50
  'PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php',
50
51
  'PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php',
51
52
  'PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php',
@@ -2,7 +2,7 @@
2
2
 
3
3
  // autoload_real.php @generated by Composer
4
4
 
5
- class ComposerAutoloaderInit4ada460927b79cef097dac97641f1695
5
+ class ComposerAutoloaderInitb1096a2b08d571b985540b4492c44680
6
6
  {
7
7
  private static $loader;
8
8
 
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit4ada460927b79cef097dac97641f1695
22
22
  return self::$loader;
23
23
  }
24
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit4ada460927b79cef097dac97641f1695', 'loadClassLoader'), true, true);
25
+ spl_autoload_register(array('ComposerAutoloaderInitb1096a2b08d571b985540b4492c44680', 'loadClassLoader'), true, true);
26
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit4ada460927b79cef097dac97641f1695', 'loadClassLoader'));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitb1096a2b08d571b985540b4492c44680', 'loadClassLoader'));
28
28
 
29
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Composer\Autoload\ComposerStaticInit4ada460927b79cef097dac97641f1695::getInitializer($loader));
30
+ call_user_func(\Composer\Autoload\ComposerStaticInitb1096a2b08d571b985540b4492c44680::getInitializer($loader));
31
31
 
32
32
  $loader->register(true);
33
33
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  namespace Composer\Autoload;
6
6
 
7
- class ComposerStaticInit4ada460927b79cef097dac97641f1695
7
+ class ComposerStaticInitb1096a2b08d571b985540b4492c44680
8
8
  {
9
9
  public static $prefixLengthsPsr4 = array (
10
10
  'P' =>
@@ -61,6 +61,7 @@ class ComposerStaticInit4ada460927b79cef097dac97641f1695
61
61
  'PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php',
62
62
  'PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php',
63
63
  'PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php',
64
+ 'PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php',
64
65
  'PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php',
65
66
  'PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php',
66
67
  'PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php',
@@ -295,9 +296,9 @@ class ComposerStaticInit4ada460927b79cef097dac97641f1695
295
296
  public static function getInitializer(ClassLoader $loader)
296
297
  {
297
298
  return \Closure::bind(function () use ($loader) {
298
- $loader->prefixLengthsPsr4 = ComposerStaticInit4ada460927b79cef097dac97641f1695::$prefixLengthsPsr4;
299
- $loader->prefixDirsPsr4 = ComposerStaticInit4ada460927b79cef097dac97641f1695::$prefixDirsPsr4;
300
- $loader->classMap = ComposerStaticInit4ada460927b79cef097dac97641f1695::$classMap;
299
+ $loader->prefixLengthsPsr4 = ComposerStaticInitb1096a2b08d571b985540b4492c44680::$prefixLengthsPsr4;
300
+ $loader->prefixDirsPsr4 = ComposerStaticInitb1096a2b08d571b985540b4492c44680::$prefixDirsPsr4;
301
+ $loader->classMap = ComposerStaticInitb1096a2b08d571b985540b4492c44680::$classMap;
301
302
 
302
303
  }, null, ClassLoader::class);
303
304
  }
@@ -2,21 +2,20 @@
2
2
  "packages": [
3
3
  {
4
4
  "name": "nikic/php-parser",
5
- "version": "v5.7.0",
6
- "version_normalized": "5.7.0.0",
5
+ "version": "v5.8.0",
6
+ "version_normalized": "5.8.0.0",
7
7
  "source": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/nikic/PHP-Parser.git",
10
- "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82"
10
+ "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f"
11
11
  },
12
12
  "dist": {
13
13
  "type": "zip",
14
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82",
15
- "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82",
14
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
15
+ "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
16
16
  "shasum": ""
17
17
  },
18
18
  "require": {
19
- "ext-ctype": "*",
20
19
  "ext-json": "*",
21
20
  "ext-tokenizer": "*",
22
21
  "php": ">=7.4"
@@ -25,7 +24,7 @@
25
24
  "ircmaxell/php-yacc": "^0.0.7",
26
25
  "phpunit/phpunit": "^9.0"
27
26
  },
28
- "time": "2025-12-06T11:56:16+00:00",
27
+ "time": "2026-07-04T14:30:18+00:00",
29
28
  "bin": [
30
29
  "bin/php-parse"
31
30
  ],
@@ -57,7 +56,7 @@
57
56
  ],
58
57
  "support": {
59
58
  "issues": "https://github.com/nikic/PHP-Parser/issues",
60
- "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0"
59
+ "source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0"
61
60
  },
62
61
  "install-path": "../nikic/php-parser"
63
62
  }
@@ -1,9 +1,9 @@
1
1
  <?php return array(
2
2
  'root' => array(
3
3
  'name' => '__root__',
4
- 'pretty_version' => 'v1.4.0',
5
- 'version' => '1.4.0.0',
6
- 'reference' => 'f0a5257f9414e759bc4a433b007003ebb6d530cb',
4
+ 'pretty_version' => 'v1.5.0',
5
+ 'version' => '1.5.0.0',
6
+ 'reference' => '21c39993dc05f74643f5047de71f4bb65f0ead4a',
7
7
  'type' => 'library',
8
8
  'install_path' => __DIR__ . '/../../',
9
9
  'aliases' => array(),
@@ -11,18 +11,18 @@
11
11
  ),
12
12
  'versions' => array(
13
13
  '__root__' => array(
14
- 'pretty_version' => 'v1.4.0',
15
- 'version' => '1.4.0.0',
16
- 'reference' => 'f0a5257f9414e759bc4a433b007003ebb6d530cb',
14
+ 'pretty_version' => 'v1.5.0',
15
+ 'version' => '1.5.0.0',
16
+ 'reference' => '21c39993dc05f74643f5047de71f4bb65f0ead4a',
17
17
  'type' => 'library',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),
20
20
  'dev_requirement' => false,
21
21
  ),
22
22
  'nikic/php-parser' => array(
23
- 'pretty_version' => 'v5.7.0',
24
- 'version' => '5.7.0.0',
25
- 'reference' => 'dca41cd15c2ac9d055ad70dbfd011130757d1f82',
23
+ 'pretty_version' => 'v5.8.0',
24
+ 'version' => '5.8.0.0',
25
+ 'reference' => '044a6a392ff8ad0d61f14370a5fbbd0a0107152f',
26
26
  'type' => 'library',
27
27
  'install_path' => __DIR__ . '/../nikic/php-parser',
28
28
  'aliases' => array(),
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "require": {
3
- "nikic/php-parser": "5.7.0"
3
+ "nikic/php-parser": "5.8.0"
4
4
  }
5
5
  }
@@ -4,24 +4,23 @@
4
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
5
  "This file is @generated automatically"
6
6
  ],
7
- "content-hash": "4ada460927b79cef097dac97641f1695",
7
+ "content-hash": "b1096a2b08d571b985540b4492c44680",
8
8
  "packages": [
9
9
  {
10
10
  "name": "nikic/php-parser",
11
- "version": "v5.7.0",
11
+ "version": "v5.8.0",
12
12
  "source": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nikic/PHP-Parser.git",
15
- "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82"
15
+ "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f"
16
16
  },
17
17
  "dist": {
18
18
  "type": "zip",
19
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82",
20
- "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82",
19
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
20
+ "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
21
21
  "shasum": ""
22
22
  },
23
23
  "require": {
24
- "ext-ctype": "*",
25
24
  "ext-json": "*",
26
25
  "ext-tokenizer": "*",
27
26
  "php": ">=7.4"
@@ -60,9 +59,9 @@
60
59
  ],
61
60
  "support": {
62
61
  "issues": "https://github.com/nikic/PHP-Parser/issues",
63
- "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0"
62
+ "source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0"
64
63
  },
65
- "time": "2025-12-06T11:56:16+00:00"
64
+ "time": "2026-07-04T14:30:18+00:00"
66
65
  }
67
66
  ],
68
67
  "packages-dev": [],
@@ -15,8 +15,7 @@
15
15
  "require": {
16
16
  "php": ">=7.4",
17
17
  "ext-tokenizer": "*",
18
- "ext-json": "*",
19
- "ext-ctype": "*"
18
+ "ext-json": "*"
20
19
  },
21
20
  "require-dev": {
22
21
  "phpunit/phpunit": "^9.0",
@@ -215,9 +215,7 @@ class ConstExprEvaluator {
215
215
  case '<': return $this->evaluate($l) < $this->evaluate($r);
216
216
  case '<=': return $this->evaluate($l) <= $this->evaluate($r);
217
217
  case '<=>': return $this->evaluate($l) <=> $this->evaluate($r);
218
- case '|>':
219
- $lval = $this->evaluate($l);
220
- return $this->evaluate($r)($lval);
218
+ case '|>': return ($this->fallbackEvaluator)($expr);
221
219
  }
222
220
 
223
221
  throw new \Exception('Should not happen');
@@ -9,6 +9,7 @@ use PhpParser\Lexer\TokenEmulator\AsymmetricVisibilityTokenEmulator;
9
9
  use PhpParser\Lexer\TokenEmulator\AttributeEmulator;
10
10
  use PhpParser\Lexer\TokenEmulator\EnumTokenEmulator;
11
11
  use PhpParser\Lexer\TokenEmulator\ExplicitOctalEmulator;
12
+ use PhpParser\Lexer\TokenEmulator\FnTokenEmulator;
12
13
  use PhpParser\Lexer\TokenEmulator\MatchTokenEmulator;
13
14
  use PhpParser\Lexer\TokenEmulator\NullsafeTokenEmulator;
14
15
  use PhpParser\Lexer\TokenEmulator\PipeOperatorEmulator;
@@ -40,6 +41,7 @@ class Emulative extends Lexer {
40
41
  $this->hostPhpVersion = PhpVersion::getHostVersion();
41
42
 
42
43
  $emulators = [
44
+ new FnTokenEmulator(),
43
45
  new MatchTokenEmulator(),
44
46
  new NullsafeTokenEmulator(),
45
47
  new AttributeEmulator(),
@@ -0,0 +1,20 @@
1
+ <?php declare(strict_types=1);
2
+
3
+ namespace PhpParser\Lexer\TokenEmulator;
4
+
5
+ use PhpParser\PhpVersion;
6
+
7
+ // Retained for reverse emulation support only.
8
+ final class FnTokenEmulator extends KeywordEmulator {
9
+ public function getPhpVersion(): PhpVersion {
10
+ return PhpVersion::fromString('7.4');
11
+ }
12
+
13
+ public function getKeywordString(): string {
14
+ return 'fn';
15
+ }
16
+
17
+ public function getKeywordToken(): int {
18
+ return \T_FN;
19
+ }
20
+ }
@@ -14,7 +14,7 @@ abstract class KeywordEmulator extends TokenEmulator {
14
14
 
15
15
  /** @param Token[] $tokens */
16
16
  protected function isKeywordContext(array $tokens, int $pos): bool {
17
- $prevToken = $this->getPreviousNonSpaceToken($tokens, $pos);
17
+ $prevToken = $this->getPreviousNonIgnorableToken($tokens, $pos);
18
18
  if ($prevToken === null) {
19
19
  return false;
20
20
  }
@@ -35,13 +35,14 @@ abstract class KeywordEmulator extends TokenEmulator {
35
35
  }
36
36
 
37
37
  /** @param Token[] $tokens */
38
- private function getPreviousNonSpaceToken(array $tokens, int $start): ?Token {
38
+ private function getPreviousNonIgnorableToken(array $tokens, int $start): ?Token {
39
39
  for ($i = $start - 1; $i >= 0; --$i) {
40
- if ($tokens[$i]->id === T_WHITESPACE) {
40
+ $token = $tokens[$i];
41
+ if ($token->id === T_WHITESPACE || $token->id == T_COMMENT || $token->id === T_DOC_COMMENT) {
41
42
  continue;
42
43
  }
43
44
 
44
- return $tokens[$i];
45
+ return $token;
45
46
  }
46
47
 
47
48
  return null;
@@ -1078,6 +1078,13 @@ abstract class ParserAbstract implements Parser {
1078
1078
  $node->default->getAttributes()
1079
1079
  ));
1080
1080
  }
1081
+
1082
+ if ($node->type instanceof Identifier && $node->type->name === 'void') {
1083
+ $this->emitError(new Error(
1084
+ 'void cannot be used as a parameter type',
1085
+ $node->type->getAttributes()
1086
+ ));
1087
+ }
1081
1088
  }
1082
1089
 
1083
1090
  protected function checkTryCatch(TryCatch $node): void {
@@ -1006,9 +1006,25 @@ abstract class PrettyPrinterAbstract implements PrettyPrinter {
1006
1006
 
1007
1007
  list($findToken, $extraLeft, $extraRight) = $this->emptyListInsertionMap[$mapKey];
1008
1008
  if (null !== $findToken) {
1009
- $insertPos = $this->origTokens->findRight($pos, $findToken) + 1;
1010
- $result .= $this->origTokens->getTokenCode($pos, $insertPos, $indentAdjustment);
1011
- $pos = $insertPos;
1009
+ // For anon classes skip to the class keyword.
1010
+ $isAnonClassArgs = $mapKey === PrintableNewAnonClassNode::class . '->args';
1011
+ if ($isAnonClassArgs) {
1012
+ $insertPos = $this->origTokens->findRight($pos, \T_CLASS) + 1;
1013
+ $result .= $this->origTokens->getTokenCode($pos, $insertPos, $indentAdjustment);
1014
+ $pos = $insertPos;
1015
+ }
1016
+
1017
+ // If "new Foo" was used without arguments, we need to convert to "new Foo()".
1018
+ if (($mapKey === Expr\New_::class . '->args' || $isAnonClassArgs) &&
1019
+ !$this->origTokens->haveTokenImmediatelyAfter($pos - 1, '(')
1020
+ ) {
1021
+ $extraLeft = '(';
1022
+ $extraRight = ')';
1023
+ } else {
1024
+ $insertPos = $this->origTokens->findRight($pos, $findToken) + 1;
1025
+ $result .= $this->origTokens->getTokenCode($pos, $insertPos, $indentAdjustment);
1026
+ $pos = $insertPos;
1027
+ }
1012
1028
  }
1013
1029
 
1014
1030
  $first = true;
@@ -1293,7 +1309,7 @@ abstract class PrettyPrinterAbstract implements PrettyPrinter {
1293
1309
  $this->labelCharMap = [];
1294
1310
  for ($i = 0; $i < 256; $i++) {
1295
1311
  $chr = chr($i);
1296
- $this->labelCharMap[$chr] = $i >= 0x80 || ctype_alnum($chr);
1312
+ $this->labelCharMap[$chr] = (bool) preg_match('/^[a-zA-Z0-9_\x80-\xff]$/', $chr);
1297
1313
  }
1298
1314
 
1299
1315
  if ($this->phpVersion->allowsDelInIdentifiers()) {