From 53a8e64b035e3254223ffb1a895aeedfd18bc4e3 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Mon, 12 Jan 2026 10:49:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20gen=5Fstub.php,=20?= =?UTF-8?q?=E6=9C=AA=E8=AE=BE=E7=BD=AE=E7=B1=BB=E5=9E=8B=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=BA=20mixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/gen_stub.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/bin/gen_stub.php b/bin/gen_stub.php index fb1b064f..7d82d25a 100644 --- a/bin/gen_stub.php +++ b/bin/gen_stub.php @@ -4807,7 +4807,7 @@ function parseFunctionLike( $returnType = $func->getReturnType(); if ($returnType === null && $docReturnType === null && !$name->isConstructor() && !$name->isDestructor()) { - throw new Exception("Missing return type"); + $docReturnType = "mixed"; } $return = new ReturnInfo( @@ -4899,7 +4899,7 @@ function parseConstLike( ) { $phpDocType = 'null'; } else { - throw new Exception("Missing type for constant " . $name->__toString()); + $phpDocType = 'mixed'; } } @@ -4966,7 +4966,7 @@ function parseProperty( $propertyType = $type ? Type::fromNode($type) : null; if ($propertyType === null && !$phpDocType) { - throw new Exception("Missing type for property $class::\$$property->name"); + $propertyType = Type::fromString("mixed"); } if ($property->default instanceof Expr\ConstFetch && @@ -6084,18 +6084,6 @@ function initPhpParser() { } $isInitialized = true; - $version = "5.6.1"; - $phpParserDir = __DIR__ . "/PHP-Parser-$version"; - if (!is_dir($phpParserDir)) { - installPhpParser($version, $phpParserDir); - } - - spl_autoload_register(static function(string $class) use ($phpParserDir) { - if (strpos($class, "PhpParser\\") === 0) { - $fileName = $phpParserDir . "/lib/" . str_replace("\\", "/", $class) . ".php"; - require $fileName; - } - }); } $optind = null;