- 添加对函数返回引用类型的检查,禁止返回引用类型 - 修复赋值引用表达式的解析逻辑,确保左侧为变量 - 添加临时变量处理非变量表达式的引用赋值 - 新增函数返回引用的测试用例验证错误处理pull/1/head
parent
ecb7795243
commit
8670df2a3e
3 changed files with 58 additions and 25 deletions
@ -0,0 +1,15 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
function &test() { |
||||||
|
global $a; |
||||||
|
return $a; |
||||||
|
} |
||||||
|
|
||||||
|
function main() |
||||||
|
{ |
||||||
|
$a = null; |
||||||
|
$b = &test(); |
||||||
|
$b ??= 2; |
||||||
|
|
||||||
|
var_dump($a, $b); |
||||||
|
} |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
class FunctionTest extends \BaseTest |
||||||
|
{ |
||||||
|
public function testReturnRef() |
||||||
|
{ |
||||||
|
$this->exec('The return type of the function `test` cannot be a reference type', 'function-return-ref.php'); |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue