Summary
Normalize enum and exception coverage conventions across the core packages so coverage reporting is consistent and intentional.
Problem
Current codebase has inconsistent patterns:
- enum-like classes are mixed (
final vs non-final, private constructor missing in some, @codeCoverageIgnore used inconsistently)
- exception classes appear inconsistently covered (some only indirect coverage, some uncovered)
This makes coverage numbers noisy and hard to interpret.
Scope
- apply one enum pattern to constant-holder classes
- apply one exception coverage/testing policy
- keep changes focused and backward-compatible
Proposed standards
Enums (constant-holder classes)
- use
final class
- add
private function __construct()
- add
@codeCoverageIgnore for pure constant-holder enums
- do not add tests that only reference constants
Exceptions
- do not blanket-ignore all exception classes
- add focused unit tests for exception factory behavior (message/code/previous) where logic exists
- for trivial pass-through exception wrappers, keep one consistent policy (either intentionally ignored or intentionally uncovered), documented in repo
Initial candidates to normalize
src/App/Enums/ExceptionMessages.php
src/Auth/Enums/AuthKeys.php
src/Database/Enums/Key.php
src/Database/Enums/Relation.php
src/Database/Enums/Type.php
src/Environment/Enums/Env.php
src/Http/Enums/ContentType.php
src/Http/Enums/StatusCode.php
src/Paginator/Enums/Pagination.php
src/Cron/Enums/ExceptionMessages.php (verify structure consistency)
Acceptance criteria
- enum-like constant-holder classes follow one shared structure
- exception coverage policy is applied consistently in code/tests
- no behavior regressions
- validation passes:
vendor/bin/phpunit
composer phpstan
composer cs:check
Reference
- local proposal:
docs/tickets/enum-exception-coverage-policy.md
Summary
Normalize enum and exception coverage conventions across the core packages so coverage reporting is consistent and intentional.
Problem
Current codebase has inconsistent patterns:
finalvs non-final, private constructor missing in some,@codeCoverageIgnoreused inconsistently)This makes coverage numbers noisy and hard to interpret.
Scope
Proposed standards
Enums (constant-holder classes)
final classprivate function __construct()@codeCoverageIgnorefor pure constant-holder enumsExceptions
Initial candidates to normalize
src/App/Enums/ExceptionMessages.phpsrc/Auth/Enums/AuthKeys.phpsrc/Database/Enums/Key.phpsrc/Database/Enums/Relation.phpsrc/Database/Enums/Type.phpsrc/Environment/Enums/Env.phpsrc/Http/Enums/ContentType.phpsrc/Http/Enums/StatusCode.phpsrc/Paginator/Enums/Pagination.phpsrc/Cron/Enums/ExceptionMessages.php(verify structure consistency)Acceptance criteria
vendor/bin/phpunitcomposer phpstancomposer cs:checkReference
docs/tickets/enum-exception-coverage-policy.md