Verify stub aliases in CI (#13682)

In the same time, let's not verify implementation aliases since they may now legitimately differ from their aliased function/method counterparts (think about the ext/dom refactoring where e.g. many return type declarations have changed). Additionally, unnecessary `@no-verify` tags are cleaned up.
This commit is contained in:
Máté Kocsis 2024-03-13 23:32:35 +01:00 committed by GitHub
parent cc0260e014
commit 577db99462
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 16 additions and 33 deletions

View file

@ -4,12 +4,11 @@ runs:
steps: steps:
- shell: bash - shell: bash
run: | run: |
set -x set -ex
[[ "$OSTYPE" == "darwin"* ]] && export PATH="$(brew --prefix)/opt/bison/bin:$PATH" [[ "$OSTYPE" == "darwin"* ]] && export PATH="$(brew --prefix)/opt/bison/bin:$PATH"
scripts/dev/credits scripts/dev/credits
scripts/dev/genfiles scripts/dev/genfiles
Zend/zend_vm_gen.php Zend/zend_vm_gen.php
ext/tokenizer/tokenizer_data_gen.php ext/tokenizer/tokenizer_data_gen.php
build/gen_stub.php -f build/gen_stub.php -f --generate-optimizer-info --verify
build/gen_stub.php --generate-optimizer-info
git add . -N && git diff --exit-code git add . -N && git diff --exit-code

View file

@ -5922,7 +5922,7 @@ if ($verify) {
$errors = []; $errors = [];
foreach ($funcMap as $aliasFunc) { foreach ($funcMap as $aliasFunc) {
if (!$aliasFunc->alias) { if (!$aliasFunc->alias || $aliasFunc->aliasType !== "alias") {
continue; continue;
} }

View file

@ -14,21 +14,18 @@ function bzread($bz, int $length = 1024): string|false {}
/** /**
* @param resource $bz * @param resource $bz
* @implementation-alias fwrite * @implementation-alias fwrite
* @no-verify Uses different parameter name
*/ */
function bzwrite($bz, string $data, ?int $length = null): int|false {} function bzwrite($bz, string $data, ?int $length = null): int|false {}
/** /**
* @param resource $bz * @param resource $bz
* @implementation-alias fflush * @implementation-alias fflush
* @no-verify Uses different parameter name
*/ */
function bzflush($bz): bool {} function bzflush($bz): bool {}
/** /**
* @param resource $bz * @param resource $bz
* @implementation-alias fclose * @implementation-alias fclose
* @no-verify Uses different parameter name
*/ */
function bzclose($bz): bool {} function bzclose($bz): bool {}

2
ext/bz2/bz2_arginfo.h generated
View file

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

View file

@ -776,7 +776,6 @@ class mysqli
/** /**
* @return true * @return true
* @alias mysqli_close * @alias mysqli_close
* @no-verify
*/ */
public function close() {} // TODO make return type void public function close() {} // TODO make return type void
@ -989,7 +988,6 @@ class mysqli
/** /**
* @return true * @return true
* @alias mysqli_ssl_set * @alias mysqli_ssl_set
* @no-verify
*/ */
public function ssl_set( public function ssl_set(
?string $key, ?string $key,
@ -1242,7 +1240,6 @@ class mysqli_stmt
/** /**
* @return true * @return true
* @alias mysqli_stmt_close * @alias mysqli_stmt_close
* @no-verify
*/ */
public function close() {} // TODO make return type void public function close() {} // TODO make return type void

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead. /* This is a generated file, edit the .stub.php file instead.
* Stub hash: a54ef005e9535458e886b7845a25a1c742a114ac */ * Stub hash: a8822bd2d34cadfd7c7e166cb7be38271ea3ae6a */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING) 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) ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)

View file

@ -245,10 +245,7 @@ class Phar extends RecursiveDirectoryIterator implements Countable, ArrayAccess
class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAccess class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAccess
{ {
/** /** @implementation-alias Phar::__construct */
* @implementation-alias Phar::__construct
* @no-verify PharData constructor accepts extra $format argument
*/
public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null, int $format = 0) {} public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null, int $format = 0) {}
/** @implementation-alias Phar::__destruct */ /** @implementation-alias Phar::__destruct */
@ -299,14 +296,12 @@ class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAcc
/** /**
* @tentative-return-type * @tentative-return-type
* @implementation-alias Phar::compress * @implementation-alias Phar::compress
* @no-verify
*/ */
public function compress(int $compression, ?string $extension = null): ?PharData {} public function compress(int $compression, ?string $extension = null): ?PharData {}
/** /**
* @tentative-return-type * @tentative-return-type
* @implementation-alias Phar::decompress * @implementation-alias Phar::decompress
* @no-verify
*/ */
public function decompress(?string $extension = null): ?PharData {} public function decompress(?string $extension = null): ?PharData {}

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead. /* This is a generated file, edit the .stub.php file instead.
* Stub hash: 00f5d4fc74e8b7dc67da6f12180c9fae343954cc */ * Stub hash: 03ae11b93de6df5cfb494662f96a1474ddc2fd28 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___construct, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)

View file

@ -800,10 +800,7 @@ class ReflectionEnumUnitCase extends ReflectionClassConstant
public function getEnum(): ReflectionEnum {} public function getEnum(): ReflectionEnum {}
/** /** @implementation-alias ReflectionClassConstant::getValue */
* @implementation-alias ReflectionClassConstant::getValue
* @no-verify
*/
public function getValue(): UnitEnum {} public function getValue(): UnitEnum {}
} }

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead. /* This is a generated file, edit the .stub.php file instead.
* Stub hash: 0adb92be59fadce74bb12017fe64ffbccab2a060 */ * Stub hash: f787e43effbd114daddad5d3ffcaf9faf7821d64 */
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 1, IS_ARRAY, 0) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)

