Skip to content

Commit 31d995d

Browse files
committed
README usage
1 parent 614789f commit 31d995d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,17 @@
33
[![Build Status](https://travis-ci.org/mnapoli/PhpDocReader.png?branch=master)](https://travis-ci.org/mnapoli/PhpDocReader) [![Coverage Status](https://coveralls.io/repos/mnapoli/PhpDocReader/badge.png)](https://coveralls.io/r/mnapoli/PhpDocReader)
44

55
This project is a sub-project of [PHP-DI](http://mnapoli.github.io/PHP-DI/).
6+
7+
## Usage
8+
9+
```php
10+
$reader = new PhpDocReader();
11+
12+
// Read a property type (@var phpdoc)
13+
$property = new ReflectionProperty($className, $propertyName);
14+
$propertyType = $reader->getPropertyType($property);
15+
16+
// Read a parameter type (@param phpdoc)
17+
$parameter = new ReflectionParameter(array($className, $methodName), $parameterName);
18+
$parameterType = $reader->getParameterType($parameter);
19+
```

0 commit comments

Comments
 (0)