gen_stub: replace AbstractConstName::isClassConst() with instanceof

This commit is contained in:
Daniel Scherzer 2025-05-14 13:55:02 -04:00
parent 8bd8223bad
commit e5d4d656ab

View file

@ -898,8 +898,6 @@ interface VariableLikeName {
abstract class AbstractConstName implements VariableLikeName
{
abstract public function isClassConst(): bool;
public function isUnknown(): bool
{
return strtolower($this->__toString()) === "unknown";
@ -917,11 +915,6 @@ class ConstName extends AbstractConstName {
$this->const = $const;
}
public function isClassConst(): bool
{
return false;
}
public function isUnknown(): bool
{
$name = $this->__toString();
@ -952,11 +945,6 @@ class ClassConstName extends AbstractConstName {
$this->const = $const;
}
public function isClassConst(): bool
{
return true;
}
public function __toString(): string
{
return $this->class->toString() . "::" . $this->const;
@ -2810,7 +2798,7 @@ class ConstInfo extends VariableLike
// Condition will be added by generateCodeWithConditions()
if ($this->name->isClassConst()) {
if ($this->name instanceof ClassConstName) {
$code = $this->getClassConstDeclaration($value, $allConstInfos);
} else {
$code = $this->getGlobalConstDeclaration($value);
@ -6388,7 +6376,7 @@ if ($generateOptimizerInfo) {
if ($verifyManual) {
foreach ($undocumentedConstMap as $constName => $info) {
if ($info->name->isClassConst() || $info->isUndocumentable) {
if ($info->name instanceof ClassConstName || $info->isUndocumentable) {
continue;
}