Skip to content

Adopt canonical rule set and promote public exceptions.#9

Merged
gustavofreze merged 2 commits into
mainfrom
feature/develop
May 18, 2026
Merged

Adopt canonical rule set and promote public exceptions.#9
gustavofreze merged 2 commits into
mainfrom
feature/develop

Conversation

@gustavofreze
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 18, 2026 16:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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\Exceptions to TinyBlocks\Time\Exceptions and update imports/usages across src/ and tests/.
  • 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 @Given block. The testing rules require every test to follow the @Given/@When/@Then structure (with @And as needed). Please reintroduce a @Given section (with a single setup statement) before the @When action.
    tests/Unit/TimezonesTest.php:52
  • This test currently starts at @When without any @Given setup block, which violates the required Given/When/Then structure in the test conventions. Add a @Given section (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/@When ordering correct, but it is missing a @Given block describing the input setup. Add a @Given (and @And if needed) section with setup statements before the expectException* calls to keep the required BDD structure.
    tests/Unit/TimezonesTest.php:175
  • This test begins with @When but has no preceding @Given block. The test conventions require the Given/When/Then structure even for the empty-input case; consider setting up an empty list/array as the @Given statement and then using it in the @When call.

Comment thread src/DayOfWeek.php
Comment thread composer.json
@gustavofreze gustavofreze merged commit a7b871f into main May 18, 2026
11 checks passed
@gustavofreze gustavofreze deleted the feature/develop branch May 18, 2026 17:07
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.

2 participants