Skip to content

Commit 62e4ac9

Browse files
committed
Add support for custom property links
Closes GH-7892
1 parent 0462719 commit 62e4ac9

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

build/gen_stub.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,8 @@ class PropertyInfo
13981398
public $defaultValueString;
13991399
/** @var bool */
14001400
public $isDocReadonly;
1401+
/** @var string|null */
1402+
public $link;
14011403

14021404
public function __construct(
14031405
PropertyName $name,
@@ -1406,7 +1408,8 @@ public function __construct(
14061408
?Type $phpDocType,
14071409
?Expr $defaultValue,
14081410
?string $defaultValueString,
1409-
bool $isDocReadonly
1411+
bool $isDocReadonly,
1412+
?string $link
14101413
) {
14111414
$this->name = $name;
14121415
$this->flags = $flags;
@@ -1415,6 +1418,7 @@ public function __construct(
14151418
$this->defaultValue = $defaultValue;
14161419
$this->defaultValueString = $defaultValueString;
14171420
$this->isDocReadonly = $isDocReadonly;
1421+
$this->link = $link;
14181422
}
14191423

14201424
public function discardInfoForOldPhpVersions(): void {
@@ -1542,7 +1546,11 @@ public function getFieldSynopsisElement(DOMDocument $doc): DOMElement
15421546

15431547
$className = str_replace(["\\", "_"], ["-", "-"], $this->name->class->toLowerString());
15441548
$varnameElement = $doc->createElement("varname", $this->name->property);
1545-
$varnameElement->setAttribute("linkend", "$className.props." . strtolower(str_replace("_", "-", $this->name->property)));
1549+
if ($this->link) {
1550+
$varnameElement->setAttribute("linkend", $this->link);
1551+
} else {
1552+
$varnameElement->setAttribute("linkend", "$className.props." . strtolower(str_replace("_", "-", $this->name->property)));
1553+
}
15461554
$fieldsynopsisElement->appendChild(new DOMText("\n "));
15471555
$fieldsynopsisElement->appendChild($varnameElement);
15481556

@@ -2372,6 +2380,7 @@ function parseProperty(
23722380
): PropertyInfo {
23732381
$phpDocType = null;
23742382
$isDocReadonly = false;
2383+
$link = null;
23752384

23762385
if ($comment) {
23772386
$tags = parseDocComment($comment);
@@ -2380,6 +2389,8 @@ function parseProperty(
23802389
$phpDocType = $tag->getType();
23812390
} elseif ($tag->name === 'readonly') {
23822391
$isDocReadonly = true;
2392+
} elseif ($tag->name === 'link') {
2393+
$link = $tag->value;
23832394
}
23842395
}
23852396
}
@@ -2407,7 +2418,8 @@ function parseProperty(
24072418
$phpDocType ? Type::fromString($phpDocType) : null,
24082419
$property->default,
24092420
$property->default ? $prettyPrinter->prettyPrintExpr($property->default) : null,
2410-
$isDocReadonly
2421+
$isDocReadonly,
2422+
$link
24112423
);
24122424
}
24132425

ext/mysqli/mysqli.stub.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,58 @@ final class mysqli_driver
2020

2121
class mysqli
2222
{
23+
/** @link mysqli.affected-rows */
2324
public int|string $affected_rows;
2425

26+
/** @link mysqli.get-client-info */
2527
public string $client_info;
2628

29+
/** @link mysqli.get-client-version */
2730
public int $client_version;
2831

32+
/** @link mysqli.connect-errno */
2933
public int $connect_errno;
3034

35+
/** @link mysqli.connect-error */
3136
public ?string $connect_error;
3237

38+
/** @link mysqli.errno */
3339
public int $errno;
3440

41+
/** @link mysqli.error */
3542
public string $error;
3643

44+
/** @link mysqli.error-list */
3745
public array $error_list;
3846

47+
/** @link mysqli.field-count */
3948
public int $field_count;
4049

50+
/** @link mysqli.get-host-info */
4151
public string $host_info;
4252

53+
/** @link mysqli.info */
4354
public ?string $info;
4455

56+
/** @link mysqli.insert-id */
4557
public int|string $insert_id;
4658

59+
/** @link mysqli.get-server-info */
4760
public string $server_info;
4861

62+
/** @link mysqli.get-server-version */
4963
public int $server_version;
5064

65+
/** @link mysqli.sqlstate */
5166
public string $sqlstate;
5267

68+
/** @link mysqli.get-proto-info */
5369
public int $protocol_version;
5470

71+
/** @link mysqli.thread-id */
5572
public int $thread_id;
5673

74+
/** @link mysqli.warning-count */
5775
public int $warning_count;
5876

5977
public function __construct(
@@ -355,12 +373,16 @@ public function refresh(int $flags): bool {}
355373

356374
class mysqli_result implements IteratorAggregate
357375
{
376+
/** @link mysqli-result.current-field */
358377
public int $current_field;
359378

379+
/** @link mysqli-result.field-count */
360380
public int $field_count;
361381

382+
/** @link mysqli-result.lengths */
362383
public ?array $lengths;
363384

385+
/** @link mysqli-result.num-rows */
364386
public int|string $num_rows;
365387

366388
public int $type;
@@ -458,22 +480,31 @@ public function getIterator(): Iterator {}
458480

459481
class mysqli_stmt
460482
{
483+
/** @link mysqli-stmt.affected-rows */
461484
public int|string $affected_rows;
462485

486+
/** @link mysqli-stmt.insert-id */
463487
public int|string $insert_id;
464488

489+
/** @link mysqli-stmt.num-rows */
465490
public int|string $num_rows;
466491

492+
/** @link mysqli-stmt.param-count */
467493
public int $param_count;
468494

495+
/** @link mysqli-stmt.field-count */
469496
public int $field_count;
470497

498+
/** @link mysqli-stmt.errno */
471499
public int $errno;
472500

501+
/** @link mysqli-stmt.error */
473502
public string $error;
474503

504+
/** @link mysqli-stmt.error-list */
475505
public array $error_list;
476506

507+
/** @link mysqli-stmt.sqlstate */
477508
public string $sqlstate;
478509

479510
public int $id;

ext/mysqli/mysqli_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: baf4cb58df96edeb4fc14e4703fe9363cf5ed784 */
2+
* Stub hash: 7901d2cbbf9663f2c0cc140870baed0fe04c2bd1 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
55
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)

0 commit comments

Comments
 (0)