argo-php / docblock-parser
PHP DocBlock parser
Installs: 2
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:package
pkg:composer/argo-php/docblock-parser
Requires
- php: 8.3.*|8.4.*|8.5.*
- ext-tokenizer: *
- argo-php/types: ^1.0
- phpstan/phpdoc-parser: ^1.33
Requires (Dev)
- laravel/pint: ^1.25
- mockery/mockery: ^1.6
- phpunit/phpunit: ^11.0
- roave/security-advisories: dev-latest
- vimeo/psalm: ^6.13
README
PHPDoc parser. Unlike existing solutions, it immediately returns types in package format argo-php/types.
Usage
Parsing PHPDoc from a string:
use Argo\DocBlockParser\Parser; use Argo\DocBlockParser\Context\ContextFactory; use Argo\DocBlockParser\PhpDocFactory; $phpDocParser = new Parser(); $phpDoc = $phpDocParser->parse('/** @var string $hello */');
Getting all PHPDoc tags from reflection:
use Argo\DocBlockParser\Parser; use Argo\DocBlockParser\Context\ContextFactory; use Argo\DocBlockParser\PhpDocFactory; $phpDocFactory = new PhpDocFactory(new Parser(), new ContextFactory()); $reflection = new \ReflectionClass('MyClassWithPhpDoc'); $phpDoc = $phpDocFactory->getPhpDocFromReflector($reflection);