You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an array_filter that is passed to an array_map, the array_filter is filtering out anything that isn't a specific type, and the array_map function only accepts that specific type that should be returned by the filter.
I recently added an if inside the filter function to check for a particular property/state, but adding the if block seems to widen the types. Not sure if this is a bug, or maybe I can do something else to tell PHPStan the filtered list is only of a given type? 🤔
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Example: https://phpstan.org/r/7e500925-e6d3-49a3-9145-238f4e369964
I have an
array_filterthat is passed to anarray_map, thearray_filteris filtering out anything that isn't a specific type, and thearray_mapfunction only accepts that specific type that should be returned by the filter.I recently added an
ifinside the filter function to check for a particular property/state, but adding theifblock seems to widen the types. Not sure if this is a bug, or maybe I can do something else to tell PHPStan the filtered list is only of a given type? 🤔Beta Was this translation helpful? Give feedback.
All reactions