mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Update gen_stubs.php to generate C enums from internal enums, when the stub is annotated with @generate-c-enums. Enum values can be compared to the result of zend_enum_fetch_case_id(zend_object*).
The generated enums are added to separate files named {$extensionName}_decl.h, so that it's possible to include these from anywhere. _arginfo.h files would generate warnings if we tried to include them in a compilation unit that doesn't call the register_{$class} functions, for instance.
Introduce Z_PARAM_ENUM().
* Make ZEND_AST_CONST_ENUM_INIT a 4-children node
* Store enum case id in ZEND_AST_CONST_ENUM_INIT
* Store enum case id in instance
* Expose enum case_id internally
* Generate C enum for internal enums
* Introduce Z_PARAM_ENUM()
* Port extensions
225 lines
6.6 KiB
PHP
225 lines
6.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @generate-class-entries
|
|
* @generate-c-enums
|
|
*/
|
|
|
|
namespace Uri {
|
|
/** @strict-properties */
|
|
class UriException extends \Exception
|
|
{
|
|
}
|
|
|
|
/** @strict-properties */
|
|
class UriError extends \Error
|
|
{
|
|
}
|
|
|
|
/** @strict-properties */
|
|
class InvalidUriException extends \Uri\UriException
|
|
{
|
|
}
|
|
|
|
enum UriComparisonMode
|
|
{
|
|
case IncludeFragment;
|
|
case ExcludeFragment;
|
|
}
|
|
}
|
|
|
|
namespace Uri\Rfc3986 {
|
|
/** @strict-properties */
|
|
final readonly class Uri
|
|
{
|
|
public static function parse(string $uri, ?\Uri\Rfc3986\Uri $baseUrl = null): ?static {}
|
|
|
|
public function __construct(string $uri, ?\Uri\Rfc3986\Uri $baseUrl = null) {}
|
|
|
|
public function getScheme(): ?string {}
|
|
|
|
public function getRawScheme(): ?string {}
|
|
|
|
public function withScheme(?string $scheme): static {}
|
|
|
|
public function getUserInfo(): ?string {}
|
|
|
|
public function getRawUserInfo(): ?string {}
|
|
|
|
public function withUserInfo(#[\SensitiveParameter] ?string $userinfo): static {}
|
|
|
|
public function getUsername(): ?string {}
|
|
|
|
public function getRawUsername(): ?string {}
|
|
|
|
public function getPassword(): ?string {}
|
|
|
|
public function getRawPassword(): ?string {}
|
|
|
|
public function getHost(): ?string {}
|
|
|
|
public function getRawHost(): ?string {}
|
|
|
|
public function withHost(?string $host): static {}
|
|
|
|
public function getPort(): ?int {}
|
|
|
|
public function withPort(?int $port): static {}
|
|
|
|
public function getPath(): string {}
|
|
|
|
public function getRawPath(): string {}
|
|
|
|
public function withPath(string $path): static {}
|
|
|
|
public function getQuery(): ?string {}
|
|
|
|
public function getRawQuery(): ?string {}
|
|
|
|
public function withQuery(?string $query): static {}
|
|
|
|
public function getFragment(): ?string {}
|
|
|
|
public function getRawFragment(): ?string {}
|
|
|
|
public function withFragment(?string $fragment): static {}
|
|
|
|
public function equals(\Uri\Rfc3986\Uri $uri, \Uri\UriComparisonMode $comparisonMode = \Uri\UriComparisonMode::ExcludeFragment): bool {}
|
|
|
|
public function toString(): string {}
|
|
|
|
public function toRawString(): string {}
|
|
|
|
public function resolve(string $uri): static {}
|
|
|
|
public function __serialize(): array {}
|
|
|
|
public function __unserialize(array $data): void {}
|
|
|
|
public function __debugInfo(): array {}
|
|
}
|
|
}
|
|
|
|
namespace Uri\WhatWg {
|
|
/** @strict-properties */
|
|
class InvalidUrlException extends \Uri\InvalidUriException
|
|
{
|
|
public readonly array $errors;
|
|
|
|
public function __construct(string $message = "", array $errors = [], int $code = 0, ?\Throwable $previous = null) {}
|
|
}
|
|
|
|
enum UrlValidationErrorType
|
|
{
|
|
case DomainToAscii;
|
|
case DomainToUnicode;
|
|
case DomainInvalidCodePoint;
|
|
case HostInvalidCodePoint;
|
|
case Ipv4EmptyPart;
|
|
case Ipv4TooManyParts;
|
|
case Ipv4NonNumericPart;
|
|
case Ipv4NonDecimalPart;
|
|
case Ipv4OutOfRangePart;
|
|
case Ipv6Unclosed;
|
|
case Ipv6InvalidCompression;
|
|
case Ipv6TooManyPieces;
|
|
case Ipv6MultipleCompression;
|
|
case Ipv6InvalidCodePoint;
|
|
case Ipv6TooFewPieces;
|
|
case Ipv4InIpv6TooManyPieces;
|
|
case Ipv4InIpv6InvalidCodePoint;
|
|
case Ipv4InIpv6OutOfRangePart;
|
|
case Ipv4InIpv6TooFewParts;
|
|
case InvalidUrlUnit;
|
|
case SpecialSchemeMissingFollowingSolidus;
|
|
case MissingSchemeNonRelativeUrl;
|
|
case InvalidReverseSoldius;
|
|
case InvalidCredentials;
|
|
case HostMissing;
|
|
case PortOutOfRange;
|
|
case PortInvalid;
|
|
case FileInvalidWindowsDriveLetter;
|
|
case FileInvalidWindowsDriveLetterHost;
|
|
}
|
|
|
|
/** @strict-properties */
|
|
final readonly class UrlValidationError
|
|
{
|
|
public string $context;
|
|
public \Uri\WhatWg\UrlValidationErrorType $type;
|
|
public bool $failure;
|
|
|
|
public function __construct(string $context, \Uri\WhatWg\UrlValidationErrorType $type, bool $failure) {}
|
|
}
|
|
|
|
/** @strict-properties */
|
|
final readonly class Url
|
|
{
|
|
/** @param array $errors */
|
|
public static function parse(string $uri, ?\Uri\WhatWg\Url $baseUrl = null, &$errors = null): ?static {}
|
|
|
|
/** @param array $softErrors */
|
|
public function __construct(string $uri, ?\Uri\WhatWg\Url $baseUrl = null, &$softErrors = null) {}
|
|
|
|
public function getScheme(): string {}
|
|
|
|
public function withScheme(string $scheme): static {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::getUsername */
|
|
public function getUsername(): ?string {}
|
|
|
|
public function withUsername(?string $username): static {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::getPassword */
|
|
public function getPassword(): ?string {}
|
|
|
|
public function withPassword(#[\SensitiveParameter] ?string $password): static {}
|
|
|
|
public function getAsciiHost(): ?string {}
|
|
|
|
public function getUnicodeHost(): ?string {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::withHost */
|
|
public function withHost(?string $host): static {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::getPort */
|
|
public function getPort(): ?int {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::withPort */
|
|
public function withPort(?int $port): static {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::getPath */
|
|
public function getPath(): string {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::withPath */
|
|
public function withPath(string $path): static {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::getQuery */
|
|
public function getQuery(): ?string {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::withQuery */
|
|
public function withQuery(?string $query): static {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::getFragment */
|
|
public function getFragment(): ?string {}
|
|
|
|
/** @implementation-alias Uri\Rfc3986\Uri::withFragment */
|
|
public function withFragment(?string $fragment): static {}
|
|
|
|
public function equals(\Uri\WhatWg\Url $url, \Uri\UriComparisonMode $comparisonMode = \Uri\UriComparisonMode::ExcludeFragment): bool {}
|
|
|
|
public function toAsciiString(): string {}
|
|
|
|
public function toUnicodeString(): string {}
|
|
|
|
/** @param array $softErrors */
|
|
public function resolve(string $uri, &$softErrors = null): static {}
|
|
|
|
public function __serialize(): array {}
|
|
|
|
public function __unserialize(array $data): void {}
|
|
|
|
public function __debugInfo(): array {}
|
|
}
|
|
}
|