Annotations Updater
The Annotator keeps doc blocks and annotations in sync with your code without modifying functional code.
Note that freshly baking your code produces similar results, but most projects already have existing code where re-baking is not an option. The annotator also keeps manually added or modified code annotated.
Important Options to Start With
The following are defined under the IdeHelper key in app.php:
arrayAsGenerics: Set totrueto use modern generics syntax (array<type>instead of legacytype[]).
See the Configuration reference for the full list.
Per-Class-Type Reference
Each class type has its own page covering the dedicated subcommand and the options that apply only to that type:
- Controllers —
bin/cake annotate controllers - Models —
bin/cake annotate models(Tables and Entities) - View, Components, Helpers —
annotate view,annotate components,annotate helpers - Templates —
bin/cake annotate templates - Commands and Routes —
bin/cake annotate commands - Classes — class-level annotators (
ModelAware,Form::execute(),Mailer::send(),Test, custom) - Callbacks — method-level annotators (
TableCallbackAnnotatorTask, custom)
Cross-Cutting
- Operations — running all commands, dry-run, filters, removal, file watcher, CI
- Custom Class Annotators — full PHP-AST example
Replacing Native Tasks
Using associative arrays you can swap any native task with your own implementation:
php
'IdeHelper' => [
'annotators' => [
\IdeHelper\Annotator\EntityAnnotator::class => \App\Annotator\MyEnhancedEntityAnnotator::class,
],
],The native class name is the key, your replacement the value. Setting the value to null disables a native task entirely.