-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add mixed
parameter and return types to FilterInterface
#111
Conversation
mixed
parameter and return types to FilterInterface
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.
Some changes look like scope creep in here :D
psalm-baseline.xml
Outdated
<InvalidArgument> | ||
<code>array_values($processedParts)</code> | ||
</InvalidArgument> |
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.
Anything worth investigating here?
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.
Nah. This is psalm better understanding how little it understands this existing code. My current plan is to get native types everywhere and whittle down the baseline as much as poss for v3, so it's something I should get to later on.
@@ -85,7 +85,7 @@ public function getList() | |||
* | |||
* Will return $value if its present in the white-list. If $value is rejected then it will return null. | |||
*/ | |||
public function filter($value) | |||
public function filter(mixed $value): mixed |
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.
Could be refined to return one of the values of the specified list, or null
@@ -206,9 +206,8 @@ public function getTranslations() | |||
* Returns a boolean representation of $value | |||
* | |||
* @param null|array|bool|float|int|string $value |
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.
Lies :D
*/ | ||
public function filter($value) | ||
public function filter(mixed $value): mixed | ||
{ | ||
if (! is_string($value) && $value !== null) { |
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.
wait, we decompress null
? 🤔
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.
I'll have to look closer at this later on, but I think that some of the adapters only work on files passed as options (Those adapters might be dead now), therefore there's no argument to filter()
, or something like that…
Not sure I understand this… This patch is just meant to nail down the contract of |
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.
@gsteel my bad: I think I initially reviewed this patch with the mindset that it was for a stable branch, but I think all is good here.
Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
…lock descriptions Signed-off-by: George Steel <[email protected]>
Signed-off-by: George Steel <[email protected]>
1f56f4e
to
58aae6c
Compare
Description
Adds parameter and return type of
mixed
toFilterInterface::filter()
and all implementations.Some additional property/parameter/return types have been added but avoided where possible.
The plan here is to add types everywhere in another patch later on.