Skip to content

Commit 6dd62fb

Browse files
committed
Upgrade to PHP-Parser 5.0
Since it supports typed class constants. Using the alpha 3 version for now.
1 parent f35e1d5 commit 6dd62fb

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

build/gen_stub.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ public function getNonNamespacedName(): string {
10221022
}
10231023

10241024
public function getDeclarationName(): string {
1025-
return implode('_', $this->name->parts);
1025+
return implode('_', $this->name->getParts());
10261026
}
10271027

10281028
public function getFunctionName(): string {
@@ -1034,12 +1034,12 @@ public function getDeclaration(): string {
10341034
}
10351035

10361036
public function getArgInfoName(): string {
1037-
$underscoreName = implode('_', $this->name->parts);
1037+
$underscoreName = implode('_', $this->name->getParts());
10381038
return "arginfo_$underscoreName";
10391039
}
10401040

10411041
public function getMethodSynopsisFilename(): string {
1042-
return implode('_', $this->name->parts);
1042+
return implode('_', $this->name->getParts());
10431043
}
10441044

10451045
public function getNameForAttributes(): string {
@@ -1073,7 +1073,7 @@ public function __construct(Name $className, string $methodName) {
10731073
}
10741074

10751075
public function getDeclarationClassName(): string {
1076-
return implode('_', $this->className->parts);
1076+
return implode('_', $this->className->getParts());
10771077
}
10781078

10791079
public function getDeclaration(): string {
@@ -2496,13 +2496,13 @@ public function getRegistration(iterable $allConstInfos): string
24962496
{
24972497
$params = [];
24982498
foreach ($this->extends as $extends) {
2499-
$params[] = "zend_class_entry *class_entry_" . implode("_", $extends->parts);
2499+
$params[] = "zend_class_entry *class_entry_" . implode("_", $extends->getParts());
25002500
}
25012501
foreach ($this->implements as $implements) {
2502-
$params[] = "zend_class_entry *class_entry_" . implode("_", $implements->parts);
2502+
$params[] = "zend_class_entry *class_entry_" . implode("_", $implements->getParts());
25032503
}
25042504

2505-
$escapedName = implode("_", $this->name->parts);
2505+
$escapedName = implode("_", $this->name->getParts());
25062506

25072507
$code = '';
25082508

@@ -2527,7 +2527,7 @@ public function getRegistration(iterable $allConstInfos): string
25272527
$code .= "\tzend_class_entry *class_entry = zend_register_internal_enum(\"$name\", $backingType, class_{$escapedName}_methods);\n";
25282528
} else {
25292529
$code .= "\tzend_class_entry ce, *class_entry;\n\n";
2530-
if (count($this->name->parts) > 1) {
2530+
if (count($this->name->getParts()) > 1) {
25312531
$className = $this->name->getLast();
25322532
$namespace = addslashes((string) $this->name->slice(0, -1));
25332533

@@ -2548,7 +2548,7 @@ public function getRegistration(iterable $allConstInfos): string
25482548

25492549
$implements = array_map(
25502550
function (Name $item) {
2551-
return "class_entry_" . implode("_", $item->parts);
2551+
return "class_entry_" . implode("_", $item->getParts());
25522552
},
25532553
$this->type === "interface" ? $this->extends : $this->implements
25542554
);
@@ -2917,7 +2917,7 @@ private static function createOoElement(
29172917
}
29182918

29192919
public static function getClassSynopsisFilename(Name $name): string {
2920-
return strtolower(str_replace("_", "-", implode('-', $name->parts)));
2920+
return strtolower(str_replace("_", "-", implode('-', $name->getParts())));
29212921
}
29222922

29232923
public static function getClassSynopsisReference(Name $name): string {
@@ -3797,8 +3797,8 @@ function parseStubFile(string $code): FileInfo {
37973797
$nodeTraverser = new PhpParser\NodeTraverser;
37983798
$nodeTraverser->addVisitor(new PhpParser\NodeVisitor\NameResolver);
37993799
$prettyPrinter = new class extends Standard {
3800-
protected function pName_FullyQualified(Name\FullyQualified $node) {
3801-
return implode('\\', $node->parts);
3800+
protected function pName_FullyQualified(Name\FullyQualified $node): string {
3801+
return implode('\\', $node->getParts());
38023802
}
38033803
};
38043804

@@ -4102,7 +4102,7 @@ function generateFunctionEntries(?Name $className, array $funcInfos, ?string $co
41024102

41034103
$functionEntryName = "ext_functions";
41044104
if ($className) {
4105-
$underscoreName = implode("_", $className->parts);
4105+
$underscoreName = implode("_", $className->getParts());
41064106
$functionEntryName = "class_{$underscoreName}_methods";
41074107
}
41084108

@@ -4685,7 +4685,7 @@ function initPhpParser() {
46854685
}
46864686

46874687
$isInitialized = true;
4688-
$version = "4.15.1";
4688+
$version = "5.0.0alpha3";
46894689
$phpParserDir = __DIR__ . "/PHP-Parser-$version";
46904690
if (!is_dir($phpParserDir)) {
46914691
installPhpParser($version, $phpParserDir);

0 commit comments

Comments
 (0)