Im a bit stumped with a scalar Type Hint issue (which PHP7 should be able to handle). Basically, Im creating a method with the bool type hint to only allow booleans to be passed. However it fails and lets other types like strings passed. I believe in the past this worked for me. Take a look at the snippet as an example. The first dump results in false (which makes sense since 'test' is a string), the second dump results in true which does not make sense to me. I was hoping for a PHP error to trigger since the type is not a boolean. Any thoughts?
<?php
class Test{
function something(bool $test){
var_dump($test); // "Second dump"
}
}
$value = 'test';
var_dump(is_bool($value)); // "First dump"
$test = new Test;
$test->something($value);
Results:
bool(false)
bool(true)