@@ -306,7 +306,7 @@ final class TypeExpression
if ('' !== ($matches['callable'] ?? '')) {
$this->parseCommaSeparatedInnerTypes(
$index + \strlen($matches['callable_start']),
- $matches['callable_arguments']
+ $matches['callable_arguments'] ?? ''
);
$return = $matches['callable_return'] ?? null;
@@ -125,6 +125,8 @@ final class TypeExpressionTest extends TestCase
yield ['TheCollection<callable(Foo, Bar,Baz): Foo[]>|string[]|null', ['TheCollection<callable(Foo, Bar,Baz): Foo[]>', 'string[]', 'null']];
+ yield ['Closure()', ['Closure()']];
+
yield ['Closure(string)', ['Closure(string)']];
yield ['array < int , callable ( string ) : bool >', ['array < int , callable ( string ) : bool >']];
@@ -296,10 +296,12 @@ EOF;
{
yield 'callable' => [
'<?php /**
+ * @param callable() $a
* @param callable(): void $b
* @param callable(bool, int, string): float $c
*/',
+ * @param CALLABLE() $a
* @param Callable(): VOID $b
* @param CALLABLE(BOOL, INT, STRING): FLOAT $c