declare(strict_types=1);
class User {}
function process(User $u): void {
echo "process() - Processing user";
}
process(new User()); // OK
process("User"); // TypeError
/*
run:
ERROR!
process() - Processing user
Fatal error: Uncaught TypeError: process(): Argument #1 ($u) must be of type User, string given
*/