Download the PHP package jawira/annotation-updater without Composer
On this page you can find all versions of the php package jawira/annotation-updater. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download jawira/annotation-updater
More information about jawira/annotation-updater
Files in jawira/annotation-updater
Download jawira/annotation-updater
More information about jawira/annotation-updater
Files in jawira/annotation-updater
Vendor jawira
Package annotation-updater
Short Description 🏷️ Custom PHP-CS-Fixer rule to update PHPDoc tags.
License MIT
Package annotation-updater
Short Description 🏷️ Custom PHP-CS-Fixer rule to update PHPDoc tags.
License MIT
Please rate this library. Is it a good library?
Informations about the package annotation-updater

[](https://packagist.org/packages/jawira/annotation-updater)
[](https://packagist.org/packages/jawira/annotation-updater)
[](https://packagist.org/packages/jawira/annotation-updater)
[](https://github.com/jawira/annotation-updater/actions/workflows/qa.yaml)
This [PHP-CS-Fixer](https://cs.symfony.com/) rule helps you **manage PHPDoc
tags**
in classes, interfaces, traits, and enums.
in classes, interfaces, traits, and enums.
Installation
Usage
Registering the fixer
In your .php-cs-fixer.php register and configure AnnotationUpdater:
- Use
Config::registerCustomFixers()to register an instance ofAnnotationUpdater. - Use
Config::setRules()to specify fixer's configuration under theJawira/annotation_updaterkey.
Example:
This is the result after executing the previous configuration:
Configuration
The fixer accepts a single configuration key: annotations. This is an array of
annotation rules to apply.
Each rule is an array with the following structure.
tag: The PHPDoc tag name without the@.value: The value of the tag. Do not set this key forremovemode!mode: One ofpreserve,replace, orremove.
Example:
Mode
The fixer has three different modes:
preserve: Do not replace a tag if it is already present. If the tag is missing, it will be added. For example, this mode can add an@authortag to classes that do not already have one.replace: Always replace the tag with the configured value. This updates the value of existing tags and adds the tag when it is not present.remove: Remove the tag if it is present. This is useful for deleting unwanted tags, such as@todo.
The mode behavior is summarized in the following table.
| Mode | Tag is not present | Tag is present |
|---|---|---|
preserve |
Add tag | Do nothing |
replace |
Add tag | Replace tag |
remove |
Do nothing | Remove tag |
Contributing
- If you like this project, ⭐ star it on GitHub.
- Or, follow me on 𝕏.
- Found a bug? Please report it by opening an issue!
License
This library is licensed under the MIT license.
Disclaimer
- Yes, I know that annotations are not the same as PHPDoc tags, but when I realized this, it was too late. Properly speaking, this library updates PHPDoc tags, not annotations.
- This project is inspired by
konradmichalik/php-doc-block-header-fixer.
Packages from jawira
-
jawira/doctrine-diagram-bundle
- Symfony Bundle to generate database diagrams.
-
jawira/case-converter
- Convert strings between 13 naming conventions: Snake case, Camel case, Pascal case, Kebab case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Sentence case, Title case and Dot notation.
- more...
All versions of annotation-updater with dependencies
PHP Build Version
Package Version
The package jawira/annotation-updater contains the following files
Loading the files please wait ...