diff options
Diffstat (limited to 'build/gen_stub.php')
-rwxr-xr-x | build/gen_stub.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/build/gen_stub.php b/build/gen_stub.php index 8e7d915452..e17e083cb4 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -359,9 +359,9 @@ interface FunctionOrMethodName { public function getDeclaration(): string; public function getArgInfoName(): string; public function __toString(): string; - public function isMagicMethod(): bool; public function isMethod(): bool; public function isConstructor(): bool; + public function isDestructor(): bool; } class FunctionName implements FunctionOrMethodName { @@ -403,15 +403,15 @@ class FunctionName implements FunctionOrMethodName { return $this->name->toString(); } - public function isMagicMethod(): bool { + public function isMethod(): bool { return false; } - public function isMethod(): bool { + public function isConstructor(): bool { return false; } - public function isConstructor(): bool { + public function isDestructor(): bool { return false; } } @@ -443,10 +443,6 @@ class MethodName implements FunctionOrMethodName { return "$this->className::$this->methodName"; } - public function isMagicMethod(): bool { - return strpos($this->methodName, '__') === 0; - } - public function isMethod(): bool { return true; } @@ -454,6 +450,10 @@ class MethodName implements FunctionOrMethodName { public function isConstructor(): bool { return $this->methodName === "__construct"; } + + public function isDestructor(): bool { + return $this->methodName === "__destruct"; + } } class ReturnInfo { @@ -879,7 +879,7 @@ function parseFunctionLike( } $returnType = $func->getReturnType(); - if ($returnType === null && !$haveDocReturnType && !$name->isMagicMethod()) { + if ($returnType === null && !$haveDocReturnType && !$name->isConstructor() && !$name->isDestructor()) { throw new Exception("Missing return type for function $name()"); } |