A certain method or function has a variable number of arguments. What is a good practice to code this so code hinting will be clear for everyone?
example:
setVars($fixedVar, $optionalVar1 = null, $optionalVar2 = null)
This will make it clear, I think, how I'm expecting the arguments are given.
variable number of method arguments: indication practice
Moderator: General Moderators
Re: variable number of method arguments: indication practice
I generally just put a comment above the function saying "here's what you can do with this: [explain]".