Skip to content

Commit 64af12d

Browse files
committed
Add support for @implementation-alias in stubs
Closes GH-6170
1 parent 3b67f18 commit 64af12d

25 files changed

+141
-133
lines changed

Zend/zend_exceptions.stub.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,40 +55,40 @@ final public function getSeverity(): int {}
5555

5656
class Error implements Throwable
5757
{
58-
/** @alias Exception::__clone */
58+
/** @implementation-alias Exception::__clone */
5959
final private function __clone() {}
6060

61-
/** @alias Exception::__construct */
61+
/** @implementation-alias Exception::__construct */
6262
public function __construct(string $message = UNKNOWN, int $code = 0, ?Throwable $previous = null) {}
6363

64-
/** @alias Exception::__wakeup */
64+
/** @implementation-alias Exception::__wakeup */
6565
public function __wakeup() {}
6666

67-
/** @alias Exception::getMessage */
67+
/** @implementation-alias Exception::getMessage */
6868
final public function getMessage(): string {}
6969

7070
/**
7171
* @return int
72-
* @alias Exception::getCode
72+
* @implementation-alias Exception::getCode
7373
*/
7474
final public function getCode() {}
7575

76-
/** @alias Exception::getFile */
76+
/** @implementation-alias Exception::getFile */
7777
final public function getFile(): string {}
7878

79-
/** @alias Exception::getLine */
79+
/** @implementation-alias Exception::getLine */
8080
final public function getLine(): int {}
8181

82-
/** @alias Exception::getTrace */
82+
/** @implementation-alias Exception::getTrace */
8383
final public function getTrace(): array {}
8484

85-
/** @alias Exception::getPrevious */
85+
/** @implementation-alias Exception::getPrevious */
8686
final public function getPrevious(): ?Throwable {}
8787

88-
/** @alias Exception::getTraceAsString */
88+
/** @implementation-alias Exception::getTraceAsString */
8989
final public function getTraceAsString(): string {}
9090

91-
/** @alias Exception::__toString */
91+
/** @implementation-alias Exception::__toString */
9292
public function __toString(): string {}
9393
}
9494

Zend/zend_exceptions_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 7eb20393f4ca314324d9813983124f724189ce8a */
2+
* Stub hash: d0679a3c11f089dcb31cfdfe56f0336ceba301a9 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Throwable_getMessage, 0, 0, IS_STRING, 0)
55
ZEND_END_ARG_INFO()

build/gen_stub.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ class FuncInfo {
362362
public $name;
363363
/** @var int */
364364
public $flags;
365+
/** @var string|null */
366+
public $aliasType;
365367
/** @var FunctionName|null */
366368
public $alias;
367369
/** @var bool */
@@ -378,6 +380,7 @@ class FuncInfo {
378380
public function __construct(
379381
FunctionName $name,
380382
int $flags,
383+
?string $aliasType,
381384
?FunctionName $alias,
382385
bool $isDeprecated,
383386
array $args,
@@ -387,6 +390,7 @@ public function __construct(
387390
) {
388391
$this->name = $name;
389392
$this->flags = $flags;
393+
$this->aliasType = $aliasType;
390394
$this->alias = $alias;
391395
$this->isDeprecated = $isDeprecated;
392396
$this->args = $args;
@@ -617,6 +621,7 @@ function parseFunctionLike(
617621
): FuncInfo {
618622
$comment = $func->getDocComment();
619623
$paramMeta = [];
624+
$aliasType = null;
620625
$alias = null;
621626
$isDeprecated = false;
622627
$haveDocReturnType = false;
@@ -631,7 +636,8 @@ function parseFunctionLike(
631636
$paramMeta[$varName] = [];
632637
}
633638
$paramMeta[$varName]['preferRef'] = true;
634-
} else if ($tag->name === 'alias') {
639+
} else if ($tag->name === 'alias' || $tag->name === 'implementation-alias') {
640+
$aliasType = $tag->name;
635641
$aliasParts = explode("::", $tag->getValue());
636642
if (count($aliasParts) === 1) {
637643
$alias = new FunctionName(null, $aliasParts[0]);
@@ -721,6 +727,7 @@ function parseFunctionLike(
721727
return new FuncInfo(
722728
$name,
723729
$flags,
730+
$aliasType,
724731
$alias,
725732
$isDeprecated,
726733
$args,

0 commit comments

Comments
 (0)