DEV Community

[Comment from a deleted post]
 
tarialfaro profile image
Tari R. Alfaro

Of course, we don't need to use it in PHP. I get that Java needs interfaces to increase the flexibility. However you can achieve the stricter and more flexibile approach in PHP even if it's not required.

function showPerson ( PersonInterface $person ) : void { }

Or go about it dynamically ...

function showPerson ( $person ) { }

I certainly wouldn't call PHP "weak". It does allowed for strict type hinting. However it's not required.