From 35727d13404d45ff46411c79e86883470379e272 Mon Sep 17 00:00:00 2001 From: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com> Date: Wed, 29 Apr 2026 20:32:45 +0200 Subject: [PATCH] Fix #14499: Mark Lua::__construct $lua_script_file parameter as optional --- resources/functionMap.php | 2 +- tests/PHPStan/Rules/Classes/InstantiationRuleTest.php | 5 +++++ tests/PHPStan/Rules/Classes/data/bug-14499.php | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 tests/PHPStan/Rules/Classes/data/bug-14499.php diff --git a/resources/functionMap.php b/resources/functionMap.php index 71866bb604e..4696ff21201 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -5468,7 +5468,7 @@ 'lstat' => ['array|false', 'filename'=>'string'], 'ltrim' => ['string', 'str'=>'string', 'character_mask='=>'string'], 'Lua::__call' => ['mixed', 'lua_func'=>'callable', 'args='=>'array', 'use_self='=>'int'], -'Lua::__construct' => ['void', 'lua_script_file'=>'string'], +'Lua::__construct' => ['void', 'lua_script_file='=>'string'], 'Lua::assign' => ['mixed', 'name'=>'string', 'value'=>'string'], 'Lua::call' => ['mixed', 'lua_func'=>'callable', 'args='=>'array', 'use_self='=>'int'], 'Lua::eval' => ['mixed', 'statements'=>'string'], diff --git a/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php b/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php index ddf9c63f854..5f83c21b6e9 100644 --- a/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php +++ b/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php @@ -646,4 +646,9 @@ public function testBug14138(): void ]); } + public function testBug14499(): void + { + $this->analyse([__DIR__ . '/data/bug-14499.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Classes/data/bug-14499.php b/tests/PHPStan/Rules/Classes/data/bug-14499.php new file mode 100644 index 00000000000..d738e5b30ce --- /dev/null +++ b/tests/PHPStan/Rules/Classes/data/bug-14499.php @@ -0,0 +1,6 @@ +