Commit 21d331c
test: add rule-author contract tests for ADR-0021 §Doctrine source + §Identifier convention
Promotes two ADR-0021 rule-author conventions from CLAUDE.md prose (Level 4)
to PHPUnit reflection-tests (Level 2):
- F-6 (RuleDocblockContractTest): every class under src/Rules/ must declare
a "Doctrine source:" line in its class-level docblock. Reflects on the rule
class via ReflectionClass::getDocComment() and asserts the contract string
is present, naming the offending class on failure.
- F-7 (RuleIdentifierConventionTest): every RuleErrorBuilder->identifier(...)
string under src/Rules/ must follow a cameLCase.cameLCase shape. Scans rule
source via regex, names the offending file + identifier on failure, and
guards against silent zero-match via a "no identifiers found" terminal
assertion.
Both tests pass 5/5 against the current rule set (no rule changes). They
fire the Phase-2 candidate (EnforceExplicitHydrationRule) into a contract
the package locks rather than narrates.
Doctrine alignment: PHPUnit reflection on the package's own rule classes
is rule-authoring discipline (how rules are written), not rule enforcement
(what rules check). It does not contradict CLAUDE.md §"What this territory
does NOT do" — that stance prevents running App\Actions-scoped PHPStan
rules against src/Rules/, not PHPUnit assertions about rule-author contracts.
Commander disposition resolved 2026-05-06 under Reading 2.
Negative-case verification (manual, reverted before commit):
- Removed "Doctrine source:" from ForbidAbortHelperRule's docblock —
RuleDocblockContractTest fired with the offending class name and the
ADR-0021 reference. Reverted.
- Replaced 'forbidAbortHelper.abortUsed' with 'BadIdentifier' —
RuleIdentifierConventionTest fired naming the file and the malformed
identifier. Reverted.
Origin: Quartermaster M1 first-contact F-6 + F-7. Order:
orders/phpstan-warroom-rules/rule-author-contract-tests-armorer-deployment.md.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 87b22cf commit 21d331c
2 files changed
Lines changed: 114 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments