How to add type for a argument that has an array as a default value? #8424
-
QuestionHow do I get rector to generate array argument parameters for array's that are default values example: public function example($array = [])
{
return $array;
} public function example(array $array = []) : array
{
return $array;
} |
Beta Was this translation helpful? Give feedback.
Answered by
samsonasik
Jan 23, 2024
Replies: 2 comments
-
You can use https://getrector.com/demo/33ae3161-c578-4b54-b601-fe32f304ba48 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
samsonasik
-
oh wow lol okay I think I have a bit of source reading to understand what's happening Thanks |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use
ArgumentAdderRector
, and enableTYPE_DECLARATION
set:, seehttps://getrector.com/demo/33ae3161-c578-4b54-b601-fe32f304ba48