Skip to content

Commit f0c04ac

Browse files
committed
Verify stub aliases in CI
In the same time, let's not verify implementation aliases since they may now legitimately differ from their aliased function/method counterpart (think about the ext/dom refactoring). Additionally, unncessary `@no-verify` tags are cleaned up.
1 parent a04577f commit f0c04ac

14 files changed

+19
-38
lines changed

.github/actions/verify-generated-files/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ runs:
44
steps:
55
- shell: bash
66
run: |
7-
set -x
7+
set -ex
88
[[ "$OSTYPE" == "darwin"* ]] && export PATH="$(brew --prefix)/opt/bison/bin:$PATH"
99
scripts/dev/credits
1010
scripts/dev/genfiles
1111
Zend/zend_vm_gen.php
1212
ext/tokenizer/tokenizer_data_gen.php
13-
build/gen_stub.php -f
14-
build/gen_stub.php --generate-optimizer-info
13+
build/gen_stub.php -f --generate-optimizer-info --verify
1514
git add . -N && git diff --exit-code

build/gen_stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5922,7 +5922,7 @@ function initPhpParser() {
59225922
$errors = [];
59235923

59245924
foreach ($funcMap as $aliasFunc) {
5925-
if (!$aliasFunc->alias) {
5925+
if (!$aliasFunc->alias || $aliasFunc->aliasType !== "alias") {
59265926
continue;
59275927
}
59285928

ext/bz2/bz2.stub.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,18 @@ function bzread($bz, int $length = 1024): string|false {}
1414
/**
1515
* @param resource $bz
1616
* @implementation-alias fwrite
17-
* @no-verify Uses different parameter name
1817
*/
1918
function bzwrite($bz, string $data, ?int $length = null): int|false {}
2019

2120
/**
2221
* @param resource $bz
2322
* @implementation-alias fflush
24-
* @no-verify Uses different parameter name
2523
*/
2624
function bzflush($bz): bool {}
2725

2826
/**
2927
* @param resource $bz
3028
* @implementation-alias fclose
31-
* @no-verify Uses different parameter name
3229
*/
3330
function bzclose($bz): bool {}
3431

ext/bz2/bz2_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/mysqli/mysqli.stub.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ public function character_set_name(): string {}
776776
/**
777777
* @return true
778778
* @alias mysqli_close
779-
* @no-verify
780779
*/
781780
public function close() {} // TODO make return type void
782781

@@ -989,7 +988,6 @@ public function set_opt(int $option, $value): bool {}
989988
/**
990989
* @return true
991990
* @alias mysqli_ssl_set
992-
* @no-verify
993991
*/
994992
public function ssl_set(
995993
?string $key,
@@ -1242,7 +1240,6 @@ public function bind_result(mixed &...$vars): bool {}
12421240
/**
12431241
* @return true
12441242
* @alias mysqli_stmt_close
1245-
* @no-verify
12461243
*/
12471244
public function close() {} // TODO make return type void
12481245

ext/mysqli/mysqli_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/phar/phar_object.stub.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,7 @@ final public static function webPhar(
245245

246246
class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAccess
247247
{
248-
/**
249-
* @implementation-alias Phar::__construct
250-
* @no-verify PharData constructor accepts extra $format argument
251-
*/
248+
/** @implementation-alias Phar::__construct */
252249
public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null, int $format = 0) {}
253250

254251
/** @implementation-alias Phar::__destruct */
@@ -299,14 +296,12 @@ public function decompressFiles() {} // TODO make return type void
299296
/**
300297
* @tentative-return-type
301298
* @implementation-alias Phar::compress
302-
* @no-verify
303299
*/
304300
public function compress(int $compression, ?string $extension = null): ?PharData {}
305301

306302
/**
307303
* @tentative-return-type
308304
* @implementation-alias Phar::decompress
309-
* @no-verify
310305
*/
311306
public function decompress(?string $extension = null): ?PharData {}
312307

ext/phar/phar_object_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/reflection/php_reflection.stub.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -800,10 +800,7 @@ public function __construct(object|string $class, string $constant) {}
800800

801801
public function getEnum(): ReflectionEnum {}
802802

803-
/**
804-
* @implementation-alias ReflectionClassConstant::getValue
805-
* @no-verify
806-
*/
803+
/** @implementation-alias ReflectionClassConstant::getValue */
807804
public function getValue(): UnitEnum {}
808805
}
809806

ext/reflection/php_reflection_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/spl/spl_observer.stub.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,13 @@ public function offsetGet($object): mixed {}
8888
* @param object $object
8989
* @tentative-return-type
9090
* @implementation-alias SplObjectStorage::attach
91-
* @no-verify Cannot specify arg type because ArrayAccess does not
9291
*/
9392
public function offsetSet($object, mixed $info = null): void {}
9493

9594
/**
9695
* @param object $object
9796
* @tentative-return-type
9897
* @implementation-alias SplObjectStorage::detach
99-
* @no-verify Cannot specify arg type because ArrayAccess does not
10098
*/
10199
public function offsetUnset($object): void {}
102100

@@ -159,9 +157,6 @@ public function current(): array {}
159157
/** @tentative-return-type */
160158
public function next(): void {}
161159

162-
/**
163-
* @tentative-return-type
164-
* @implementation-alias SplObjectStorage::__debugInfo
165-
*/
160+
/** @tentative-return-type */
166161
public function __debugInfo(): array {}
167162
}

ext/spl/spl_observer_arginfo.h

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/sqlite3/sqlite3.stub.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ class SQLite3
272272
public const int RECURSIVE = UNKNOWN;
273273
#endif
274274

275-
/**
276-
* @implementation-alias SQLite3::open
277-
* @no-verify SQLite3::open should really be static
278-
*/
275+
/** @implementation-alias SQLite3::open */
279276
public function __construct(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = "") {}
280277

281-
/** @tentative-return-type */
278+
/**
279+
* @tentative-return-type
280+
* @todo SQLite3::open should really be static
281+
*/
282282
public function open(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = ""): void {}
283283

284284
/** @return bool */

ext/sqlite3/sqlite3_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)