Fixed callable types parsing (#26)

This commit is contained in:
Nereo Berardozzi
2024-12-30 19:14:26 +01:00
committed by GitHub
parent 818be8de6a
commit ffb733ef78
2 changed files with 13 additions and 0 deletions
@@ -205,6 +205,11 @@ class Collection extends \ArrayObject
return $type;
}
// Check for callable types
if (preg_match('/\(.*?(?=\:)/', $type)) {
return $type;
}
if($type[0] === '(') {
return $type;
}
@@ -283,6 +283,14 @@ class CollectionTest extends TestCase
'iterable<string>',
array('iterable<string>')
),
array(
'callable',
array('callable')
),
array(
'callable(int, string): int',
array('callable(int, string): int')
)
);
}