Skip to content

Commit 514f40e

Browse files
Fix #14499: Mark Lua::__construct $lua_script_file parameter as optional (#5571)
1 parent 22923ac commit 514f40e

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

resources/functionMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5468,7 +5468,7 @@
54685468
'lstat' => ['array|false', 'filename'=>'string'],
54695469
'ltrim' => ['string', 'str'=>'string', 'character_mask='=>'string'],
54705470
'Lua::__call' => ['mixed', 'lua_func'=>'callable', 'args='=>'array', 'use_self='=>'int'],
5471-
'Lua::__construct' => ['void', 'lua_script_file'=>'string'],
5471+
'Lua::__construct' => ['void', 'lua_script_file='=>'string'],
54725472
'Lua::assign' => ['mixed', 'name'=>'string', 'value'=>'string'],
54735473
'Lua::call' => ['mixed', 'lua_func'=>'callable', 'args='=>'array', 'use_self='=>'int'],
54745474
'Lua::eval' => ['mixed', 'statements'=>'string'],

tests/PHPStan/Rules/Classes/InstantiationRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,4 +646,9 @@ public function testBug14138(): void
646646
]);
647647
}
648648

649+
public function testBug14499(): void
650+
{
651+
$this->analyse([__DIR__ . '/data/bug-14499.php'], []);
652+
}
653+
649654
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
namespace Bug14499;
4+
5+
$lua = new \Lua();
6+
$lua2 = new \Lua('/path/to/script.lua');

0 commit comments

Comments
 (0)