PHP: bool vs boolean type hinting


I've been trying to use type hinting more in PHP. Today I was writing a function that takes a boolean with a default parameter and I noticed that a function of the form

function foo(boolean $bar = false) {   var_dump($bar);  }  

actually throws a fatal error:


Default value for parameters with a class type hint can only be NULL


While a function of the similar form

function foo(bool $bar = false) {   var_dump($bar);  }  

does not. However both

var_dump((bool) $bar);  var_dump((boolean) $bar);  

give the exact same output


:boolean false


Why is this? Is this similar to the wrapper classes in Java?



   Aliases for the above scalar types are not supported. Instead