diff --git a/src/TypeResolver.php b/src/TypeResolver.php index 326f452..4f003da 100644 --- a/src/TypeResolver.php +++ b/src/TypeResolver.php @@ -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, ); diff --git a/src/Types/Parent_.php b/src/Types/Parent_.php new file mode 100644 index 0000000..aabdbfb --- /dev/null +++ b/src/Types/Parent_.php @@ -0,0 +1,33 @@ + + * @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'; + } +} diff --git a/tests/unit/TypeResolverTest.php b/tests/unit/TypeResolverTest.php index deb2f75..634777f 100644 --- a/tests/unit/TypeResolverTest.php +++ b/tests/unit/TypeResolverTest.php @@ -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], ]; }