Merge branch 'PHP-8.1'

* PHP-8.1:
  Add support for custom property links
This commit is contained in:
Máté Kocsis 2022-01-07 08:29:22 +01:00
commit 266667c234
No known key found for this signature in database
GPG Key ID: FD055E41728BF310
3 changed files with 47 additions and 4 deletions

View File

@ -1406,6 +1406,8 @@ class PropertyInfo
public $defaultValueString;
/** @var bool */
public $isDocReadonly;
/** @var string|null */
public $link;
public function __construct(
PropertyName $name,
@ -1414,7 +1416,8 @@ class PropertyInfo
?Type $phpDocType,
?Expr $defaultValue,
?string $defaultValueString,
bool $isDocReadonly
bool $isDocReadonly,
?string $link
) {
$this->name = $name;
$this->flags = $flags;
@ -1423,6 +1426,7 @@ class PropertyInfo
$this->defaultValue = $defaultValue;
$this->defaultValueString = $defaultValueString;
$this->isDocReadonly = $isDocReadonly;
$this->link = $link;
}
public function discardInfoForOldPhpVersions(): void {
@ -1550,7 +1554,11 @@ class PropertyInfo
$className = str_replace(["\\", "_"], ["-", "-"], $this->name->class->toLowerString());
$varnameElement = $doc->createElement("varname", $this->name->property);
$varnameElement->setAttribute("linkend", "$className.props." . strtolower(str_replace("_", "-", $this->name->property)));
if ($this->link) {
$varnameElement->setAttribute("linkend", $this->link);
} else {
$varnameElement->setAttribute("linkend", "$className.props." . strtolower(str_replace("_", "-", $this->name->property)));
}
$fieldsynopsisElement->appendChild(new DOMText("\n "));
$fieldsynopsisElement->appendChild($varnameElement);
@ -2384,6 +2392,7 @@ function parseProperty(
): PropertyInfo {
$phpDocType = null;
$isDocReadonly = false;
$link = null;
if ($comment) {
$tags = parseDocComment($comment);
@ -2392,6 +2401,8 @@ function parseProperty(
$phpDocType = $tag->getType();
} elseif ($tag->name === 'readonly') {
$isDocReadonly = true;
} elseif ($tag->name === 'link') {
$link = $tag->value;
}
}
}
@ -2419,7 +2430,8 @@ function parseProperty(
$phpDocType ? Type::fromString($phpDocType) : null,
$property->default,
$property->default ? $prettyPrinter->prettyPrintExpr($property->default) : null,
$isDocReadonly
$isDocReadonly,
$link
);
}

View File

@ -20,40 +20,58 @@ final class mysqli_driver
class mysqli
{
/** @link mysqli.affected-rows */
public int|string $affected_rows;
/** @link mysqli.get-client-info */
public string $client_info;
/** @link mysqli.get-client-version */
public int $client_version;
/** @link mysqli.connect-errno */
public int $connect_errno;
/** @link mysqli.connect-error */
public ?string $connect_error;
/** @link mysqli.errno */
public int $errno;
/** @link mysqli.error */
public string $error;
/** @link mysqli.error-list */
public array $error_list;
/** @link mysqli.field-count */
public int $field_count;
/** @link mysqli.get-host-info */
public string $host_info;
/** @link mysqli.info */
public ?string $info;
/** @link mysqli.insert-id */
public int|string $insert_id;
/** @link mysqli.get-server-info */
public string $server_info;
/** @link mysqli.get-server-version */
public int $server_version;
/** @link mysqli.sqlstate */
public string $sqlstate;
/** @link mysqli.get-proto-info */
public int $protocol_version;
/** @link mysqli.thread-id */
public int $thread_id;
/** @link mysqli.warning-count */
public int $warning_count;
public function __construct(
@ -355,12 +373,16 @@ class mysqli
class mysqli_result implements IteratorAggregate
{
/** @link mysqli-result.current-field */
public int $current_field;
/** @link mysqli-result.field-count */
public int $field_count;
/** @link mysqli-result.lengths */
public ?array $lengths;
/** @link mysqli-result.num-rows */
public int|string $num_rows;
public int $type;
@ -458,22 +480,31 @@ class mysqli_result implements IteratorAggregate
class mysqli_stmt
{
/** @link mysqli-stmt.affected-rows */
public int|string $affected_rows;
/** @link mysqli-stmt.insert-id */
public int|string $insert_id;
/** @link mysqli-stmt.num-rows */
public int|string $num_rows;
/** @link mysqli-stmt.param-count */
public int $param_count;
/** @link mysqli-stmt.field-count */
public int $field_count;
/** @link mysqli-stmt.errno */
public int $errno;
/** @link mysqli-stmt.error */
public string $error;
/** @link mysqli-stmt.error-list */
public array $error_list;
/** @link mysqli-stmt.sqlstate */
public string $sqlstate;
public int $id;

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: baf4cb58df96edeb4fc14e4703fe9363cf5ed784 */
* Stub hash: 7901d2cbbf9663f2c0cc140870baed0fe04c2bd1 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)