Skip to content

Commit 42eeb9b

Browse files
authored
Merge pull request #30 from asgrim/iterable-type
Added iterable type
2 parents e224fb2 + b333768 commit 42eeb9b

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

src/TypeResolver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use phpDocumentor\Reflection\Types\Array_;
1616
use phpDocumentor\Reflection\Types\Compound;
1717
use phpDocumentor\Reflection\Types\Context;
18+
use phpDocumentor\Reflection\Types\Iterable_;
1819
use phpDocumentor\Reflection\Types\Object_;
1920

2021
final class TypeResolver
@@ -47,7 +48,8 @@ final class TypeResolver
4748
'true' => 'phpDocumentor\Reflection\Types\Boolean',
4849
'self' => 'phpDocumentor\Reflection\Types\Self_',
4950
'$this' => 'phpDocumentor\Reflection\Types\This',
50-
'static' => 'phpDocumentor\Reflection\Types\Static_'
51+
'static' => 'phpDocumentor\Reflection\Types\Static_',
52+
'iterable' => Iterable_::class,
5153
);
5254

5355
/** @var FqsenResolver */

src/Types/Iterable_.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* This file is part of phpDocumentor.
4+
*
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*
8+
* @copyright 2010-2017 Mike van Riel<[email protected]>
9+
* @license http://www.opensource.org/licenses/mit-license.php MIT
10+
* @link http://phpdoc.org
11+
*/
12+
13+
namespace phpDocumentor\Reflection\Types;
14+
15+
use phpDocumentor\Reflection\Type;
16+
17+
/**
18+
* Value Object representing iterable type
19+
*/
20+
final class Iterable_ implements Type
21+
{
22+
/**
23+
* Returns a rendered output of the Type as it would be used in a DocBlock.
24+
*
25+
* @return string
26+
*/
27+
public function __toString()
28+
{
29+
return 'iterable';
30+
}
31+
}

tests/unit/TypeResolverTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use phpDocumentor\Reflection\Types\Array_;
1717
use phpDocumentor\Reflection\Types\Compound;
1818
use phpDocumentor\Reflection\Types\Context;
19+
use phpDocumentor\Reflection\Types\Iterable_;
1920
use phpDocumentor\Reflection\Types\Object_;
2021

2122
/**
@@ -377,6 +378,7 @@ public function provideKeywords()
377378
['$this', 'phpDocumentor\Reflection\Types\This'],
378379
['static', 'phpDocumentor\Reflection\Types\Static_'],
379380
['self', 'phpDocumentor\Reflection\Types\Self_'],
381+
['iterable', Iterable_::class],
380382
];
381383
}
382384

0 commit comments

Comments
 (0)