1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix #3423 - allow conditional with func_num_args() in namespace

This commit is contained in:
Matthew Brown 2020-05-21 11:29:54 -04:00
parent 952216ff21
commit 6784a90b2f
2 changed files with 19 additions and 0 deletions

View File

@ -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]];

View File

@ -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;
}',
],
];
}
}