- What does jawira/annotation-updater do?
- It is a custom PHP-CS-Fixer rule that updates PHPDoc annotations in your PHP source files. You define annotation rules in a config file, and the tool keeps tags such as @author, @since, @deprecated, and custom tags in sync with your code. It runs as a CLI tool through PHP-CS-Fixer.
- How do I install jawira/annotation-updater in a Laravel project?
- Install it as a development dependency with Composer, for example composer require --dev jawira/annotation-updater. Then reference the custom rule in your PHP-CS-Fixer configuration and define your annotation rules. Commit the configuration so other developers and CI use the same rules.
- Does jawira/annotation-updater support Laravel 10, 11, and 12?
- The package is framework-agnostic because it operates on PHP files through PHP-CS-Fixer, so Laravel version support mostly depends on your PHP and PHP-CS-Fixer versions. Check the package's Composer requirements before installing on older Laravel applications. It should work with Laravel 10, 11, and 12 as long as those requirements are met.
- How do I configure the annotation rules?
- You define rules in the tool's configuration file, specifying which PHPDoc tags to update and the values or logic to apply. Run the rule through PHP-CS-Fixer like any other fixer. The exact configuration schema is documented in the package README.
- Can it update custom PHPDoc annotations, not just @author and @since?
- Yes. Beyond standard tags like @author, @since, and @deprecated, the tool is designed to handle custom annotations you define. You add those tags to the configuration and let the rule update them across the configured paths.
- How is jawira/annotation-updater different from PHP-CS-Fixer's built-in fixers?
- PHP-CS-Fixer's built-in fixers mainly handle code style and standard PHPDoc formatting. jawira/annotation-updater focuses on the content of annotation tags, such as setting @author or @since values and keeping custom tags consistent. It plugs into the same PHP-CS-Fixer workflow rather than replacing it.
- Can I preview annotation changes before files are modified?
- Yes, run PHP-CS-Fixer in dry-run mode with diff output to see proposed annotation changes without modifying files. Review the diff, then rerun without dry-run to apply the updates. This is useful before committing a large annotation sync.
- How do I run jawira/annotation-updater in CI or a Git hook?
- Add PHP-CS-Fixer with this rule to your CI pipeline and run it with --dry-run --diff so the job fails when annotations are out of sync. Cache Composer dependencies to keep the job fast. Developers can run the same command locally or in a Git pre-commit hook.
- Will it modify vendor or third-party code?
- No, as long as your PHP-CS-Fixer Finder configuration only includes your application paths. PHP-CS-Fixer processes the files and directories you explicitly configure, so exclude vendor and generated code. Always check the dry-run diff before applying changes.
- Is jawira/annotation-updater safe to use in production?
- It is a development tool and should be installed as a dev dependency, not used at runtime in production. It changes source files, so run it locally or in CI and review the diff before committing. Production deployments should use the reviewed code, not run the updater during deploy.