Skip to main content
1 of 2
marco-fiset
  • 8.8k
  • 9
  • 38
  • 46

In my opinion, dynamic typing is one of the features of PHP that makes it highly enjoyable to work with. Instead of enforcing strict typing rules, you can just document your function really well to indicate the parameters you expect. If the contract is not met, then results may vary and the fault is on the user of your function.

I see you are trying to write Java code in PHP and that means that you still don't understand PHP well. When writing code in a given language, you should try to embrace the language features/philosophy instead of looking back to what you already know and trying to adapt.

marco-fiset
  • 8.8k
  • 9
  • 38
  • 46