Conversation
68eaf8f to
04071c9
Compare
As property creation is getting more complex, move all complexity into a sepatate builder class that handles everything.
04071c9 to
283247b
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR centralizes property creation by introducing a dedicated PropertyBuilder that consolidates property instantiation and related logic. Key changes include:
- Updating constructor promotion and its corresponding tests to work with the new builder pattern.
- Replacing direct property instantiation with the PropertyBuilder in both regular and constructor-promotion contexts.
- Adjusting method calls (e.g., changing isProtected to isProtectedSet) and PHPUnit testing parameters as well as updating PHP CLI versions in the Makefile.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/data/PHP8/ConstructorPromotion.php | Updates property promotion parameters and default values |
| tests/integration/PHP8/ConstructorPromotionTest.php | Updates expected arguments and locations in test cases |
| src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php | Updates method calls for async visibility checks |
| src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php | Introduces a new builder class for property creation |
| src/phpDocumentor/Reflection/Php/Factory/Property.php | Refactors property creation to use the builder |
| src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php | Refactors constructor promotion to use the builder |
| Makefile | Upgrades PHP CLI versions for static analysis and updates test targets |
Comments suppressed due to low confidence (2)
tests/integration/PHP8/ConstructorPromotionTest.php:90
- [nitpick] The expected Location values have been updated. Please ensure that these new positions are consistently maintained in future changes to the code location extraction logic.
new Location(27, 517)
src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php:122
- Replacing isProtected() with isProtectedSet() ensures the async property checks are accurate. Double-check that similar method changes (like for private) are consistently applied throughout the codebase.
return $this->property->isPublicSet() || $this->property->isProtectedSet() || $this->property->isPrivateSet();
Comment on lines
+24
to
27
| public string $name = 'default name', | ||
| protected Email $email, | ||
| private DateTimeImmutable $birth_date, | ||
| ) {} |
There was a problem hiding this comment.
[nitpick] The default value for the name property is now hardcoded. Verify that this change aligns with the new property creation strategy and is intentional across all usages.
Suggested change
| public string $name = 'default name', | |
| protected Email $email, | |
| private DateTimeImmutable $birth_date, | |
| ) {} | |
| public string $name = self::DEFAULT_NAME, | |
| protected Email $email, | |
| private DateTimeImmutable $birth_date, | |
| ) {} | |
| private const DEFAULT_NAME = 'default name'; |
d3a3fc3 to
d1849f6
Compare
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.
As property creation is getting more complex, move all complexity into a sepatate builder class that handles everything.