All Projects → deprecated-packages → BetterPhpDocParser

deprecated-packages / BetterPhpDocParser

Licence: MIT license
[DEPRECATED] Moved to

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to BetterPhpDocParser

jodit-vue
Vue wrapper for Jodit Editor
Stars: ✭ 60 (+33.33%)
Mutual labels:  wrapper
dokan-delphi
Dokan Delphi Wrapper
Stars: ✭ 48 (+6.67%)
Mutual labels:  wrapper
sodium-wrapper
C++17 wrappers for libsodium
Stars: ✭ 15 (-66.67%)
Mutual labels:  wrapper
dbots.js
A stats poster and API wrapper for all botlists.
Stars: ✭ 18 (-60%)
Mutual labels:  wrapper
careful rm
A safe wrapper for rm that adds useful warnings and an optional recycle/trash mode
Stars: ✭ 22 (-51.11%)
Mutual labels:  wrapper
node-aplay
🎵 ALSA aplay wrapper for Node.js
Stars: ✭ 30 (-33.33%)
Mutual labels:  wrapper
node-freshdesk-api
Node wrapper for Freshdesk v2 API
Stars: ✭ 24 (-46.67%)
Mutual labels:  wrapper
ansible-taskrunner
Ansible Taskrunner - ansible-playbook wrapper with YAML-abstracted python click cli options!
Stars: ✭ 14 (-68.89%)
Mutual labels:  wrapper
python-qnapstats
Python API for obtaining QNAP NAS system stats
Stars: ✭ 45 (+0%)
Mutual labels:  wrapper
Grabber
A wrapper for Youtube-dl for Windows.
Stars: ✭ 22 (-51.11%)
Mutual labels:  wrapper
libssh2.nim
Nim wrapper for libssh2
Stars: ✭ 25 (-44.44%)
Mutual labels:  wrapper
haskell-libui
Haskell bindings to the libui C library.
Stars: ✭ 45 (+0%)
Mutual labels:  wrapper
igdb
IGDB PHP API Wrapper
Stars: ✭ 20 (-55.56%)
Mutual labels:  wrapper
google-pubsub-emulator
Google PubSub Emulator wrapper to nodejs
Stars: ✭ 28 (-37.78%)
Mutual labels:  wrapper
activecampaign-python
ActiveCampaign API wrapper written in python.
Stars: ✭ 25 (-44.44%)
Mutual labels:  wrapper
confirm-before
✅ Are you sure? No? Confirm Before - Sanity check for your shell commands
Stars: ✭ 16 (-64.44%)
Mutual labels:  wrapper
angsd-wrapper
Utilities for analyzing next generation sequencing data.
Stars: ✭ 13 (-71.11%)
Mutual labels:  wrapper
laravel-web3
Laravel SDK wrapper for the Web3 PHP API client that interacts with the Ethereum blockchain.
Stars: ✭ 85 (+88.89%)
Mutual labels:  wrapper
ig-markets
IG Markets API wrapper for Node.js
Stars: ✭ 23 (-48.89%)
Mutual labels:  wrapper
sql capsule
Less ORM, more SQL
Stars: ✭ 27 (-40%)
Mutual labels:  wrapper

Deprecated, moved to Rector

Better PhpDoc Parser

Build Status Downloads

Wrapper around phpstan/phpdoc-parser that adds format preserving printer.

When do We Need Format Preserving Printer?

Original code

/**
 * @param   string   $name
 * @param   string   $surname
 * @return  bool
  */

Printed by PHPStan PhpDocParser

/**
 * @param string $name
 * @param string $surname
 * @return bool
 */

Printed by Better PhpDocParser 👍

/**
 * @param   string   $name
 * @param   string   $surname
 * @return  bool
 */

Symplify\CodingStandard and Rector need to modify docblock and put it back in correct format. Other packages often put own spacing, or formats of specific tags.

This package preserve original spacing.

Thanks for inspiration in Format Preserving Printer feature in nikic/php-parser.

Install

composer require symplify/better-phpdoc-parser

Usage

Register services in your Symfony config:

# services.yaml
imports:
    - { resource: 'vendor/symplify/better-phpdoc-parser/config/config.yml' }

or register the needed services from services.yaml in config of your other framework.

<?php

use Symplify\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Symplify\BetterPhpDocParser\Printer\PhpDocInfoPrinter;

class SomeClass
{
    public function __construct(PhpDocInfoFactory $phpDocInfoFactory, PhpDocInfoPrinter $phpDocInfoPrinter)
    {
        $this->phpDocInfoFactory = $phpDocInfoFactory;
        $this->phpDocInfoPrinter = $phpDocInfoPrinter;
    }

    public function changeDocBlockAndPrintItBack(): string
    {
        $docComment = '/**    @var Type $variable    */';

        $phpDocInfo = $this->phpDocInfoFactory->createFrom($docComment);

        // modify `$phpDocInfo` using its methods

        return $this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo);
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].