From 12c89aa853155e91df49b2b484ef4df2c33e9851 Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Tue, 4 Feb 2025 10:03:56 -0800 Subject: [PATCH] gen_stub: merge `ConstOrClassConstName` interface into `AbstractConstName` Interface is only directly implemented by the abstract class, no need to have a separate interface. --- build/gen_stub.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/build/gen_stub.php b/build/gen_stub.php index be524edd5d4..d1cc441db7f 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -861,19 +861,15 @@ interface VariableLikeName { public function getDeclarationName(): string; } -interface ConstOrClassConstName extends VariableLikeName { - public function equals(ConstOrClassConstName $const): bool; - public function isClassConst(): bool; - public function isUnknown(): bool; -} - -abstract class AbstractConstName implements ConstOrClassConstName +abstract class AbstractConstName implements VariableLikeName { - public function equals(ConstOrClassConstName $const): bool + public function equals(AbstractConstName $const): bool { return $this->__toString() === $const->__toString(); } + abstract public function isClassConst(): bool; + public function isUnknown(): bool { return strtolower($this->__toString()) === "unknown"; @@ -2468,7 +2464,7 @@ abstract class VariableLike class ConstInfo extends VariableLike { - public /* readonly */ ConstOrClassConstName $name; + public /* readonly */ AbstractConstName $name; public /* readonly */ Expr $value; public bool $isDeprecated; public ?string $valueString; @@ -2481,7 +2477,7 @@ class ConstInfo extends VariableLike * @var AttributeInfo[] $attributes */ public function __construct( - ConstOrClassConstName $name, + AbstractConstName $name, int $flags, Expr $value, ?string $valueString, @@ -4455,7 +4451,7 @@ function parseFunctionLike( */ function parseConstLike( PrettyPrinterAbstract $prettyPrinter, - ConstOrClassConstName $name, + AbstractConstName $name, Node\Const_ $const, int $flags, ?Node $type,