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:
commit
efdf425983
@ -830,7 +830,11 @@ final class ParseTreeCreator
|
|||||||
|
|
||||||
$nexter_token = $this->t + 1 < $this->type_token_count ? $this->type_tokens[$this->t + 1] : null;
|
$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;
|
$this->t = $this->type_token_count;
|
||||||
if ($type_token[0] === '$this') {
|
if ($type_token[0] === '$this') {
|
||||||
$type_token[0] = 'static';
|
$type_token[0] = 'static';
|
||||||
|
@ -15,6 +15,14 @@ class TypeAnnotationTest extends TestCase
|
|||||||
public function providerValidCodeParse(): iterable
|
public function providerValidCodeParse(): iterable
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'atInArrayKey' => [
|
||||||
|
'code' => '<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<array{"@a": "test"}> $v
|
||||||
|
*/
|
||||||
|
function a(array $v): void {}',
|
||||||
|
],
|
||||||
'typeAliasBeforeClass' => [
|
'typeAliasBeforeClass' => [
|
||||||
'code' => '<?php
|
'code' => '<?php
|
||||||
namespace Barrr;
|
namespace Barrr;
|
||||||
|
Loading…
Reference in New Issue
Block a user