1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00

Merge pull request #10426 from nicelocal/fix_at_array_keys

Fix at in array keys
This commit is contained in:
orklah 2023-11-29 18:26:08 +01:00 committed by GitHub
commit efdf425983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

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

View File

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