Skip to content

Commit 88bdcb5

Browse files
authored
Merge pull request #36 from jaapio/feature/parent-resolving
Adds support for parent type resolving
2 parents 719e816 + 52dc3ed commit 88bdcb5

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/TypeResolver.php

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ final class TypeResolver
5050
'self' => 'phpDocumentor\Reflection\Types\Self_',
5151
'$this' => 'phpDocumentor\Reflection\Types\This',
5252
'static' => 'phpDocumentor\Reflection\Types\Static_',
53+
'parent' => 'phpDocumentor\Reflection\Types\Parent_',
5354
'iterable' => Iterable_::class,
5455
);
5556

src/Types/Parent_.php

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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-2015 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 the 'parent' type.
19+
*
20+
* Parent, as a Type, represents the parent class of class in which the associated element was defined.
21+
*/
22+
final class Parent_ implements Type
23+
{
24+
/**
25+
* Returns a rendered output of the Type as it would be used in a DocBlock.
26+
*
27+
* @return string
28+
*/
29+
public function __toString()
30+
{
31+
return 'parent';
32+
}
33+
}

tests/unit/TypeResolverTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ public function provideKeywords()
401401
['$this', 'phpDocumentor\Reflection\Types\This'],
402402
['static', 'phpDocumentor\Reflection\Types\Static_'],
403403
['self', 'phpDocumentor\Reflection\Types\Self_'],
404+
['parent', 'phpDocumentor\Reflection\Types\Parent_'],
404405
['iterable', Iterable_::class],
405406
];
406407
}

0 commit comments

Comments
 (0)