View file

@ -88,7 +88,6 @@ class SplObjectStorage implements Countable, Iterator, Serializable, ArrayAccess
* @param object $object * @param object $object
* @tentative-return-type * @tentative-return-type
* @implementation-alias SplObjectStorage::attach * @implementation-alias SplObjectStorage::attach
* @no-verify Cannot specify arg type because ArrayAccess does not
*/ */
public function offsetSet($object, mixed $info = null): void {} public function offsetSet($object, mixed $info = null): void {}
@ -96,7 +95,6 @@ class SplObjectStorage implements Countable, Iterator, Serializable, ArrayAccess
* @param object $object * @param object $object
* @tentative-return-type * @tentative-return-type
* @implementation-alias SplObjectStorage::detach * @implementation-alias SplObjectStorage::detach
* @no-verify Cannot specify arg type because ArrayAccess does not
*/ */
public function offsetUnset($object): void {} public function offsetUnset($object): void {}

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead. /* This is a generated file, edit the .stub.php file instead.
* Stub hash: 3e17e99dffb3150685ae7c4724d6b8aad2f5db6e */ * Stub hash: 1fc23a91e7531eeb73729d4ad44addf0190c3a62 */
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplObserver_update, 0, 1, IS_VOID, 0) ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplObserver_update, 0, 1, IS_VOID, 0)
ZEND_ARG_OBJ_INFO(0, subject, SplSubject, 0) ZEND_ARG_OBJ_INFO(0, subject, SplSubject, 0)

View file

@ -272,13 +272,13 @@ class SQLite3
public const int RECURSIVE = UNKNOWN; public const int RECURSIVE = UNKNOWN;
#endif #endif
/** /** @implementation-alias SQLite3::open */
* @implementation-alias SQLite3::open
* @no-verify SQLite3::open should really be static
*/
public function __construct(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = "") {} public function __construct(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = "") {}
/** @tentative-return-type */ /**
* @tentative-return-type
* @todo SQLite3::open should really be static
*/
public function open(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = ""): void {} public function open(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = ""): void {}
/** @return bool */ /** @return bool */

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead. /* This is a generated file, edit the .stub.php file instead.
* Stub hash: 6c5f8bc087baa56f40834f9745f3d0f22f60edba */ * Stub hash: ec304d7a3db5b3a50c0d95755691bc055dffe047 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3___construct, 0, 0, 1) ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)