Skip to content

Commit

Permalink
Merge pull request #36 from jaapio/feature/parent-resolving
Browse files Browse the repository at this point in the history
Adds support for parent type resolving
  • Loading branch information
mvriel authored Apr 30, 2017
2 parents 719e816 + 52dc3ed commit 88bdcb5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/TypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ final class TypeResolver
'self' => 'phpDocumentor\Reflection\Types\Self_',
'$this' => 'phpDocumentor\Reflection\Types\This',
'static' => 'phpDocumentor\Reflection\Types\Static_',
'parent' => 'phpDocumentor\Reflection\Types\Parent_',
'iterable' => Iterable_::class,
);

Expand Down
33 changes: 33 additions & 0 deletions src/Types/Parent_.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/

namespace phpDocumentor\Reflection\Types;

use phpDocumentor\Reflection\Type;

/**
* Value Object representing the 'parent' type.
*
* Parent, as a Type, represents the parent class of class in which the associated element was defined.
*/
final class Parent_ implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString()
{
return 'parent';
}
}
1 change: 1 addition & 0 deletions tests/unit/TypeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ public function provideKeywords()
['$this', 'phpDocumentor\Reflection\Types\This'],
['static', 'phpDocumentor\Reflection\Types\Static_'],
['self', 'phpDocumentor\Reflection\Types\Self_'],
['parent', 'phpDocumentor\Reflection\Types\Parent_'],
['iterable', Iterable_::class],
];
}
Expand Down

0 comments on commit 88bdcb5

Please sign in to comment.