2017 © Pedro Peláez
 

library docblock-normalize

Extracts doc blocks and normalizes the references classes based on the current namespace and use-aliases

image

mfn/docblock-normalize

Extracts doc blocks and normalizes the references classes based on the current namespace and use-aliases

  • Saturday, November 21, 2015
  • by mfn
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 10 % Grown

The README.md

Docblock Type Normalizer Travis Build Status

Homepage: https://github.com/mfn/php-docblock-normalize, (*1)

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., (*2)

Requirements

PHP 5.6, (*3)

Install

Using composer: composer.phar require mfn/docblock-normalize 0.1, (*4)

Example

sample.php:, (*5)

<?php namespace Foo;
use Bar as Baz;
/**
 * @param Foo $param1
 * @param Bar $param2
 * @param Baz $param3
 * @param \Foo $param4
 * @param string $param5
 */

Parse and output the docblock with its types normalized:, (*6)

$parser = new \Mfn\DocblockNormalize\Parser(
    new \Mfn\DocblockNormalize\TokenParser
);

$docblocks = $parser->parseFile('sample.php');

echo $docblocks[0]->getNormalizedContent();

Will return:, (*7)

/**
 * @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!, (*8)

Note 2: the normalization also removes leading backslashes, this is expected!, (*9)

Contribute

Fork it, hack on a feature branch, create a pull request, be awesome!, (*10)

No developer is an island so adhere to these standards:, (*11)

© Markus Fischer markus@fischer.name, (*12)

The Versions

21/11 2015

dev-master

9999999-dev http://github.com/mfn/php-docblock-normalize

Extracts doc blocks and normalizes the references classes based on the current namespace and use-aliases

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Markus Fischer

docblock extract type namespace resolve normalize

21/11 2015

0.1

0.1.0.0 http://github.com/mfn/php-docblock-normalize

Extracts doc blocks and normalizes the references classes based on the current namespace and use-aliases

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Markus Fischer

docblock extract type namespace resolve normalize