1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Prevent TNamedObject from having a leading slash

This commit is contained in:
Matthew Brown 2017-10-06 23:35:16 -04:00
parent 1c0bfc7e7a
commit 1cc13bdeeb
2 changed files with 4 additions and 5 deletions

View File

@ -1152,11 +1152,6 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
$return_type_tokens = Type::tokenize($return_type);
foreach ($return_type_tokens as $i => &$return_type_token) {
if ($return_type_token[0] === '\\') {
$return_type_token = substr($return_type_token, 1);
continue;
}
if (in_array($return_type_token, ['<', '>', '|', '?', ',', '{', '}', ':'], true)) {
continue;
}

View File

@ -20,6 +20,10 @@ class TNamedObject extends Atomic
*/
public function __construct($value)
{
if ($value[0] === '\\') {
$value = substr($value, 1);
}
$this->value = $value;
}