-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Feature Request
Array cast is redundant on array type. (redundant cast emit a phpstan error already)
For scalar type values it wraps the value into an array - inconsistent with casting an array, array is not wrapped again.
For null
it produces empty array - can be a mistake in code, scalar type value is wrapped in an array and never empty.
For objects - get_object_vars
should be used.
Given these reasons, I would expect phpstan to emit an error if an (array)
cast is found.
demo: https://3v4l.org/2INk8
playground: https://phpstan.org/r/e03daaef-49f6-4c30-b029-24bed8f50048 (line 10 should emit an error)
Metadata
Metadata
Assignees
Labels
No labels