mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix #3423 - allow conditional with func_num_args() in namespace
This commit is contained in:
parent
952216ff21
commit
6784a90b2f
@ -443,6 +443,10 @@ class TypeTokenizer
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($string_type_token[0] === 'func_num_args()') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($type_aliases[$string_type_token[0]])) {
|
||||
$type_alias = $type_aliases[$string_type_token[0]];
|
||||
|
||||
|
@ -461,6 +461,21 @@ class ConditionalReturnTypeTest extends TestCase
|
||||
'$c' => 'string',
|
||||
]
|
||||
],
|
||||
'namespaceFuncNumArgs' => [
|
||||
'<?php
|
||||
namespace Foo;
|
||||
|
||||
/**
|
||||
* @return (func_num_args() is 0 ? false : string)
|
||||
*/
|
||||
function zeroArgsFalseOneArgString(string $s = "") {
|
||||
if (func_num_args() === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $s;
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user