Skip to content

gen_stub: various simplifications and clean up (5) #18665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
gen_stub: replace AbstractConstName::isClassConst() with instanceof
  • Loading branch information
DanielEScherzer committed May 29, 2025
commit 4ce64c59a6274ade3f7953d40e45d50688effd90
16 changes: 2 additions & 14 deletions build/gen_stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,6 @@ public function getDeclarationName(): string;

abstract class AbstractConstName implements VariableLikeName
{
abstract public function isClassConst(): bool;

public function isUnknown(): bool
{
return strtolower($this->__toString()) === "unknown";
Expand All @@ -917,11 +915,6 @@ public function __construct(?Name $namespace, string $const)
$this->const = $const;
}

public function isClassConst(): bool
{
return false;
}

public function isUnknown(): bool
{
$name = $this->__toString();
Expand Down Expand Up @@ -952,11 +945,6 @@ public function __construct(Name $class, string $const)
$this->const = $const;
}

public function isClassConst(): bool
{
return true;
}

public function __toString(): string
{
return $this->class->toString() . "::" . $this->const;
Expand Down Expand Up @@ -2800,7 +2788,7 @@ public function getDeclaration(array $allConstInfos): string
$code .= "#if {$this->cond}\n";
}

if ($this->name->isClassConst()) {
if ($this->name instanceof ClassConstName) {
$code .= $this->getClassConstDeclaration($value, $allConstInfos);
} else {
$code .= $this->getGlobalConstDeclaration($value);
Expand Down Expand Up @@ -6276,7 +6264,7 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc

if ($verifyManual) {
foreach ($undocumentedConstMap as $constName => $info) {
if ($info->name->isClassConst() || $info->isUndocumentable) {
if ($info->name instanceof ClassConstName || $info->isUndocumentable) {
continue;
}

Expand Down