-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
General type inference improvements #246
Conversation
The main goal here was to get inference when iterating over a form or fieldset, both for psalm and in yer IDE - this led to fixing a few more psalm issues here and there. There are a couple of additions to the baseline occurring due to improved inference, but it would have been unwise to fix these. Signed-off-by: George Steel <[email protected]>
if ( | ||
empty($messageSet) | ||
|| (! is_array($messageSet) && ! $messageSet instanceof Traversable) | ||
) { | ||
if ($messageSet === []) { |
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.
ElementInterface::getMessages()
has a native array
return type
@@ -203,13 +207,14 @@ public function has(string $elementOrFieldset): bool | |||
*/ | |||
public function get(string $elementOrFieldset): ElementInterface | |||
{ | |||
if (! $this->has($elementOrFieldset)) { | |||
$element = $this->iterator->get($elementOrFieldset); |
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.
Is this behaviour change safe to perform? 🤔
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.
Yes it is:
Lines 194 to 197 in b83d29b
public function has(string $elementOrFieldset): bool | |
{ | |
return $this->iterator->get($elementOrFieldset) !== null; | |
} |
@@ -203,13 +207,14 @@ public function has(string $elementOrFieldset): bool | |||
*/ | |||
public function get(string $elementOrFieldset): ElementInterface | |||
{ | |||
if (! $this->has($elementOrFieldset)) { | |||
$element = $this->iterator->get($elementOrFieldset); |
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.
Yes it is:
Lines 194 to 197 in b83d29b
public function has(string $elementOrFieldset): bool | |
{ | |
return $this->iterator->get($elementOrFieldset) !== null; | |
} |
The main goal here was to get inference when iterating over a form or fieldset, both for psalm and in yer IDE - this led to fixing a few more psalm issues here and there.
There are a couple of additions to the baseline occurring due to improved inference, but it would have been unwise to fix these.