diff --git a/src/PseudoTypes/CallableArray.php b/src/PseudoTypes/CallableArray.php new file mode 100644 index 0000000..2ccaaf0 --- /dev/null +++ b/src/PseudoTypes/CallableArray.php @@ -0,0 +1,43 @@ + Object_::class, 'mixed' => Mixed_::class, 'array' => Array_::class, + 'callable-array' => CallableArray::class, 'array-key' => ArrayKey::class, 'non-empty-array' => NonEmptyArray::class, 'resource' => Resource_::class, diff --git a/tests/unit/PseudoTypes/CallableArrayTest.php b/tests/unit/PseudoTypes/CallableArrayTest.php new file mode 100644 index 0000000..447893e --- /dev/null +++ b/tests/unit/PseudoTypes/CallableArrayTest.php @@ -0,0 +1,36 @@ +assertEquals(new Array_(new Mixed_(), new Integer()), $type->underlyingType()); + $this->assertEquals(new Mixed_(), $type->getValueType()); + $this->assertEquals(new Integer(), $type->getKeyType()); + } + + public function testToString(): void + { + $this->assertSame('callable-array', (string) (new CallableArray())); + } +} diff --git a/tests/unit/TypeResolverTest.php b/tests/unit/TypeResolverTest.php index 04c92c0..abc401e 100644 --- a/tests/unit/TypeResolverTest.php +++ b/tests/unit/TypeResolverTest.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\PseudoTypes\ArrayKey; use phpDocumentor\Reflection\PseudoTypes\ArrayShape; use phpDocumentor\Reflection\PseudoTypes\ArrayShapeItem; +use phpDocumentor\Reflection\PseudoTypes\CallableArray; use phpDocumentor\Reflection\PseudoTypes\CallableString; use phpDocumentor\Reflection\PseudoTypes\ClassString; use phpDocumentor\Reflection\PseudoTypes\Conditional; @@ -668,6 +669,7 @@ public function provideKeywords(): array ['callable-string', CallableString::class], ['callback', Callable_::class], ['array', Array_::class], + ['callable-array', CallableArray::class], ['array-key', ArrayKey::class], ['scalar', Scalar::class], ['object', Object_::class],