“One of the nicest features that PHP affords is type hinting specifically for those who are coming from an object-oriented programming background.
From the PHP manual:
Type declarations allow functions to require that parameters are of a certain type at call time. If the given value is of the incorrect type, then an error is generated: in PHP 5, this will be a recoverable fatal error, while PHP 7 will throw a TypeError exception.
The reason this is important is because it gives people who are going to use your code – specifcally those who will write code against your code – what types of parameters a given constructor or function will accept.
But there’s more to it than that because type hints are also applicable to the type of data a function can return.