Conform the library to the tiny-blocks rules and skill canon.#10
Merged
Conversation
Align the package with the .claude/rules and the tiny-blocks-create skill: restore the canonical tooling, refactor src to the coding and architecture rules, rewrite the tests to the BDD, naming, and ordering rules, and fix the README to the documentation rules. - Restore canonical config: add phpcs.xml, reduce composer.json to the five standard scripts with keywords and the dev-dependency floor, run PHPStan at level max over src and tests, and align phpunit, infection, the editor and git config files, the Makefile, and ci.yml. - Refactor src: move LogLevel under Internal, keep Internal types out of the public API through StructuredLogger::from, make the builder an immutable final readonly value, and apply the naming, ordering, self-reference, and format-string rules. An unknown PSR-3 level now raises the dedicated UnknownLogLevel instead of a native error. - Rewrite the tests onto an InMemoryStream fixture with testXxxWhenYyyThenZzz names and corrected BDD steps, covering the unknown-level and stderr fallback paths through the public API.
Track the .claude rules, hooks, skills, and settings together with the root CLAUDE.md so contributors share the same coding-standard tooling. The per-clone settings.local.json stays ignored.
There was a problem hiding this comment.
Pull request overview
This pull request aligns the logger library with the tiny-blocks canon by introducing the .claude/ rules and skills, standardizing tooling and CI, and refactoring the logger/redaction internals to follow the updated naming and immutability conventions.
Changes:
- Refactor
StructuredLogger/StructuredLoggerBuilderto an immutable builder flow and addUnknownLogLevelfor unsupported levels. - Normalize redaction terminology from
datatopayloadacross redaction APIs and internal redaction pipeline. - Restore canonical tiny-blocks repository/tooling shape (CI workflow, Makefile, PHPUnit/PHPStan/PHPCS config, docs, and
.claude/rules/skills/hooks).
Reviewed changes
Copilot reviewed 60 out of 61 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Internal/Stream/LogStreamTest.php | Removes redundant internal stream test. |
| tests/InMemoryStream.php | Adds in-memory stream test helper. |
| src/StructuredLoggerBuilder.php | Makes builder immutable and documented. |
| src/StructuredLogger.php | Adds from() factory and level validation. |
| src/Redactions/PhoneRedaction.php | Payload naming + docs + template var. |
| src/Redactions/PasswordRedaction.php | Payload naming + docs. |
| src/Redactions/NameRedaction.php | Payload naming + docs + template var. |
| src/Redactions/EmailRedaction.php | Payload naming + docs + template var. |
| src/Redactions/DocumentRedaction.php | Payload naming + docs + template var. |
| src/Redaction.php | Renames data to payload in contract. |
| src/LogContext.php | Adds class and factory PHPDoc. |
| src/Internal/Stream/LogStream.php | Minor null-check style adjustment. |
| src/Internal/Redactor/Redactor.php | Renames data to payload internally. |
| src/Internal/Redactor/Redactions.php | Renames applyTo(data) to applyTo(payload). |
| src/Internal/LogLevel.php | Moves enum to Internal namespace. |
| src/Internal/LogFormatter.php | Reorders ctor args and updates format signature. |
| src/Exceptions/UnknownLogLevel.php | Adds dedicated PSR-3 invalid-level exception. |
| README.md | Expands and canonicalizes usage documentation/examples. |
| phpunit.xml | Aligns PHPUnit config with canonical tiny-blocks settings. |
| phpstan.neon.dist | Moves to level: max, adds scoped suppressions. |
| phpcs.xml | Adds canonical PSR-12 ruleset file. |
| Makefile | Aligns targets to canonical configure/review/tests workflow. |
| infection.json.dist | Updates report paths and canonical mutator config. |
| composer.json | Adds keywords, canonical scripts, dependency bumps. |
| CLAUDE.md | Adds repo index for rules/skills and validation commands. |
| .gitignore | Canonical ignore list incl. reports and local overrides. |
| .github/workflows/ci.yml | Canonical CI with PHP version resolved from composer.json. |
| .gitattributes | Canonical export-ignore set + linguist vendoring. |
| .editorconfig | Adds canonical max_line_length = 120. |
| .claude/skills/tiny-blocks-create/SKILL.md | Adds scaffolding skill definition. |
| .claude/skills/tiny-blocks-create/assets/github/workflows/ci.yml | Adds canonical CI workflow asset. |
| .claude/skills/tiny-blocks-create/assets/github/PULL_REQUEST_TEMPLATE.md | Adds PR template asset. |
| .claude/skills/tiny-blocks-create/assets/github/ISSUE_TEMPLATE/feature_request.md | Adds feature request template asset. |
| .claude/skills/tiny-blocks-create/assets/github/ISSUE_TEMPLATE/bug_report.md | Adds bug report template asset. |
| .claude/skills/tiny-blocks-create/assets/docs/SECURITY.md | Adds SECURITY.md asset. |
| .claude/skills/tiny-blocks-create/assets/config/phpunit.xml | Adds PHPUnit config asset. |
| .claude/skills/tiny-blocks-create/assets/config/phpstan.neon.dist | Adds PHPStan baseline asset. |
| .claude/skills/tiny-blocks-create/assets/config/phpcs.xml | Adds PHPCS ruleset asset. |
| .claude/skills/tiny-blocks-create/assets/config/Makefile | Adds Makefile asset. |
| .claude/skills/tiny-blocks-create/assets/config/infection.json.dist | Adds Infection config asset. |
| .claude/skills/tiny-blocks-create/assets/config/composer.json | Adds Composer canonical asset. |
| .claude/skills/tiny-blocks-create/assets/config/.gitignore | Adds gitignore canonical asset. |
| .claude/skills/tiny-blocks-create/assets/config/.gitattributes | Adds gitattributes canonical asset. |
| .claude/skills/tiny-blocks-create/assets/config/.editorconfig | Adds editorconfig canonical asset. |
| .claude/skills/tiny-blocks-consume/SKILL.md | Adds dependency reuse skill definition. |
| .claude/skills/tiny-blocks-consume/scripts/refresh-catalog.py | Adds Packagist catalog refresh script. |
| .claude/skills/tiny-blocks-consume/references/catalog.md | Adds initial tiny-blocks package catalog. |
| .claude/skills/commit-message/SKILL.md | Adds conventional commit-message skill. |
| .claude/settings.json | Adds Claude settings and tool permissions. |
| .claude/rules/php-library-tooling.md | Adds canonical tooling invariants. |
| .claude/rules/php-library-testing.md | Adds canonical testing conventions. |
| .claude/rules/php-library-modeling.md | Adds canonical modeling rules. |
| .claude/rules/php-library-github-workflows.md | Adds canonical workflow conventions. |
| .claude/rules/php-library-documentation.md | Adds canonical README/docs rules. |
| .claude/rules/php-library-code-style.md | Adds canonical code style rules. |
| .claude/rules/php-library-architecture.md | Adds canonical folder/API boundary rules. |
| .claude/hooks/php-prose-punctuation-conformance.py | Adds prose punctuation conformance hook. |
| .claude/hooks/php-ordering-conformance.py | Adds member/parameter ordering conformance hook. |
| .claude/CLAUDE.md | Removes obsolete .claude/ index file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.