-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Add types to public and protected properties #51069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
77d0ede
to
803a018
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing this PR is exhausting. I've reviewed up to the HttpFoundation component and will take a break now. 😓
55de9b0
to
bd629d9
Compare
bd629d9
to
65437fd
Compare
PR is ready for review. Needs #51121 to be 🍏 |
src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php
Outdated
Show resolved
Hide resolved
protected mixed $trueEquivalent = true; | ||
protected mixed $falseEquivalent = false; | ||
protected string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR; | ||
protected NodeParentInterface|NodeInterface|null $parent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type of end()
is wider. My gut feeling is that they should match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those classes in the return type of end()
implement NodeParentInterface
so we could reduce this to only it. I suppose the list is here to hint the IDE for autocompletion. Maybe we should keep only NodeParentInterface
as native type and use @return
for the rest?
The other strange thing is about the need to add NodeInterface
to make this code work:
symfony/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
Lines 352 to 361 in 1935af6
$node = new ArrayNode($this->name, $this->parent, $this->pathSeparator); | |
$this->validateConcreteNode($node); | |
$node->setAddIfNotSet($this->addDefaults); | |
foreach ($this->children as $child) { | |
$child->parent = $node; | |
$node->addChild($child->getNode()); | |
} |
end()
can't return an ArrayNode
because of its return type. Either the return type is wrong, or what?
Up to investigate and fix this on a lower branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those classes in the return type of
end()
implementNodeParentInterface
so we could reduce this to only it. I suppose the list is here to hint the IDE for autocompletion. Maybe we should keep onlyNodeParentInterface
as native type and use@return
for the rest?
Would work for me to unblock the PR.
Up to investigate and fix this on a lower branch?
Maybe, but not right away. 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use @return for the rest
PR updated
…. (nicolas-grekas) This PR was merged into the 6.4 branch. Discussion ---------- More short closures + isset instead of null checks + etc. | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Some of the isset() checks are needed to make #51069 green on high-deps job. Commits ------- 3df6471 More short closures + isset instead of null checks + etc.
e3eabd6
to
39b070c
Compare
This PR was merged into the 6.4 branch. Discussion ---------- Ensure all properties have a type | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Before #51069 Commits ------- 25a8615 Ensure all properties have a type
2b8819e
to
6c5286f
Compare
6c5286f
to
a500eb6
Compare
a500eb6
to
7ea2461
Compare
🥵
Allowed by #45360
Follows #51068 and #51067