Even though I sometime use type declarations, I try to prevent myself to start using them in every single scenario. An Example of where I mostly reach for type declarations is this:
public function addEvent(array $data) : Event
I think in cases like the top one it helps for readability.
I feel sometimes that when I reach for so much type hints and return types, I'm making PHP something more Like Java (And I really don't enjoy Java).
It's just my way of thinking. Totally respect your point of view also. 😊
I think this often depends on your code background. I got into PHP after I'd written more strongly typed languages like c#. So I've always felt comfortable around type hints, etc.
Absolutely agree with you.
then how can you tell what to pass to functions?
lol, your talking like the developer is a kid. I’m expected to have a certain domain over the codebase. 😁
Until you don't.
This is debatable.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.