{"id":23220856,"url":"https://github.com/deprecated-packages/betterphpdocparser","last_synced_at":"2025-08-19T10:32:10.251Z","repository":{"id":57063829,"uuid":"130851047","full_name":"deprecated-packages/BetterPhpDocParser","owner":"deprecated-packages","description":"[DEPRECATED] Moved to","archived":false,"fork":false,"pushed_at":"2019-03-05T23:26:42.000Z","size":170,"stargazers_count":43,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-02T06:07:17.605Z","etag":null,"topics":["format-preserving-printer","php","phpdoc","phpdoc-parser","phpstan","wrapper"],"latest_commit_sha":null,"homepage":"https://github.com/rectorphp/rector","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deprecated-packages.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-24T12:31:02.000Z","updated_at":"2024-03-19T10:33:03.000Z","dependencies_parsed_at":"2022-08-24T10:10:11.673Z","dependency_job_id":null,"html_url":"https://github.com/deprecated-packages/BetterPhpDocParser","commit_stats":null,"previous_names":["symplify/betterphpdocparser"],"tags_count":76,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FBetterPhpDocParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FBetterPhpDocParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FBetterPhpDocParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FBetterPhpDocParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deprecated-packages","download_url":"https://codeload.github.com/deprecated-packages/BetterPhpDocParser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230346000,"owners_count":18211999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["format-preserving-printer","php","phpdoc","phpdoc-parser","phpstan","wrapper"],"created_at":"2024-12-18T22:14:17.168Z","updated_at":"2024-12-18T22:14:19.062Z","avatar_url":"https://github.com/deprecated-packages.png","language":"PHP","readme":"# [Deprecated, moved to Rector](https://github.com/rectorphp/rector)\n\n# Better PhpDoc Parser\n\n[![Build Status](https://img.shields.io/travis/Symplify/BetterPhpDocParser/master.svg?style=flat-square)](https://travis-ci.org/Symplify/BetterPhpDocParser)\n[![Downloads](https://img.shields.io/packagist/dt/symplify/better-phpdoc-parser.svg?style=flat-square)](https://packagist.org/packages/symplify/better-phpdoc-parser/stats)\n\nWrapper around [phpstan/phpdoc-parser](https://github.com/phpstan/phpdoc-parser) that adds **format preserving printer**.\n\n## When do We Need Format Preserving Printer?\n\n**Original code**\n\n```php\n/**\n * @param   string   $name\n * @param   string   $surname\n * @return  bool\n  */\n```\n\n**Printed by PHPStan PhpDocParser** :x:\n\n```php\n/**\n * @param string $name\n * @param string $surname\n * @return bool\n */\n```\n\n**Printed by Better PhpDocParser** :+1:\n\n```php\n/**\n * @param   string   $name\n * @param   string   $surname\n * @return  bool\n */\n```\n\n[Symplify\\CodingStandard](https://github.com/symplify/codingstandard) and [Rector](https://github.com/rectorphp/rector) need to modify docblock and put it back in correct format. Other packages often put own spacing, or formats of specific tags.\n\n**This package preserve original spacing**.\n\nThanks for [inspiration in *Format Preserving Printer* feature in `nikic/php-parser`](https://github.com/nikic/PHP-Parser/issues/487).\n\n## Install\n\n```bash\ncomposer require symplify/better-phpdoc-parser\n```\n\n## Usage\n\nRegister services in your Symfony config:\n\n```yaml\n# services.yaml\nimports:\n    - { resource: 'vendor/symplify/better-phpdoc-parser/config/config.yml' }\n```\n\nor register the needed services from `services.yaml` in config of your other framework.\n\n```php\n\u003c?php\n\nuse Symplify\\BetterPhpDocParser\\PhpDocInfo\\PhpDocInfoFactory;\nuse Symplify\\BetterPhpDocParser\\Printer\\PhpDocInfoPrinter;\n\nclass SomeClass\n{\n    public function __construct(PhpDocInfoFactory $phpDocInfoFactory, PhpDocInfoPrinter $phpDocInfoPrinter)\n    {\n        $this-\u003ephpDocInfoFactory = $phpDocInfoFactory;\n        $this-\u003ephpDocInfoPrinter = $phpDocInfoPrinter;\n    }\n\n    public function changeDocBlockAndPrintItBack(): string\n    {\n        $docComment = '/**    @var Type $variable    */';\n\n        $phpDocInfo = $this-\u003ephpDocInfoFactory-\u003ecreateFrom($docComment);\n\n        // modify `$phpDocInfo` using its methods\n\n        return $this-\u003ephpDocInfoPrinter-\u003eprintFormatPreserving($phpDocInfo);\n    }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeprecated-packages%2Fbetterphpdocparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeprecated-packages%2Fbetterphpdocparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeprecated-packages%2Fbetterphpdocparser/lists"}