dev-master
9999999-devPhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP)
MIT
The Requires
- php >=5.3.0
- doctrine/annotations 1.*
phpdoc reflection
PhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP)
This project is used by:, (*2)
Fork the README to add your project here., (*3)
PhpDocReader parses @var
and @param
values in PHP docblocks:, (*4)
use My\Cache\Backend; class Cache { /** * @var Backend */ protected $backend; /** * @param Backend $backend */ public function __construct($backend) { } }
It supports namespaced class names with the same resolution rules as PHP:, (*5)
\
)use My\Cache\Backend;
)SubNamespace\MyClass
)use My\Cache\Backend as FooBar;
)Primitive types (@var string
) are ignored (returns null), only valid class names are returned., (*6)
$reader = new PhpDocReader(); // Read a property type (@var phpdoc) $property = new ReflectionProperty($className, $propertyName); $propertyClass = $reader->getPropertyClass($property); // Read a parameter type (@param phpdoc) $parameter = new ReflectionParameter([$className, $methodName], $parameterName); $parameterClass = $reader->getParameterClass($parameter);
PhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP)
MIT
phpdoc reflection