Just a simple example showing that the return typehint of boolean can’t be null. Either true or false.

<?php
function foo(): bool {
return null;
}
try {
var_dump(foo());
}
catch (Throwable $t) {
// Executed only in PHP 7, catches errors and exceptions
echo "Throwable: {$t->getMessage()}\n";
}
catch (Exception $e) {
// Executed PHP7 and 5.x, catches exceptions
// ::NOTE:: Redundant if your catching throwable in PHP7
echo "Exception: {$e->getMessage()}\n";
}
catch (Error $e){
//Executed only in PHP 7, catches errors
//Type mismatch is a subclass of Error (TypeError)
//http://php.net/manual/en/class.typeerror.php
// ::NOTE:: Redundant if your catching throwable in PHP7
}
//OUTPUT: Throwable: Return value of foo() must be of the type boolean, null returned
//NOTE: If we were to cast null as a boolean i.e. :
//return (bool) null;
//we would get false