mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
parent
9163878174
commit
f1dbd0863a
@ -473,28 +473,30 @@ class ParseTree
|
||||
break;
|
||||
|
||||
case 'as':
|
||||
$current_parent = $current_leaf->parent;
|
||||
if ($i > 0) {
|
||||
$current_parent = $current_leaf->parent;
|
||||
|
||||
if (!$current_leaf instanceof ParseTree\Value
|
||||
|| !$current_parent instanceof ParseTree\GenericTree
|
||||
|| !$next_token
|
||||
) {
|
||||
throw new TypeParseTreeException('Unexpected token ' . $type_token[0]);
|
||||
if (!$current_leaf instanceof ParseTree\Value
|
||||
|| !$current_parent instanceof ParseTree\GenericTree
|
||||
|| !$next_token
|
||||
) {
|
||||
throw new TypeParseTreeException('Unexpected token ' . $type_token[0]);
|
||||
}
|
||||
|
||||
array_pop($current_parent->children);
|
||||
|
||||
$current_leaf = new ParseTree\TemplateAsTree(
|
||||
$current_leaf->value,
|
||||
$next_token[0],
|
||||
$current_parent
|
||||
);
|
||||
|
||||
$current_parent->children[] = $current_leaf;
|
||||
++$i;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
array_pop($current_parent->children);
|
||||
|
||||
$current_leaf = new ParseTree\TemplateAsTree(
|
||||
$current_leaf->value,
|
||||
$next_token[0],
|
||||
$current_parent
|
||||
);
|
||||
|
||||
$current_parent->children[] = $current_leaf;
|
||||
++$i;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$new_parent = !$current_leaf instanceof ParseTree\Root ? $current_leaf : null;
|
||||
|
||||
|
@ -576,6 +576,13 @@ class MagicMethodAnnotationTest extends TestCase
|
||||
return B::make();
|
||||
}'
|
||||
],
|
||||
'validMethodAsAnnotation' => [
|
||||
'<?php
|
||||
/**
|
||||
* @method string as(string $value)
|
||||
*/
|
||||
class Foo {}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user