Skip to content

Commit 266667c

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Add support for custom property links
2 parents b9e8d93 + 62e4ac9 commit 266667c

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
@@ -1406,6 +1406,8 @@ class PropertyInfo
14061406
public $defaultValueString;
14071407
/** @var bool */
14081408
public $isDocReadonly;
1409+
/** @var string|null */
1410+
public $link;
14091411

14101412
public function __construct(
14111413
PropertyName $name,
@@ -1414,7 +1416,8 @@ public function __construct(
14141416
?Type $phpDocType,
14151417
?Expr $defaultValue,
14161418
?string $defaultValueString,
1417-
bool $isDocReadonly
1419+
bool $isDocReadonly,
1420+
?string $link
14181421
) {
14191422
$this->name = $name;
14201423
$this->flags = $flags;
@@ -1423,6 +1426,7 @@ public function __construct(
14231426
$this->defaultValue = $defaultValue;
14241427
$this->defaultValueString = $defaultValueString;
14251428
$this->isDocReadonly = $isDocReadonly;
1429+
$this->link = $link;
14261430
}
14271431

14281432
public function discardInfoForOldPhpVersions(): void {
@@ -1550,7 +1554,11 @@ public function getFieldSynopsisElement(DOMDocument $doc): DOMElement
15501554

15511555
$className = str_replace(["\\", "_"], ["-", "-"], $this->name->class->toLowerString());
15521556
$varnameElement = $doc->createElement("varname", $this->name->property);
1553-
$varnameElement->setAttribute("linkend", "$className.props." . strtolower(str_replace("_", "-", $this->name->property)));
1557+
if ($this->link) {
1558+
$varnameElement->setAttribute("linkend", $this->link);
1559+
} else {
1560+
$varnameElement->setAttribute("linkend", "$className.props." . strtolower(str_replace("_", "-", $this->name->property)));
1561+
}
15541562
$fieldsynopsisElement->appendChild(new DOMText("\n "));
15551563
$fieldsynopsisElement->appendChild($varnameElement);
15561564

@@ -2384,6 +2392,7 @@ function parseProperty(
23842392
): PropertyInfo {
23852393
$phpDocType = null;
23862394
$isDocReadonly = false;
2395+
$link = null;
23872396

23882397
if ($comment) {
23892398
$tags = parseDocComment($comment);
@@ -2392,6 +2401,8 @@ function parseProperty(
23922401
$phpDocType = $tag->getType();
23932402
} elseif ($tag->name === 'readonly') {
23942403
$isDocReadonly = true;
2404+
} elseif ($tag->name === 'link') {
2405+
$link = $tag->value;
23952406
}
23962407
}
23972408
}
@@ -2419,7 +2430,8 @@ function parseProperty(
24192430
$phpDocType ? Type::fromString($phpDocType) : null,
24202431
$property->default,
24212432
$property->default ? $prettyPrinter->prettyPrintExpr($property->default) : null,
2422-
$isDocReadonly
2433+
$isDocReadonly,
2434+
$link
24232435
);
24242436
}
24252437

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)