Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/PseudoTypes/ArrayShape.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ public function __construct(ArrayShapeItem ...$items)
$this->items = $items;
}

/**
* @return ArrayShapeItem[]
*/
public function getItems(): array
{
return $this->items;
}

public function underlyingType(): Type
{
return new Array_(new Mixed_(), new ArrayKey());
Expand Down
21 changes: 21 additions & 0 deletions tests/unit/PseudoTypes/ArrayShapeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace phpDocumentor\Reflection\PseudoTypes;

use PHPUnit\Framework\TestCase;

class ArrayShapeTest extends TestCase
{
/**
* @covers ::getItems
*/
public function testExposeItems(): void
{
$item1 = new ArrayShapeItem('foo', new True_(), false);
$item2 = new ArrayShapeItem('bar', new False_(), true);

$arrayShape = new ArrayShape($item1, $item2);

$this->assertSame([$item1, $item2], $arrayShape->getItems());
}
}