mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix parsing of array keys with @
This commit is contained in:
parent
a3024adc46
commit
e0778fcc11
@ -830,7 +830,11 @@ final class ParseTreeCreator
|
||||
|
||||
$nexter_token = $this->t + 1 < $this->type_token_count ? $this->type_tokens[$this->t + 1] : null;
|
||||
|
||||
if ($nexter_token && strpos($nexter_token[0], '@') !== false) {
|
||||
if ($nexter_token
|
||||
&& strpos($nexter_token[0], '@') !== false
|
||||
&& $type_token[0] !== 'list'
|
||||
&& $type_token[0] !== 'array'
|
||||
) {
|
||||
$this->t = $this->type_token_count;
|
||||
if ($type_token[0] === '$this') {
|
||||
$type_token[0] = 'static';
|
||||
|
@ -15,6 +15,14 @@ class TypeAnnotationTest extends TestCase
|
||||
public function providerValidCodeParse(): iterable
|
||||
{
|
||||
return [
|
||||
'atInArrayKey' => [
|
||||
'code' => '<?php
|
||||
|
||||
/**
|
||||
* @param list<array{"@a": "test"}> $v
|
||||
*/
|
||||
function a(array $v): void {}',
|
||||
],
|
||||
'typeAliasBeforeClass' => [
|
||||
'code' => '<?php
|
||||
namespace Barrr;
|
||||
|
Loading…
Reference in New Issue
Block a user