1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Allow magic methods named "as"

Fixes #2881
This commit is contained in:
Brown 2020-02-26 13:50:45 -05:00
parent 9163878174
commit f1dbd0863a
2 changed files with 28 additions and 19 deletions

View File

@ -473,6 +473,7 @@ class ParseTree
break;
case 'as':
if ($i > 0) {
$current_parent = $current_leaf->parent;
if (!$current_leaf instanceof ParseTree\Value
@ -494,6 +495,7 @@ class ParseTree
++$i;
break;
}
default:
$new_parent = !$current_leaf instanceof ParseTree\Root ? $current_leaf : null;

View File

@ -576,6 +576,13 @@ class MagicMethodAnnotationTest extends TestCase
return B::make();
}'
],
'validMethodAsAnnotation' => [
'<?php
/**
* @method string as(string $value)
*/
class Foo {}'
],
];
}