I know when using declare(strict_types=1) I must pass parameters of given type otherwise an Exception is raised, but one question:
declare(strict_types=1);
function add(int $firstNumber, int $secondNumber)
{
$firstNumber = "example";
return $firstNumber . " " . $secondNumber;
}
My question is why I'm allowed to change the $firstNumber's type to string if int was declared?
For instance, in Java, I can't do casting that way. Parameter type int must remain int otherwise code won't even compile.