Skip to content

Update docs: fix README usage examples, add CI badges, document README-sync convention - #7

Merged
trm42 merged 1 commit into
masterfrom
update-docs
Jun 11, 2026
Merged

trm42 merged 1 commit into
masterfrom
update-docs

Conversation

@trm42

@trm42 trm42 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

What changed

README.md

  • CI status badges added under the title (Tests, PHPStan, Code style), pointing at the trm42/CacheDecorator workflow files imported in PR Import CI workflows from spatie/package-skeleton-laravel #6.

  • Usage examples fixed to compile and run against the current code. Recent commits (US-007) made the configurable properties on CacheDecorator strictly typed, so the old untyped redeclarations (protected $ttl = 300;, protected $prefix_key = 'reports';, etc.) would now be a fatal error. Each example now:

    • types redeclared properties to match the parent (protected ?string $prefix_key, protected array $excludes, etc.);
    • drops the protected $ttl = 300; line — getConfig() runs in the constructor and overwrites $ttl from config, so it never took effect; replaced with a note that TTL comes from config or setTtl();
    • adds #[\Override] on decoratedClass() overrides (US-006);
    • adds @extends CacheDecorator<...> / @extends RepositoryCacheDecorator<...> PHPDoc for IDE/PHPStan type inference (US-005 generics).

    These now follow the same conventions as the test stubs under src/tests/Stubs/.

CLAUDE.md

  • Added a "Keep the README in sync" convention: any src/ change affecting the main classes' public-facing surface must be documented in README.md as part of the same change, since the usage examples are a core part of the package DX.

Also included (from prior work on this branch, not yet in master)

  • CI workflows imported from the Spatie package skeleton (run-tests, phpstan, fix-php-code-style-issues, dependabot-auto-merge).
  • Test stub directory renamed stubs → Stubs to match the PSR-4 namespace.

Why

The documented examples no longer matched the code and would fatal-error on copy-paste; the badges surface CI status; the CLAUDE.md convention prevents the docs from drifting again.

Verification

  • composer check green: 28 tests pass, PHPStan reports no errors, Pint passes.
  • Each updated example was mirrored in a scratch file and loaded against the real base classes via the autoloader — no property-type fatals.

@trm42
trm42 merged commit f4413fa into master Jun 11, 2026
1 check passed
@trm42
trm42 deleted the update-docs branch June 11, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant