Type hints

Type hints have been available in PHP for while now. Unfortunately they were restricted to classes, arrays and callables.

As of PHP 7, the scalar types (integers, floating point numbers, booleans and strings) can also be used as type hints.

it allows developers to ensure a better input consistency of a function/method interface. By default “coercive mode” is enabled. This restricts PHP from throwing a type error when the types don’t exactly match, but when a conversion is still possible.

If you enable “strict mode” , a type error is thrown when the signatures don’t match.