This project is not being actively maintained. If you are interested in helping to maintain this project, take a look at the open issues on GitHub and submit pull requests. |
Introduction
The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional functionality on top of the reflection functionality that comes with PHP. It allows you to get the reflection information about classes, methods and properties statically.
Installation
The library can easily be installed with composer.
$ composer require doctrine/reflection
StaticReflectionMethod
1 $staticReflectionMethod = $staticReflectionParser->getReflectionMethod('getSomething');
echo $staticReflectionMethod->getName();
echo $staticReflectionMethod->getDeclaringClass();
echo $staticReflectionMethod->getNamespaceName();
echo $staticReflectionMethod->getDocComment();
print_r($staticReflectionMethod->getUseStatements());
2
3
4
5
6
7
8
9
10
11
StaticReflectionProperty
1 $staticReflectionProperty = $staticReflectionParser->getReflectionProperty('something');
echo $staticReflectionProperty->getName();
echo $staticReflectionProperty->getDeclaringClass();
echo $staticReflectionProperty->getDocComment();
print_r($staticReflectionProperty->getUseStatements());
2
3
4
5
6
7
8
9