Skip to content

Commit be44eb6

Browse files
committed
Added test to reproduce issue #49
1 parent 69bf1b1 commit be44eb6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/unit/CollectionResolverTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,35 @@ public function testResolvingArrayCollectionWithKey()
147147
$this->assertInstanceOf(Types\Compound::class, $valueType);
148148
}
149149

150+
/**
151+
* @covers ::__construct
152+
* @covers ::resolve
153+
*
154+
* @uses \phpDocumentor\Reflection\Types\Context
155+
* @uses \phpDocumentor\Reflection\Types\Compound
156+
* @uses \phpDocumentor\Reflection\Types\Collection
157+
* @uses \phpDocumentor\Reflection\Types\String_
158+
*/
159+
public function testResolvingArrayCollectionWithKeyAndWhitespace()
160+
{
161+
$fixture = new TypeResolver();
162+
163+
/** @var Collection $resolvedType */
164+
$resolvedType = $fixture->resolve('array<string, object|array>', new Context(''));
165+
166+
$this->assertInstanceOf(Array_::class, $resolvedType);
167+
$this->assertSame('array<string,object|array>', (string) $resolvedType);
168+
169+
/** @var Array_ $valueType */
170+
$valueType = $resolvedType->getValueType();
171+
172+
/** @var Compound $keyType */
173+
$keyType = $resolvedType->getKeyType();
174+
175+
$this->assertInstanceOf(Types\String_::class, $keyType);
176+
$this->assertInstanceOf(Types\Compound::class, $valueType);
177+
}
178+
150179
/**
151180
* @covers ::__construct
152181
* @covers ::resolve

0 commit comments

Comments
 (0)