You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Document DocBlockTagOrder configuration
Add a docs/README.md section covering the three public properties of
PhpCollective.Commenting.DocBlockTagOrder: order (function/method
docblocks), classOrder (class/interface/trait docblocks), and
innerOrder (within-bucket ordering with prefix patterns). These were
only discoverable by reading the sniff source.
Includes both common innerOrder recipes (CRUD method ordering plus
alphabetized property lists), notes the asymmetric handling of the
leading at-sign on tag names between order/classOrder and innerOrder
keys, and explains the InnerOrderInvalid error code as a scoping
lever for keeping inner ordering on tables/views/controllers while
skipping entity docblocks where DB-schema order is meaningful.
* Update README.md
Copy file name to clipboardExpand all lines: docs/README.md
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,65 @@ To enable checking for (and auto-fixing) invalid `: void` return types on these
98
98
</rule>
99
99
```
100
100
101
+
## Customize DocBlock tag ordering
102
+
`PhpCollective.Commenting.DocBlockTagOrder` enforces a consistent tag order in docblocks for functions, methods, classes, interfaces, and traits. Three properties can be overridden via XML.
103
+
104
+
### Function/method docblock order
105
+
Default: `deprecated`, `see`, `param`, `throws`, `return`. Tags not in the list keep their relative position above the listed ones. The leading `@` on tag names is optional and gets normalized.
Default: `template`, `extends`, `implements`, `property`, `property-read`, `property-write`, `method`, `mixin`. Independent of `order` so function and class docblocks can be tuned separately.
Optional. When configured, orders tags *within* a bucket. Only applies to class/interface/trait docblocks - per-method `@param` / `@return` tags are positional and have no within-bucket subject.
126
+
127
+
Each entry's value is a comma-separated list of prefix patterns. A trailing `*` matches any suffix; a bare pattern matches only the exact subject. Tags matching no pattern float to the bottom of their bucket. Within each score class (matched-by-same-pattern, or all-unmatched), tags are sorted alphabetically by extracted subject.
128
+
129
+
An empty value means "alphabetize the whole bucket" - the typical recipe for `@property` association lists generated by IDE helpers.
130
+
131
+
Example covering both recipes (CRUD method order plus alphabetized property lists):
Note: `innerOrder` keys are matched literally - the leading `@` is required, unlike for `order` / `classOrder`.
147
+
148
+
#### Scoping innerOrder out of entity docblocks
149
+
On CakePHP-style entities the property docblocks list columns in DB schema order (id first, logical fields together, timestamps last). That order is meaningful and stays in sync with `cakephp-ide-helper` regeneration. Alphabetizing breaks column groupings (`lat` / `lng` / `location`, `beginning` / `end`, `lft` / `rght`) and creates churn against the IDE helper.
150
+
151
+
Inner-order violations are emitted under a separate `InnerOrderInvalid` error code so they can be suppressed independently from the bucket-level `OrderInvalid`:
0 commit comments