https://github.com/mfn/php-docblock-normalize
Extracts doc blocks and normalizes the references classes based on the current namespace and use-aliases
https://github.com/mfn/php-docblock-normalize
Last synced: 2 months ago
JSON representation
Extracts doc blocks and normalizes the references classes based on the current namespace and use-aliases
- Host: GitHub
- URL: https://github.com/mfn/php-docblock-normalize
- Owner: mfn
- License: other
- Created: 2015-11-21T11:28:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-21T11:38:01.000Z (over 9 years ago)
- Last Synced: 2025-02-24T05:39:22.982Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Docblock Type Normalizer [ ](https://travis-ci.org/mfn/php-docblock-normalize)
Homepage: https://github.com/mfn/php-docblock-normalize
# Blurb
This library extracts docblocks from source files and normalizes all type
descriptions within. That is, they're turned into full qualified symbol names
taking the current `namespace` and `use`-aliases into consideration.# Requirements
PHP 5.6
# Install
Using composer: `composer.phar require mfn/docblock-normalize 0.1`
# Example
`sample.php`:
```PHP
parseFile('sample.php');echo $docblocks[0]->getNormalizedContent();
```
Will return:
```
/**
* @param Foo\Foo $param1
* @param Foo\Bar $param2
* @param Bar $param3
* @param Foo $param4
* @param string $param5
*/
```**Note:** `namespace` and `use` statements for the docblock must appear
**before** it!**Note 2:** the normalization also removes leading backslashes, this is expected!
# Contribute
Fork it, hack on a feature branch, create a pull request, be awesome!
No developer is an island so adhere to these standards:
* [PSR 4 Autoloader](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md)
* [PSR 2 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
* [PSR 1 Coding Standards](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)© Markus Fischer