Merge branch 'PHP-8.0'

This commit is contained in:
Máté Kocsis 2020-10-16 11:00:05 +02:00
commit e73bf01f9d
No known key found for this signature in database
GPG Key ID: FD055E41728BF310
28 changed files with 264 additions and 116 deletions

View File

@ -12,7 +12,12 @@ use PhpParser\PrettyPrinterAbstract;
error_reporting(E_ALL);
function processDirectory(string $dir, Context $context) {
/**
* @return FileInfo[]
*/
function processDirectory(string $dir, Context $context): array {
$fileInfos = [];
$it = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dir),
RecursiveIteratorIterator::LEAVES_ONLY
@ -20,12 +25,17 @@ function processDirectory(string $dir, Context $context) {
foreach ($it as $file) {
$pathName = $file->getPathName();
if (preg_match('/\.stub\.php$/', $pathName)) {
processStubFile($pathName, $context);
$fileInfo = processStubFile($pathName, $context);
if ($fileInfo) {
$fileInfos[] = $fileInfo;
}
}
}
return $fileInfos;
}
function processStubFile(string $stubFile, Context $context) {
function processStubFile(string $stubFile, Context $context): ?FileInfo {
try {
if (!file_exists($stubFile)) {
throw new Exception("File $stubFile does not exist");
@ -37,15 +47,15 @@ function processStubFile(string $stubFile, Context $context) {
$stubCode = file_get_contents($stubFile);
$stubHash = computeStubHash($stubCode);
$oldStubHash = extractStubHash($arginfoFile);
if ($stubHash === $oldStubHash && $context->forceRegeneration === false) {
if ($stubHash === $oldStubHash && !$context->forceParse) {
/* Stub file did not change, do not regenerate. */
return;
return null;
}
initPhpParser();
$fileInfo = parseStubFile($stubCode);
$arginfoCode = generateArgInfoCode($fileInfo, $stubHash);
if (file_put_contents($arginfoFile, $arginfoCode)) {
if (($context->forceRegeneration || $stubHash !== $oldStubHash) && file_put_contents($arginfoFile, $arginfoCode)) {
echo "Saved $arginfoFile\n";
}
@ -54,20 +64,12 @@ function processStubFile(string $stubFile, Context $context) {
$funcInfo->discardInfoForOldPhpVersions();
}
$arginfoCode = generateArgInfoCode($fileInfo, $stubHash);
if (file_put_contents($legacyFile, $arginfoCode)) {
if (($context->forceRegeneration || $stubHash !== $oldStubHash) && file_put_contents($legacyFile, $arginfoCode)) {
echo "Saved $legacyFile\n";
}
}
// Collect parameter name statistics.
foreach ($fileInfo->getAllFuncInfos() as $funcInfo) {
foreach ($funcInfo->args as $argInfo) {
if (!isset($context->parameterStats[$argInfo->name])) {
$context->parameterStats[$argInfo->name] = 0;
}
$context->parameterStats[$argInfo->name]++;
}
}
return $fileInfo;
} catch (Exception $e) {
echo "In $stubFile:\n{$e->getMessage()}\n";
exit(1);
@ -92,10 +94,10 @@ function extractStubHash(string $arginfoFile): ?string {
}
class Context {
/** @var bool */
public $forceParse = false;
/** @var bool */
public $forceRegeneration = false;
/** @var array */
public $parameterStats = [];
}
class SimpleType {
@ -358,6 +360,8 @@ interface FunctionOrMethodName {
public function getArgInfoName(): string;
public function __toString(): string;
public function isMagicMethod(): bool;
public function isMethod(): bool;
public function isConstructor(): bool;
}
class FunctionName implements FunctionOrMethodName {
@ -402,6 +406,14 @@ class FunctionName implements FunctionOrMethodName {
public function isMagicMethod(): bool {
return false;
}
public function isMethod(): bool {
return false;
}
public function isConstructor(): bool {
return false;
}
}
class MethodName implements FunctionOrMethodName {
@ -434,6 +446,14 @@ class MethodName implements FunctionOrMethodName {
public function isMagicMethod(): bool {
return strpos($this->methodName, '__') === 0;
}
public function isMethod(): bool {
return true;
}
public function isConstructor(): bool {
return $this->methodName === "__construct";
}
}
class ReturnInfo {
@ -457,6 +477,8 @@ class FuncInfo {
/** @var FunctionOrMethodName */
public $name;
/** @var int */
public $classFlags;
/** @var int */
public $flags;
/** @var string|null */
public $aliasType;
@ -464,6 +486,8 @@ class FuncInfo {
public $alias;
/** @var bool */
public $isDeprecated;
/** @var bool */
public $verify;
/** @var ArgInfo[] */
public $args;
/** @var ReturnInfo */
@ -475,26 +499,45 @@ class FuncInfo {
public function __construct(
FunctionOrMethodName $name,
int $classFlags,
int $flags,
?string $aliasType,
?FunctionOrMethodName $alias,
bool $isDeprecated,
bool $verify,
array $args,
ReturnInfo $return,
int $numRequiredArgs,
?string $cond
) {
$this->name = $name;
$this->classFlags = $classFlags;
$this->flags = $flags;
$this->aliasType = $aliasType;
$this->alias = $alias;
$this->isDeprecated = $isDeprecated;
$this->verify = $verify;
$this->args = $args;
$this->return = $return;
$this->numRequiredArgs = $numRequiredArgs;
$this->cond = $cond;
}
public function isMethod(): bool
{
return $this->name->isMethod();
}
public function isFinalMethod(): bool
{
return ($this->flags & Class_::MODIFIER_FINAL) || ($this->classFlags & Class_::MODIFIER_FINAL);
}
public function isInstanceMethod(): bool
{
return !($this->flags & Class_::MODIFIER_STATIC) && $this->isMethod() && !$this->name->isConstructor();
}
public function equalsApartFromName(FuncInfo $other): bool {
if (count($this->args) !== count($other->args)) {
return false;
@ -732,6 +775,7 @@ function parseDocComment(DocComment $comment): array {
function parseFunctionLike(
PrettyPrinterAbstract $prettyPrinter,
FunctionOrMethodName $name,
int $classFlags,
int $flags,
Node\FunctionLike $func,
?string $cond
@ -741,6 +785,7 @@ function parseFunctionLike(
$aliasType = null;
$alias = null;
$isDeprecated = false;
$verify = true;
$haveDocReturnType = false;
$docParamTypes = [];
@ -763,6 +808,8 @@ function parseFunctionLike(
}
} else if ($tag->name === 'deprecated') {
$isDeprecated = true;
} else if ($tag->name === 'no-verify') {
$verify = false;
} else if ($tag->name === 'return') {
$haveDocReturnType = true;
} else if ($tag->name === 'param') {
@ -843,10 +890,12 @@ function parseFunctionLike(
return new FuncInfo(
$name,
$classFlags,
$flags,
$aliasType,
$alias,
$isDeprecated,
$verify,
$args,
$return,
$numRequiredArgs,
@ -917,6 +966,7 @@ function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstrac
$prettyPrinter,
new FunctionName($stmt->namespacedName),
0,
0,
$stmt,
$cond
);
@ -936,6 +986,11 @@ function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstrac
throw new Exception("Not implemented {$classStmt->getType()}");
}
$classFlags = 0;
if ($stmt instanceof Class_) {
$classFlags = $stmt->flags;
}
$flags = $classStmt->flags;
if ($stmt instanceof Stmt\Interface_) {
$flags |= Class_::MODIFIER_ABSTRACT;
@ -948,6 +1003,7 @@ function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstrac
$methodInfos[] = parseFunctionLike(
$prettyPrinter,
new MethodName($className, $classStmt->name->toString()),
$classFlags,
$flags,
$classStmt,
$cond
@ -1262,29 +1318,132 @@ function initPhpParser() {
}
$optind = null;
$options = getopt("fh", ["force-regeneration", "parameter-stats", "help"], $optind);
$options = getopt("fh", ["force-regeneration", "parameter-stats", "help", "verify"], $optind);
$context = new Context;
$printParameterStats = isset($options["parameter-stats"]);
$context->forceRegeneration =
isset($options["f"]) || isset($options["force-regeneration"]) || $printParameterStats;
$verify = isset($options["verify"]);
$context->forceRegeneration = isset($options["f"]) || isset($options["force-regeneration"]);
$context->forceParse = $context->forceRegeneration || $printParameterStats || $verify;
if (isset($options["h"]) || isset($options["help"])) {
die("\nusage: gen-stub.php [ -f | --force-regeneration ] [ --parameter-stats ] [ -h | --help ] [ name.stub.php | directory ]\n\n");
die("\nusage: gen-stub.php [ -f | --force-regeneration ] [ --parameter-stats ] [ --verify ] [ -h | --help ] [ name.stub.php | directory ]\n\n");
}
$fileInfos = [];
$location = $argv[$optind] ?? ".";
if (is_file($location)) {
// Generate single file.
processStubFile($location, $context);
$fileInfo = processStubFile($location, $context);
if ($fileInfo) {
$fileInfos[] = $fileInfo;
}
} else if (is_dir($location)) {
processDirectory($location, $context);
$fileInfos = processDirectory($location, $context);
} else {
echo "$location is neither a file nor a directory.\n";
exit(1);
}
if ($printParameterStats) {
arsort($context->parameterStats);
echo json_encode($context->parameterStats, JSON_PRETTY_PRINT), "\n";
$parameterStats = [];
foreach ($fileInfos as $fileInfo) {
foreach ($fileInfo->getAllFuncInfos() as $funcInfo) {
foreach ($funcInfo->args as $argInfo) {
if (!isset($context->parameterStats[$argInfo->name])) {
$parameterStats[$argInfo->name] = 0;
}
$parameterStats[$argInfo->name]++;
}
}
}
arsort($parameterStats);
echo json_encode($parameterStats, JSON_PRETTY_PRINT), "\n";
}
if ($verify) {
$errors = [];
$funcMap = [];
$aliases = [];
foreach ($fileInfos as $fileInfo) {
foreach ($fileInfo->getAllFuncInfos() as $funcInfo) {
/** @var FuncInfo $funcInfo */
$funcMap[$funcInfo->name->__toString()] = $funcInfo;
if ($funcInfo->aliasType === "alias") {
$aliases[] = $funcInfo;
}
}
}
foreach ($aliases as $aliasFunc) {
if (!isset($funcMap[$aliasFunc->alias->__toString()])) {
$errors[] = "Aliased function {$aliasFunc->alias}() cannot be found";
continue;
}
if (!$aliasFunc->verify) {
continue;
}
$aliasedFunc = $funcMap[$aliasFunc->alias->__toString()];
$aliasedArgs = $aliasedFunc->args;
$aliasArgs = $aliasFunc->args;
if ($aliasFunc->isInstanceMethod() !== $aliasedFunc->isInstanceMethod()) {
if ($aliasFunc->isInstanceMethod()) {
$aliasedArgs = array_slice($aliasedArgs, 1);
}
if ($aliasedFunc->isInstanceMethod()) {
$aliasArgs = array_slice($aliasArgs, 1);
}
}
array_map(
function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc, &$errors) {
if ($aliasArg === null) {
assert($aliasedArg !== null);
$errors[] = "{$aliasFunc->name}(): Argument \$$aliasedArg->name of aliased function {$aliasedFunc->name}() is missing";
return null;
}
if ($aliasedArg === null) {
assert($aliasArg !== null);
$errors[] = "{$aliasedFunc->name}(): Argument \$$aliasArg->name of alias function {$aliasFunc->name}() is missing";
return null;
}
if ($aliasArg->name !== $aliasedArg->name) {
$errors[] = "{$aliasFunc->name}(): Argument \$$aliasArg->name and argument \$$aliasedArg->name of aliased function {$aliasedFunc->name}() must have the same name";
return null;
}
if ($aliasArg->type != $aliasedArg->type) {
$errors[] = "{$aliasFunc->name}(): Argument \$$aliasArg->name and argument \$$aliasedArg->name of aliased function {$aliasedFunc->name}() must have the same type";
}
if ($aliasArg->defaultValue !== $aliasedArg->defaultValue) {
$errors[] = "{$aliasFunc->name}(): Argument \$$aliasArg->name and argument \$$aliasedArg->name of aliased function {$aliasedFunc->name}() must have the same default value";
}
},
$aliasArgs, $aliasedArgs
);
if ((!$aliasedFunc->isMethod() || $aliasedFunc->isFinalMethod()) &&
(!$aliasFunc->isMethod() || $aliasFunc->isFinalMethod()) &&
$aliasFunc->return != $aliasedFunc->return
) {
$errors[] = "{$aliasFunc->name}() and {$aliasedFunc->name}() must have the same return type";
}
}
echo implode("\n", $errors);
if (!empty($errors)) {
echo "\n";
exit(1);
}
}

View File

@ -13,19 +13,19 @@ function bzread($bz, int $length = 1024): string|false {}
/**
* @param resource $bz
* @alias fwrite
* @implementation-alias fwrite
*/
function bzwrite($bz, string $data, ?int $length = null): int|false {}
/**
* @param resource $bz
* @alias fflush
* @implementation-alias fflush
*/
function bzflush($bz): bool {}
/**
* @param resource $bz
* @alias fclose
* @implementation-alias fclose
*/
function bzclose($bz): bool {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 6953f91be31777e4d4e3652f75eec6d968cf636a */
* Stub hash: 0cd7792480671883ebae30ae8358b8f8e3390474 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_bzopen, 0, 0, 2)
ZEND_ARG_INFO(0, file)

View File

@ -69,7 +69,7 @@ function date_time_set(
function date_date_set(DateTime $object, int $year, int $month, int $day): DateTime {}
function date_isodate_set(DateTime $object, int $year, int $week, int $day = 1): DateTime {}
function date_isodate_set(DateTime $object, int $year, int $week, int $dayOfWeek = 1): DateTime {}
function date_timestamp_set(DateTime $object, int $timestamp): DateTime {}
@ -291,7 +291,7 @@ class DateTimeImmutable implements DateTimeInterface
* @return DateInterval|false
* @alias date_diff
*/
public function diff(DateTimeInterface $object, bool $absolute = false) {}
public function diff(DateTimeInterface $targetObject, bool $absolute = false) {}
/** @return DateTimeImmutable|false */
public function modify(string $modifier) {}
@ -337,7 +337,7 @@ class DateTimeZone
* @return int
* @alias timezone_offset_get
*/
public function getOffset(DateTimeInterface $object) {}
public function getOffset(DateTimeInterface $datetime) {}
/**
* @return array|false

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 561c6ad41ccedfc8b778d3b64323c7154dffcdb5 */
* Stub hash: 04954b7aac5b3ee8e789b3ddd254ad5eda299c2b */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, datetime, IS_STRING, 0)
@ -143,7 +143,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_isodate_set, 0, 3, DateTime,
ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, week, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, day, IS_LONG, 0, "1")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, dayOfWeek, IS_LONG, 0, "1")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_timestamp_set, 0, 2, DateTime, 0)
@ -335,10 +335,7 @@ ZEND_END_ARG_INFO()
#define arginfo_class_DateTimeImmutable_getTimestamp arginfo_class_DateTimeInterface_getTimezone
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeImmutable_diff, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, absolute, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()
#define arginfo_class_DateTimeImmutable_diff arginfo_class_DateTimeInterface_diff
#define arginfo_class_DateTimeImmutable_modify arginfo_class_DateTime_modify
@ -371,7 +368,7 @@ ZEND_END_ARG_INFO()
#define arginfo_class_DateTimeZone_getName arginfo_class_DateTimeInterface_getTimezone
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getOffset, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getTransitions, 0, 0, 0)

View File

@ -15,4 +15,4 @@ try {
?>
--EXPECT--
3600
DateTimeZone::getOffset(): Argument #1 ($object) must be of type DateTimeInterface, int given
DateTimeZone::getOffset(): Argument #1 ($datetime) must be of type DateTimeInterface, int given

View File

@ -218,11 +218,11 @@ class IntlCalendar
public function isWeekend(?float $timestamp = null) {}
/**
* @param int|bool $amountOrUpOrDown
* @param int|bool $value
* @return bool
* @alias intlcal_roll
*/
public function roll(int $field, $amountOrUpOrDown) {}
public function roll(int $field, $value) {}
/**
* @return bool

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: cac6d4040481ab7de4775315079b1d28a44cbcac */
* Stub hash: ee755d4a500e2d1ba4d589c233b7d09a06b5cce8 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar___construct, 0, 0, 0)
ZEND_END_ARG_INFO()
@ -106,7 +106,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_roll, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
ZEND_ARG_INFO(0, amountOrUpOrDown)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
#define arginfo_class_IntlCalendar_isSet arginfo_class_IntlCalendar_get

View File

@ -89,7 +89,7 @@ function intlcal_set_repeated_wall_time_option(IntlCalendar $calendar, int $opti
function intlcal_set_skipped_wall_time_option(IntlCalendar $calendar, int $option): bool {}
function intlcal_from_date_time(DateTime|string $dateTime, ?string $locale = null): ?IntlCalendar {}
function intlcal_from_date_time(DateTime|string $datetime, ?string $locale = null): ?IntlCalendar {}
function intlcal_to_date_time(IntlCalendar $calendar): DateTime|false {}
@ -131,7 +131,7 @@ function collator_sort(Collator $object, array &$array, int $flags = Collator::S
function collator_sort_with_sort_keys(Collator $object, array &$array): bool {}
function collator_asort(Collator $object, array &$arr, int $flags = Collator::SORT_REGULAR): bool {}
function collator_asort(Collator $object, array &$array, int $flags = Collator::SORT_REGULAR): bool {}
function collator_get_locale(Collator $object, int $type): string|false {}
@ -349,7 +349,7 @@ function resourcebundle_create(?string $locale, ?string $bundle, bool $fallback
* @param string|int $index
* @return mixed
*/
function resourcebundle_get(ResourceBundle $bundle, $index) {}
function resourcebundle_get(ResourceBundle $bundle, $index, bool $fallback = true) {}
function resourcebundle_count(ResourceBundle $bundle): int {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 8340252225ea91a68fe61657f20c08a1876949c8 */
* Stub hash: c890e3cde79ffeade4623001cc369aa734812959 */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null")
@ -162,7 +162,7 @@ ZEND_END_ARG_INFO()
#define arginfo_intlcal_set_skipped_wall_time_option arginfo_intlcal_set_repeated_wall_time_option
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_from_date_time, 0, 1, IntlCalendar, 1)
ZEND_ARG_OBJ_TYPE_MASK(0, dateTime, DateTime, MAY_BE_STRING, NULL)
ZEND_ARG_OBJ_TYPE_MASK(0, datetime, DateTime, MAY_BE_STRING, NULL)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, locale, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
@ -242,11 +242,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_collator_sort_with_sort_keys, 0,
ZEND_ARG_TYPE_INFO(1, array, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_collator_asort, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
ZEND_ARG_TYPE_INFO(1, arr, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "Collator::SORT_REGULAR")
ZEND_END_ARG_INFO()
#define arginfo_collator_asort arginfo_collator_sort
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_collator_get_locale, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
@ -637,6 +633,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_resourcebundle_get, 0, 0, 2)
ZEND_ARG_OBJ_INFO(0, bundle, ResourceBundle, 0)
ZEND_ARG_INFO(0, index)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fallback, _IS_BOOL, 0, "true")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_resourcebundle_count, 0, 1, IS_LONG, 0)

View File

@ -66,7 +66,7 @@ class IntlTimeZone
* @return string|false
* @alias intltz_get_equivalent_id
*/
public static function getEquivalentID(string $timezoneId, int $index) {}
public static function getEquivalentID(string $timezoneId, int $offset) {}
/**
* @return int|false

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 6bdd65d7ba5a32b32c96511e391beb876d9d20c3 */
* Stub hash: afd0e74b29d54cde9789787b924af9b43539a7f4 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone___construct, 0, 0, 0)
ZEND_END_ARG_INFO()
@ -41,7 +41,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_getEquivalentID, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, timezoneId, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
ZEND_END_ARG_INFO()
#define arginfo_class_IntlTimeZone_getErrorCode arginfo_class_IntlTimeZone___construct

View File

@ -9,7 +9,7 @@ final class mysqli_driver
class mysqli
{
public function __construct(
?string $host = null,
?string $hostname = null,
?string $username = null,
?string $password = null,
?string $database = null,
@ -56,9 +56,10 @@ class mysqli
/**
* @return mysqli|null|false
* @alias mysqli_connect
* @no-verify
*/
public function connect(
?string $host = null,
?string $hostname = null,
?string $username = null,
?string $password = null,
?string $database = null,
@ -75,6 +76,7 @@ class mysqli
/**
* @return bool
* @alias mysqli_debug
* @no-verify Should really be a static method
*/
public function debug(string $options) {}
@ -112,7 +114,6 @@ class mysqli
/**
* @return mysqli|false
* @alias mysqli_init_method
*/
public function init() {}
@ -171,7 +172,7 @@ class mysqli
* @alias mysqli_real_connect
*/
public function real_connect(
?string $host = null,
?string $hostname = null,
?string $username = null,
?string $password = null,
?string $database = null,
@ -535,7 +536,7 @@ function mysqli_close(mysqli $mysql): bool {}
function mysqli_commit(mysqli $mysql, int $flags = -1, ?string $name = null): bool {}
function mysqli_connect(
?string $host = null,
?string $hostname = null,
?string $username = null,
?string $password = null,
?string $database = null,
@ -551,7 +552,7 @@ function mysqli_data_seek(mysqli_result $result, int $offset): bool {}
function mysqli_dump_debug_info(mysqli $mysql): bool {}
function mysqli_debug(string $debug): bool {}
function mysqli_debug(string $options): bool {}
function mysqli_errno(mysqli $mysql): int {}
@ -568,7 +569,7 @@ function mysqli_fetch_field(mysqli_result $result): object|false {}
function mysqli_fetch_fields(mysqli_result $result): array {}
function mysqli_fetch_field_direct(mysqli_result $result, int $offset): object|false {}
function mysqli_fetch_field_direct(mysqli_result $result, int $index): object|false {}
function mysqli_fetch_lengths(mysqli_result $result): array|false {}
@ -651,7 +652,7 @@ function mysqli_query(mysqli $mysql, string $query, int $result_mode = MYSQLI_ST
function mysqli_real_connect(
mysqli $mysql,
?string $host = null,
?string $hostname = null,
?string $username = null,
?string $password = null,
?string $database = null,

View File

@ -1482,13 +1482,6 @@ PHP_FUNCTION(mysqli_init)
}
/* }}} */
/* {{{ Initialize mysqli and return a resource for use with mysql_real_connect */
PHP_FUNCTION(mysqli_init_method)
{
php_mysqli_init(INTERNAL_FUNCTION_PARAM_PASSTHRU, TRUE);
}
/* }}} */
/* {{{ Get the ID generated from the previous INSERT operation */
PHP_FUNCTION(mysqli_insert_id)
{

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: cc90d40e43462557087c123f0583e7865f281179 */
* Stub hash: 88f90ff45ab8f9748968c39eae950d58e598b73f */
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)
@ -38,7 +38,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_commit, 0, 1, _IS_BOOL, 0
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_mysqli_connect, 0, 0, mysqli, MAY_BE_NULL|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, host, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, hostname, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, username, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, database, IS_STRING, 1, "null")
@ -60,7 +60,7 @@ ZEND_END_ARG_INFO()
#define arginfo_mysqli_dump_debug_info arginfo_mysqli_close
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_debug, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, debug, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, options, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_errno, 0, 1, IS_LONG, 0)
@ -89,7 +89,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_fetch_field_direct, 0, 2, MAY_BE_OBJECT|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, result, mysqli_result, 0)
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_fetch_lengths, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
@ -235,7 +235,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_real_connect, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, host, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, hostname, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, username, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, database, IS_STRING, 1, "null")
@ -423,7 +423,7 @@ ZEND_END_ARG_INFO()
#define arginfo_mysqli_set_opt arginfo_mysqli_options
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli___construct, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, host, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, hostname, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, username, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, database, IS_STRING, 1, "null")
@ -511,7 +511,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_query, 0, 0, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_real_connect, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, host, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, hostname, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, username, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, database, IS_STRING, 1, "null")
@ -811,7 +811,7 @@ ZEND_FUNCTION(mysqli_use_result);
ZEND_FUNCTION(mysqli_warning_count);
ZEND_FUNCTION(mysqli_refresh);
ZEND_METHOD(mysqli, __construct);
ZEND_FUNCTION(mysqli_init_method);
ZEND_METHOD(mysqli, init);
ZEND_METHOD(mysqli_result, __construct);
ZEND_METHOD(mysqli_result, getIterator);
ZEND_METHOD(mysqli_stmt, __construct);
@ -967,7 +967,7 @@ static const zend_function_entry class_mysqli_methods[] = {
#endif
ZEND_ME_MAPPING(get_server_info, mysqli_get_server_info, arginfo_class_mysqli_get_server_info, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(get_warnings, mysqli_get_warnings, arginfo_class_mysqli_get_warnings, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(init, mysqli_init_method, arginfo_class_mysqli_init, ZEND_ACC_PUBLIC)
ZEND_ME(mysqli, init, arginfo_class_mysqli_init, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(kill, mysqli_kill, arginfo_class_mysqli_kill, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(multi_query, mysqli_multi_query, arginfo_class_mysqli_multi_query, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(more_results, mysqli_more_results, arginfo_class_mysqli_more_results, ZEND_ACC_PUBLIC)

View File

@ -383,6 +383,13 @@ PHP_METHOD(mysqli, __construct)
mysqli_common_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, FALSE, TRUE);
}
/* {{{ Initialize mysqli and return a resource for use with mysql_real_connect */
PHP_METHOD(mysqli, init)
{
php_mysqli_init(INTERNAL_FUNCTION_PARAM_PASSTHRU, TRUE);
}
/* }}} */
/* {{{ Returns the numerical value of the error message from last connect command */
PHP_FUNCTION(mysqli_connect_errno)
{

View File

@ -44,7 +44,7 @@ require_once('skipifconnectfailure.inc');
require_once("clean_table.inc");
?>
--EXPECTF--
mysqli_fetch_field_direct(): Argument #2 ($offset) must be greater than or equal to 0
mysqli_fetch_field_direct(): Argument #2 ($index) must be greater than or equal to 0
object(stdClass)#%d (13) {
["name"]=>
string(2) "ID"
@ -73,6 +73,6 @@ object(stdClass)#%d (13) {
["decimals"]=>
int(%d)
}
mysqli_fetch_field_direct(): Argument #2 ($offset) must be less than the number of fields for this result set
mysqli_fetch_field_direct(): Argument #2 ($index) must be less than the number of fields for this result set
mysqli_result object is already closed
done!

View File

@ -604,7 +604,7 @@ class OCILob {
* @alias oci_lob_write
* @return int|false
*/
public function write(string $string, ?int $length = null) {}
public function write(string $data, ?int $length = null) {}
/**
* @alias oci_lob_append
@ -654,16 +654,10 @@ class OCILob {
*/
public function export(string $filename, ?int $offset = null, ?int $length = null) {}
/**
* @alias oci_lob_write_temporary
* @return bool
*/
/** @return bool */
public function writetemporary(string $data, int $type = OCI_TEMP_CLOB) {}
/**
* @alias oci_lob_close
* @return bool
*/
/** @return bool */
public function close() {}
/**

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 7f000371ef4b61c401b5a59d2ab19c0e0f9a1987 */
* Stub hash: e7a7a9402b2668136f9f47d6e547e3af46a78a50 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
@ -470,7 +470,7 @@ ZEND_END_ARG_INFO()
#define arginfo_class_OCILob_size arginfo_class_OCILob_load
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_write, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
@ -619,8 +619,8 @@ ZEND_FUNCTION(oci_collection_trim);
ZEND_FUNCTION(oci_new_collection);
ZEND_FUNCTION(oci_register_taf_callback);
ZEND_FUNCTION(oci_unregister_taf_callback);
ZEND_FUNCTION(oci_lob_write_temporary);
ZEND_FUNCTION(oci_lob_close);
ZEND_METHOD(OCILob, writetemporary);
ZEND_METHOD(OCILob, close);
static const zend_function_entry ext_functions[] = {
@ -771,8 +771,8 @@ static const zend_function_entry class_OCILob_methods[] = {
ZEND_ME_MAPPING(getbuffering, ocigetbufferinglob, arginfo_class_OCILob_getbuffering, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(writetofile, oci_lob_export, arginfo_class_OCILob_writetofile, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(export, oci_lob_export, arginfo_class_OCILob_export, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(writetemporary, oci_lob_write_temporary, arginfo_class_OCILob_writetemporary, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(close, oci_lob_close, arginfo_class_OCILob_close, ZEND_ACC_PUBLIC)
ZEND_ME(OCILob, writetemporary, arginfo_class_OCILob_writetemporary, ZEND_ACC_PUBLIC)
ZEND_ME(OCILob, close, arginfo_class_OCILob_close, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(free, oci_free_descriptor, arginfo_class_OCILob_free, ZEND_ACC_PUBLIC)
ZEND_FE_END
};

View File

@ -916,7 +916,7 @@ PHP_FUNCTION(oci_lob_export)
/* }}} */
/* {{{ Writes temporary blob */
PHP_FUNCTION(oci_lob_write_temporary)
PHP_METHOD(OCILob, writetemporary)
{
zval *tmp, *z_descriptor;
php_oci_descriptor *descriptor;
@ -943,7 +943,7 @@ PHP_FUNCTION(oci_lob_write_temporary)
/* }}} */
/* {{{ Closes lob descriptor */
PHP_FUNCTION(oci_lob_close)
PHP_METHOD(OCILob, close)
{
zval *tmp, *z_descriptor;
php_oci_descriptor *descriptor;

View File

@ -299,8 +299,8 @@ function pg_lo_open($connection, $oid = UNKNOWN, string $mode = UNKNOWN) {}
*/
function pg_loopen($connection, $oid = UNKNOWN, string $mode = UNKNOWN) {}
/** @param resource $large_object */
function pg_lo_close($large_object): bool {}
/** @param resource $lob */
function pg_lo_close($lob): bool {}
/**
* @param resource $lob

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: cf7903b6548240de5be9f167a63478f846111e0f */
* Stub hash: 26edbb4ade84f0faad592dd270756c17e396519b */
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_connect, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
@ -225,13 +225,11 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_loopen arginfo_pg_lo_open
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_lo_close, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, large_object)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_loclose, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, lob)
ZEND_END_ARG_INFO()
#define arginfo_pg_loclose arginfo_pg_lo_close
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_lo_read, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, lob)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "8192")

View File

@ -78,13 +78,13 @@ class tidy
* @return bool
* @alias tidy_repair_string
*/
public function repairString(string $string, array|string|null $config = null, ?string $encoding = null) {}
public static function repairString(string $string, array|string|null $config = null, ?string $encoding = null) {}
/**
* @return bool
* @alias tidy_repair_file
*/
public function repairFile(string $filename, array|string|null $config = null, ?string $encoding = null, bool $useIncludePath = false) {}
public static function repairFile(string $filename, array|string|null $config = null, ?string $encoding = null, bool $useIncludePath = false) {}
/**
* @return bool

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: ac4cd960d6c65653994b8b044dcc52c179a57d45 */
* Stub hash: 4042c33d3ea3f5fb87cfb696488f6280b6ec7e7f */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_tidy_parse_string, 0, 1, tidy, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
@ -248,8 +248,8 @@ static const zend_function_entry class_tidy_methods[] = {
ZEND_ME_MAPPING(cleanRepair, tidy_clean_repair, arginfo_class_tidy_cleanRepair, ZEND_ACC_PUBLIC)
ZEND_ME(tidy, parseFile, arginfo_class_tidy_parseFile, ZEND_ACC_PUBLIC)
ZEND_ME(tidy, parseString, arginfo_class_tidy_parseString, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(repairString, tidy_repair_string, arginfo_class_tidy_repairString, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(repairFile, tidy_repair_file, arginfo_class_tidy_repairFile, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(repairString, tidy_repair_string, arginfo_class_tidy_repairString, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_ME_MAPPING(repairFile, tidy_repair_file, arginfo_class_tidy_repairFile, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_ME_MAPPING(diagnose, tidy_diagnose, arginfo_class_tidy_diagnose, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(getRelease, tidy_get_release, arginfo_class_tidy_getRelease, ZEND_ACC_PUBLIC)
ZEND_ME_MAPPING(getConfig, tidy_get_config, arginfo_class_tidy_getConfig, ZEND_ACC_PUBLIC)

View File

@ -91,12 +91,14 @@ class XMLWriter
/**
* @return bool
* @alias xmlwriter_open_uri
* @no-verify Behaviour differs from the aliased function
*/
public function openUri(string $uri) {}
/**
* @return bool
* @alias xmlwriter_open_memory
* @no-verify Behaviour differs from the aliased function
*/
public function openMemory() {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: df2a62a48636bd2c7b1e62ac28480ae27233f100 */
* Stub hash: a0ece6bc77b0a9811cb09a604b175e2295efc7a0 */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_xmlwriter_open_uri, 0, 1, XMLWriter, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0)

View File

@ -99,7 +99,7 @@ function gzread($stream, int $length): string|false {}
/**
* @param resource $stream
* @alias fgets
* @implementation-alias fgets
*/
function gzgets($stream, int $length = 1024): string|false {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 4106a50d3930915e47548be72f984420c5af6149 */
* Stub hash: 940858ddc4ddc7edb1e00960334ffa473224fd85 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ob_gzhandler, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)