Align project with tiny-blocks conventions and promote InvalidCast.#28
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns the project with the codified tiny-blocks conventions and promotes InvalidCast from Internal/Exceptions/ to the public Exceptions/ namespace. It also consolidates ObjectBuilder, removes the dedicated extractConstructorParameters helper, refreshes documentation/CI/tooling files, and reorganizes tests under a Unit namespace with refined BDD annotations.
Changes:
- Promote
InvalidCastto the publicTinyBlocks\Mapper\Exceptionsnamespace and update all references. - Inline and simplify
ObjectBuilder::build(constructor handling, private-constructor instantiation) and dropReflectionExtractor::extractConstructorParameters. - Refresh
.claude/rules/*,composer.jsonscripts,phpunit.xml,phpstan.neon.dist,Makefile, README, and add SECURITY/issue/PR templates plus new tests for missing-key fallback and enum pass-through.
Reviewed changes
Copilot reviewed 49 out of 50 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Exceptions/InvalidCast.php | New public exception with docblocks. |
| src/Internal/Exceptions/InvalidCast.php | Old internal exception removed. |
| src/Internal/Builders/ObjectBuilder.php | Inlined arg building and instantiation; no longer depends on ReflectionExtractor. |
| src/Internal/Extractors/ReflectionExtractor.php | Dropped extractConstructorParameters, added named args to getProperties. |
| src/Internal/Mappers/Object/Casters/*.php | Updated InvalidCast import and removed named args on native funcs. |
| src/Internal/Detectors/ValueObjectDetector.php | Added named args to reflection calls. |
| src/Internal/Extractors/ValuePropertyExtractor.php | Added named args to reflection calls. |
| src/Internal/Resolvers/RecursiveValueResolver.php | Renamed lambda variable $item → $element. |
| src/Internal/Resolvers/StrategyResolverContainer.php | Reordered get/set methods. |
| src/Internal/Strategies/IterableMappingStrategy.php | Renamed lambda variable $item → $element. |
| src/Internal/Transformers/Transformer.php | Expanded docblock to justify transform verb. |
| src/ObjectMappability.php | Constructs ObjectBuilder directly via PHP 8.4 chaining. |
| src/ObjectMapper.php, src/IterableMapper.php, src/KeyPreservation.php | Updated imports/docs. |
| tests/Unit/*.php | Moved into Test\TinyBlocks\Mapper\Unit namespace; tests refactored with BDD annotations; new tests added. |
| composer.json | Added keywords, restructured scripts (configure, configure-and-update, review, tests). |
| phpunit.xml, phpstan.neon.dist, phpcs.xml, infection.json.dist | Tooling reshaped per canonical templates, reports moved to reports/. |
| Makefile, .gitignore, .gitattributes, .editorconfig | Tooling/structure updates aligned with conventions. |
| README.md, SECURITY.md, .github/PULL_REQUEST_TEMPLATE.md, .github/ISSUE_TEMPLATE/*.md, .github/copilot-instructions.md | Documentation refresh and new templates. |
| .github/workflows/*.yml | Added concurrency/timeouts/PHP-version resolution; pin auto-assign to major tag. |
| .claude/CLAUDE.md, .claude/rules/*.md | Restructured into per-topic rule files; removed obsolete github-workflows.md. |
Comments suppressed due to low confidence (2)
tests/Unit/EnumMappingTest.php:109
- The
@Givenblock has no expression below it. Per.claude/rules/php-library-testing.mdrule 3, each@Given/@Andblock must contain one annotation followed by one expression or assignment (the data-provider exception does not apply here). Move the inline iterable into a$data(or similar) assignment under the@Given, then pass it toAmount::fromIterablein the@Whenstep. The previous version of this test followed that shape.
tests/Unit/ObjectMappingTest.php:353 - The
@Givenannotation has no expression below it; the@Whenblock is immediately concatenated. Per.claude/rules/php-library-testing.mdrule 3, each@Given/@Andblock must contain one expression or assignment (data-provider exception does not apply). Consider declaring the iterable under the@Givenand the hydration call under the@When.
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.