Skip to content
Permalink
Browse files

Ignore spaces when array keys have $ at start

  • Loading branch information...
muglug committed Aug 8, 2019
1 parent bdac015 commit cf53f5d8252d22795a221eac19edf266e3f05861
Showing with 21 additions and 1 deletion.
  1. +4 −1 src/Psalm/Internal/Type/ParseTree.php
  2. +17 −0 tests/TypeParseTest.php
@@ -335,10 +335,13 @@ public static function createFromTokens(array $type_tokens)
throw new TypeParseTreeException('Unexpected space');
}
if ($current_leaf instanceof ParseTree\ObjectLikeTree) {
break;
}
$current_parent = $current_leaf->parent;
if ($current_parent instanceof ParseTree\CallableTree) {
++$i;
break;
}
@@ -355,6 +355,14 @@ public function testObjectWithSimpleArgs()
$this->assertSame('object{a:int, b:string}', (string) Type::parseString('object{a:int, b:string}'));
}
/**
* @return void
*/
public function testObjectWithDollarArgs()
{
$this->assertSame('object{a:int, $b:string}', (string) Type::parseString('object{a:int, $b:string}'));
}
/**
* @return void
*/
@@ -523,6 +531,15 @@ public function testCallableOrInt()
);
}
/**
* @return void
*/
public function testCallableWithGoodVariadic()
{
Type::parseString('callable(int, string...) : void');
Type::parseString('callable(int,string...) : void');
}
/**
* @return void
*/

0 comments on commit cf53f5d

Please sign in to comment.
You can’t perform that action at this time.