[php-src] master: Verify stub aliases in CI (#13682)
| From: | Máté Kocsis via GitHub | Date: | Wed, 13 Mar 2024 22:46:23 +0000 |
| Subject: | [php-src] master: Verify stub aliases in CI (#13682) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-127728@lists.php.net to get a copy of this message | ||
Author: Máté Kocsis (kocsismate)
Committer: GitHub (web-flow)
Pusher: kocsismate
Date: 2024-03-13T23:32:35+01:00
Commit: https://github.com/php/php-src/commit/577db99462952390d9cd028badadc7a8e2b79454
Raw diff: https://github.com/php/php-src/commit/577db99462952390d9cd028badadc7a8e2b79454.diff
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.
Changed paths:
M .github/actions/verify-generated-files/action.yml
M build/gen_stub.php
M ext/bz2/bz2.stub.php
M ext/bz2/bz2_arginfo.h
M ext/mysqli/mysqli.stub.php
M ext/mysqli/mysqli_arginfo.h
M ext/phar/phar_object.stub.php
M ext/phar/phar_object_arginfo.h
M ext/reflection/php_reflection.stub.php
M ext/reflection/php_reflection_arginfo.h
M ext/spl/spl_observer.stub.php
M ext/spl/spl_observer_arginfo.h
M ext/sqlite3/sqlite3.stub.php
M ext/sqlite3/sqlite3_arginfo.h
Diff:
diff --git a/.github/actions/verify-generated-files/action.yml
b/.github/actions/verify-generated-files/action.yml
index d4ca6301144c0..f926468637551 100644
--- a/.github/actions/verify-generated-files/action.yml
+++ b/.github/actions/verify-generated-files/action.yml
@@ -4,12 +4,11 @@ runs:
steps:
- shell: bash
run: |
- set -x
+ set -ex
[[ "$OSTYPE" == "darwin"* ]] && export PATH="$(brew
--prefix)/opt/bison/bin:$PATH"
scripts/dev/credits
scripts/dev/genfiles
Zend/zend_vm_gen.php
ext/tokenizer/tokenizer_data_gen.php
- build/gen_stub.php -f
- build/gen_stub.php --generate-optimizer-info
+ build/gen_stub.php -f --generate-optimizer-info --verify
git add . -N && git diff --exit-code
diff --git a/build/gen_stub.php b/build/gen_stub.php
index 4715f7a401310..e427a358eb57c 100755
--- a/build/gen_stub.php
+++ b/build/gen_stub.php
@@ -5922,7 +5922,7 @@ function initPhpParser() {
$errors = [];
foreach ($funcMap as $aliasFunc) {
- if (!$aliasFunc->alias) {
+ if (!$aliasFunc->alias || $aliasFunc->aliasType !== "alias") {
continue;
}
diff --git a/ext/bz2/bz2.stub.php b/ext/bz2/bz2.stub.php
index b1221847c6c8b..8d0f48fc96446 100644
--- a/ext/bz2/bz2.stub.php
+++ b/ext/bz2/bz2.stub.php
@@ -14,21 +14,18 @@ function bzread($bz, int $length = 1024): string|false {}
/**
* @param resource $bz
* @implementation-alias fwrite
- * @no-verify Uses different parameter name
*/
function bzwrite($bz, string $data, ?int $length = null): int|false {}
/**
* @param resource $bz
* @implementation-alias fflush
- * @no-verify Uses different parameter name
*/
function bzflush($bz): bool {}
/**
* @param resource $bz
* @implementation-alias fclose
- * @no-verify Uses different parameter name
*/
function bzclose($bz): bool {}
diff --git a/ext/bz2/bz2_arginfo.h b/ext/bz2/bz2_arginfo.h
index e7bde62684eb3..bac3b57023dcf 100644
--- a/ext/bz2/bz2_arginfo.h
+++ b/ext/bz2/bz2_arginfo.h
@@ -1,5 +1,5 @@
/* 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_ARG_INFO(0, file)
diff --git a/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php
index 4fd55442b7447..3def5adb61791 100644
--- a/ext/mysqli/mysqli.stub.php
+++ b/ext/mysqli/mysqli.stub.php
@@ -776,7 +776,6 @@ public function character_set_name(): string {}
/**
* @return true
* @alias mysqli_close
- * @no-verify
*/
public function close() {} // TODO make return type void
@@ -989,7 +988,6 @@ public function set_opt(int $option, $value): bool {}
/**
* @return true
* @alias mysqli_ssl_set
- * @no-verify
*/
public function ssl_set(
?string $key,
@@ -1242,7 +1240,6 @@ public function bind_result(mixed &...$vars): bool {}
/**
* @return true
* @alias mysqli_stmt_close
- * @no-verify
*/
public function close() {} // TODO make return type void
diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h
index 470c71b1c97f0..e26e38cd511da 100644
--- a/ext/mysqli/mysqli_arginfo.h
+++ b/ext/mysqli/mysqli_arginfo.h
@@ -1,5 +1,5 @@
/* 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_ARG_OBJ_INFO(0, mysql, mysqli, 0)
diff --git a/ext/phar/phar_object.stub.php b/ext/phar/phar_object.stub.php
index f39fdba5a48fe..27ee6a9cc8175 100644
--- a/ext/phar/phar_object.stub.php
+++ b/ext/phar/phar_object.stub.php
@@ -245,10 +245,7 @@ final public static function webPhar(
class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAccess
{
- /**
- * @implementation-alias Phar::__construct
- * @no-verify PharData constructor accepts extra $format argument
- */
+ /** @implementation-alias Phar::__construct */
public function __construct(string $filename, int $flags =
FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null, int $format =
0) {}
/** @implementation-alias Phar::__destruct */
@@ -299,14 +296,12 @@ public function decompressFiles() {} // TODO make return type void
/**
* @tentative-return-type
* @implementation-alias Phar::compress
- * @no-verify
*/
public function compress(int $compression, ?string $extension = null): ?PharData {}
/**
* @tentative-return-type
* @implementation-alias Phar::decompress
- * @no-verify
*/
public function decompress(?string $extension = null): ?PharData {}
diff --git a/ext/phar/phar_object_arginfo.h b/ext/phar/phar_object_arginfo.h
index fc149ba0ac693..1ee3a122708e2 100644
--- a/ext/phar/phar_object_arginfo.h
+++ b/ext/phar/phar_object_arginfo.h
@@ -1,5 +1,5 @@
/* 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_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
diff --git a/ext/reflection/php_reflection.stub.php b/ext/reflection/php_reflection.stub.php
index 41768b6f61b20..944ae0ad9aeda 100644
--- a/ext/reflection/php_reflection.stub.php
+++ b/ext/reflection/php_reflection.stub.php
@@ -800,10 +800,7 @@ public function __construct(object|string $class, string $constant) {}
public function getEnum(): ReflectionEnum {}
- /**
- * @implementation-alias ReflectionClassConstant::getValue
- * @no-verify
- */
+ /** @implementation-alias ReflectionClassConstant::getValue */
public function getValue(): UnitEnum {}
}
diff --git a/ext/reflection/php_reflection_arginfo.h b/ext/reflection/php_reflection_arginfo.h
index eaab1e8a786d5..05858203dfc04 100644
--- a/ext/reflection/php_reflection_arginfo.h
+++ b/ext/reflection/php_reflection_arginfo.h
@@ -1,5 +1,5 @@
/* 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_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)
diff --git a/ext/spl/spl_observer.stub.php b/ext/spl/spl_observer.stub.php
index 4fa2b08d64f7a..24d4fd08aa746 100644
--- a/ext/spl/spl_observer.stub.php
+++ b/ext/spl/spl_observer.stub.php
@@ -88,7 +88,6 @@ public function offsetGet($object): mixed {}
* @param object $object
* @tentative-return-type
* @implementation-alias SplObjectStorage::attach
- * @no-verify Cannot specify arg type because ArrayAccess does not
*/
public function offsetSet($object, mixed $info = null): void {}
@@ -96,7 +95,6 @@ public function offsetSet($object, mixed $info = null): void {}
* @param object $object
* @tentative-return-type
* @implementation-alias SplObjectStorage::detach
- * @no-verify Cannot specify arg type because ArrayAccess does not
*/
public function offsetUnset($object): void {}
diff --git a/ext/spl/spl_observer_arginfo.h b/ext/spl/spl_observer_arginfo.h
index b395897917711..913e481e57d52 100644
--- a/ext/spl/spl_observer_arginfo.h
+++ b/ext/spl/spl_observer_arginfo.h
@@ -1,5 +1,5 @@
/* 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_ARG_OBJ_INFO(0, subject, SplSubject, 0)
diff --git a/ext/sqlite3/sqlite3.stub.php b/ext/sqlite3/sqlite3.stub.php
index 8cb7f3a70a904..77a879abe2f04 100644
--- a/ext/sqlite3/sqlite3.stub.php
+++ b/ext/sqlite3/sqlite3.stub.php
@@ -272,13 +272,13 @@ class SQLite3
public const int RECURSIVE = UNKNOWN;
#endif
- /**
- * @implementation-alias SQLite3::open
- * @no-verify SQLite3::open should really be static
- */
+ /** @implementation-alias SQLite3::open */
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 {}
/** @return bool */
diff --git a/ext/sqlite3/sqlite3_arginfo.h b/ext/sqlite3/sqlite3_arginfo.h
index bc3caf4096237..4618366f9bd69 100644
--- a/ext/sqlite3/sqlite3_arginfo.h
+++ b/ext/sqlite3/sqlite3_arginfo.h
@@ -1,5 +1,5 @@
/* 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_ARG_TYPE_INFO(0, filename, IS_STRING, 0)