diff --git a/build/gen_stub.php b/build/gen_stub.php index 6b1556d735196..bbaa251ed695a 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -2453,6 +2453,8 @@ class ClassInfo { public $cond; /** @var int|null */ public $phpVersionIdMinimumCompatibility; + /** @var bool */ + public $isUndocumentable; /** * @param AttributeInfo[] $attributes @@ -2480,7 +2482,8 @@ public function __construct( array $funcInfos, array $enumCaseInfos, ?string $cond, - ?int $minimumPhpVersionIdCompatibility + ?int $minimumPhpVersionIdCompatibility, + bool $isUndocumentable ) { $this->name = $name; $this->flags = $flags; @@ -2499,6 +2502,7 @@ public function __construct( $this->enumCaseInfos = $enumCaseInfos; $this->cond = $cond; $this->phpVersionIdMinimumCompatibility = $minimumPhpVersionIdCompatibility; + $this->isUndocumentable = $isUndocumentable; } /** @@ -3088,6 +3092,8 @@ class FileInfo { public $generateLegacyArginfoForPhpVersionId; /** @var bool */ public $generateClassEntries = false; + /** @var bool */ + public $isUndocumentable = false; /** * @return iterable @@ -3499,7 +3505,8 @@ function parseClass( array $methods, array $enumCases, ?string $cond, - ?int $minimumPhpVersionIdCompatibility + ?int $minimumPhpVersionIdCompatibility, + bool $isUndocumentable ): ClassInfo { $flags = $class instanceof Class_ ? $class->flags : 0; $comment = $class->getDocComment(); @@ -3521,6 +3528,8 @@ function parseClass( $isStrictProperties = true; } else if ($tag->name === 'not-serializable') { $isNotSerializable = true; + } else if ($tag->name === 'undocumentable') { + $isUndocumentable = true; } } } @@ -3579,7 +3588,8 @@ function parseClass( $methods, $enumCases, $cond, - $minimumPhpVersionIdCompatibility + $minimumPhpVersionIdCompatibility, + $isUndocumentable ); } @@ -3732,7 +3742,7 @@ function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstrac } $fileInfo->classInfos[] = parseClass( - $className, $stmt, $constInfos, $propertyInfos, $methodInfos, $enumCaseInfos, $cond, $fileInfo->generateLegacyArginfoForPhpVersionId + $className, $stmt, $constInfos, $propertyInfos, $methodInfos, $enumCaseInfos, $cond, $fileInfo->generateLegacyArginfoForPhpVersionId, $fileInfo->isUndocumentable ); continue; } @@ -3783,6 +3793,8 @@ protected function pName_FullyQualified(Name\FullyQualified $node) { } else if ($tag->name === 'generate-class-entries') { $fileInfo->generateClassEntries = true; $fileInfo->declarationPrefix = $tag->value ? $tag->value . " " : ""; + } else if ($tag->name === 'undocumentable') { + $fileInfo->isUndocumentable = true; } } } @@ -4219,12 +4231,14 @@ function generateClassSynopses(array $classMap, iterable $allConstInfos): array } /** - * @param ClassInfo[] $classMap + * @param array $classMap * $param iterable $allConstInfos * @return array */ -function replaceClassSynopses(string $targetDirectory, array $classMap, iterable $allConstInfos): array +function replaceClassSynopses(string $targetDirectory, array $classMap, iterable $allConstInfos, bool $isVerify): array { + $existingClassSynopses = []; + $classSynopses = []; $it = new RecursiveIteratorIterator( @@ -4281,6 +4295,9 @@ function replaceClassSynopses(string $targetDirectory, array $classMap, iterable if (!isset($classMap[$className])) { continue; } + + $existingClassSynopses[$className] = $className; + $classInfo = $classMap[$className]; $newClassSynopsis = $classInfo->getClassSynopsisElement($doc, $classMap, $allConstInfos); @@ -4320,6 +4337,16 @@ function replaceClassSynopses(string $targetDirectory, array $classMap, iterable } } + if ($isVerify) { + $missingClassSynopses = array_diff_key($classMap, $existingClassSynopses); + foreach ($missingClassSynopses as $className => $info) { + /** @var ClassInfo $info */ + if (!$info->isUndocumentable) { + echo "Warning: Missing class synopsis page for $className\n"; + } + } + } + return $classSynopses; } @@ -4791,7 +4818,7 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc } if ($replaceClassSynopses) { - $classSynopses = replaceClassSynopses($targetSynopses, $classMap, $context->allConstInfos); + $classSynopses = replaceClassSynopses($targetSynopses, $classMap, $context->allConstInfos, $verify); foreach ($classSynopses as $filename => $content) { if (file_put_contents($filename, $content)) { diff --git a/ext/pdo_pgsql/pgsql_driver.stub.php b/ext/pdo_pgsql/pgsql_driver.stub.php index 6daa55c7b873a..4206dbea636b9 100644 --- a/ext/pdo_pgsql/pgsql_driver.stub.php +++ b/ext/pdo_pgsql/pgsql_driver.stub.php @@ -2,7 +2,10 @@ /** @generate-function-entries */ -// These are extension methods for PDO. This is not a real class. +/** + * These are extension methods for PDO. This is not a real class. + * @undocumentable + */ class PDO_PGSql_Ext { /** @tentative-return-type */ public function pgsqlCopyFromArray(string $tableName, array $rows, string $separator = "\t", string $nullAs = "\\\\N", ?string $fields = null): bool {} diff --git a/ext/pdo_pgsql/pgsql_driver_arginfo.h b/ext/pdo_pgsql/pgsql_driver_arginfo.h index a3ec5196fad2c..3f84d4d8e5b9d 100644 --- a/ext/pdo_pgsql/pgsql_driver_arginfo.h +++ b/ext/pdo_pgsql/pgsql_driver_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5dfd421cf9ba9eb043c4b4f3c9b9c09c81cc3ccb */ + * Stub hash: b30fa6327876dc1090ee5397253c935e4566a8fe */ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_PDO_PGSql_Ext_pgsqlCopyFromArray, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) diff --git a/ext/pdo_sqlite/sqlite_driver.stub.php b/ext/pdo_sqlite/sqlite_driver.stub.php index 58fb41c9b950e..add395f2b99a5 100644 --- a/ext/pdo_sqlite/sqlite_driver.stub.php +++ b/ext/pdo_sqlite/sqlite_driver.stub.php @@ -2,7 +2,10 @@ /** @generate-function-entries */ -// These are extension methods for PDO. This is not a real class. +/** + * These are extension methods for PDO. This is not a real class. + * @undocumentable + */ class PDO_SQLite_Ext { /** @tentative-return-type */ public function sqliteCreateFunction(string $name, callable $callback, int $numArgs = -1, int $flags = 0): bool {} diff --git a/ext/pdo_sqlite/sqlite_driver_arginfo.h b/ext/pdo_sqlite/sqlite_driver_arginfo.h index 2b9b1aea1e0ba..5ba745e55cf3e 100644 --- a/ext/pdo_sqlite/sqlite_driver_arginfo.h +++ b/ext/pdo_sqlite/sqlite_driver_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 8cc3c173f5a442ab80f240a568489b023aabd7ef */ + * Stub hash: dc901bd60d17c1a2cdb40a118e2c6cd6eb0396e3 */ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_PDO_SQLite_Ext_sqliteCreateFunction, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index f55e4e5b9d291..7e6f9d8afbec3 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -740,6 +740,7 @@ const LOG_PERROR = UNKNOWN; #endif +/** @undocumentable */ #[AllowDynamicProperties] final class __PHP_Incomplete_Class { diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 51879da2059ca..e76e056f3e81e 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9c86ed1487132d15715ddbfcb5abd6ac52d629eb */ + * Stub hash: 9e0016895111851aa2c635e1380a18cd7963e58e */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) diff --git a/ext/zend_test/fiber.stub.php b/ext/zend_test/fiber.stub.php index 4cfe97137d86e..0f6ccf898e29d 100644 --- a/ext/zend_test/fiber.stub.php +++ b/ext/zend_test/fiber.stub.php @@ -1,6 +1,9 @@