Adopt canonical rule set and promote public exceptions.#9
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns the repository with the canonical tiny-blocks rule set, restructures tooling/CI configs accordingly, and promotes previously-internal exceptions into the public API (TinyBlocks\Time\Exceptions).
Changes:
- Promote time-domain exceptions from
TinyBlocks\Time\Internal\ExceptionstoTinyBlocks\Time\Exceptionsand update imports/usages acrosssrc/andtests/. - Adopt canonical tooling and workflow conventions (Composer scripts, PHPUnit/PHPStan/PHPCS config, report paths under
reports/, CI concurrency and PHP version resolution). - Refresh README/documentation scaffolding (expanded TOC, self-contained code examples, security policy, issue/PR templates).
Reviewed changes
Copilot reviewed 49 out of 50 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/TimezoneTest.php | Updates test namespace and switches to public InvalidTimezone. |
| tests/Unit/TimezonesTest.php | Updates test namespace, exception import, and BDD annotations. |
| tests/Unit/TimeOfDayTest.php | Updates test namespace and switches to public InvalidTimeOfDay. |
| tests/Unit/PeriodTest.php | Updates test namespace and switches to public InvalidPeriod. |
| tests/Unit/InstantTest.php | Updates test namespace and switches to public InvalidInstant. |
| tests/Unit/DurationTest.php | Updates test namespace and switches to public InvalidSeconds. |
| tests/Unit/DayOfWeekTest.php | Updates test namespace. |
| src/Timezones.php | Switches to public InvalidTimezone and removes PHPDoc from ctor/property. |
| src/Timezone.php | Switches to public InvalidTimezone, tightens empty-string check, uses named ctor arg for DateTimeZone. |
| src/TimeOfDay.php | Switches to public InvalidTimeOfDay and applies format-string templating rule. |
| src/Period.php | Switches to public InvalidPeriod. |
| src/Internal/TextDecoder.php | Switches to public InvalidInstant, removes internal PHPDoc, renames temp variable. |
| src/Internal/Seconds.php | Switches to public InvalidSeconds and removes Internal PHPDoc. |
| src/Internal/Decoders/OffsetDateTimeDecoder.php | Uses named ctor arg for DateTimeZone. |
| src/Instant.php | Switches to public InvalidInstant, uses named ctor args, applies format-string templating rule. |
| src/Duration.php | Switches to public InvalidSeconds and reorders constants. |
| src/DayOfWeek.php | Adjusts fromInstant implementation style. |
| src/Exceptions/InvalidTimezone.php | Moves exception into public TinyBlocks\Time\Exceptions namespace. |
| src/Exceptions/InvalidTimeOfDay.php | Moves exception into public TinyBlocks\Time\Exceptions namespace. |
| src/Exceptions/InvalidSeconds.php | Moves exception into public TinyBlocks\Time\Exceptions namespace. |
| src/Exceptions/InvalidPeriod.php | Moves exception into public TinyBlocks\Time\Exceptions namespace. |
| src/Exceptions/InvalidInstant.php | Moves exception into public TinyBlocks\Time\Exceptions namespace. |
| SECURITY.md | Adds canonical security policy. |
| README.md | Expands canonical TOC and makes examples self-contained. |
| phpunit.xml | Tightens PHPUnit strictness flags and relocates report outputs to reports/. |
| phpstan.neon.dist | Updates to level: max, includes tests/, and adds scoped ignore rules. |
| phpcs.xml | Adds canonical PHPCS ruleset file. |
| Makefile | Canonicalizes targets and aligns report paths with reports/. |
| infection.json.dist | Aligns Infection paths with reports/ and removes mutator override. |
| composer.json | Adds keywords, updates deps, and canonicalizes public Composer scripts. |
| .gitignore | Aligns ignored artifacts/caches and report directories with canonical layout. |
| .github/workflows/codeql.yml | Canonicalizes YAML formatting and adds concurrency/timeout. |
| .github/workflows/ci.yml | Adds PHP version resolution job and canonical job ordering/concurrency. |
| .github/workflows/auto-assign.yml | Adds concurrency/timeouts and standardizes job naming/permissions. |
| .github/PULL_REQUEST_TEMPLATE.md | Adds canonical PR template. |
| .github/ISSUE_TEMPLATE/feature_request.md | Adds canonical feature request template. |
| .github/ISSUE_TEMPLATE/bug_report.md | Adds canonical bug report template. |
| .github/copilot-instructions.md | Updates Copilot contributor instructions to match .claude/ rule entrypoints. |
| .gitattributes | Refines Packagist export-ignore list (including reports/ and cache dirs). |
| .editorconfig | Sets max_line_length = 120. |
| .claude/rules/php-library-tooling.md | Introduces canonical tooling configuration rules. |
| .claude/rules/php-library-testing.md | Expands canonical testing rules (BDD structure, exceptions, coverage discipline). |
| .claude/rules/php-library-modeling.md | Expands canonical modeling/nomenclature rules. |
| .claude/rules/php-library-github-workflows.md | Introduces canonical GitHub workflow structure rules. |
| .claude/rules/php-library-documentation.md | Introduces canonical documentation rules (README/templates/security). |
| .claude/rules/php-library-commits.md | Adds Conventional Commits guidance (on request). |
| .claude/rules/php-library-code-style.md | Introduces canonical code-style semantics (incl. named-arg restrictions). |
| .claude/rules/php-library-architecture.md | Introduces canonical architecture and public/Internal boundary rules. |
| .claude/rules/github-workflows.md | Removes legacy workflow rules in favor of the canonical file. |
| .claude/CLAUDE.md | Simplifies to a rule index and pointers into .claude/rules/. |
Comments suppressed due to low confidence (4)
tests/Unit/TimezoneTest.php:17
- This test no longer has a
@Givenblock. The testing rules require every test to follow the@Given/@When/@Thenstructure (with@Andas needed). Please reintroduce a@Givensection (with a single setup statement) before the@Whenaction.
tests/Unit/TimezonesTest.php:52 - This test currently starts at
@Whenwithout any@Givensetup block, which violates the required Given/When/Then structure in the test conventions. Add a@Givensection (with a single setup statement) before the action.
This issue also appears in the following locations of the same file:
- line 60
- line 171
tests/Unit/TimezonesTest.php:67
- This exception test has
@Then/@Whenordering correct, but it is missing a@Givenblock describing the input setup. Add a@Given(and@Andif needed) section with setup statements before theexpectException*calls to keep the required BDD structure.
tests/Unit/TimezonesTest.php:175 - This test begins with
@Whenbut has no preceding@Givenblock. The test conventions require the Given/When/Then structure even for the empty-input case; consider setting up an empty list/array as the@Givenstatement and then using it in the@Whencall.
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.