For example, is it possible to write code like this:
int $x = 6;
str $y = \"hello world\";
bool $z = false;
MyObject $foo = new MyObject();
Since the answer is basically "no", an alternative: A PHP "linter", which should catch some of the things a compile-time check would catch in a staticly-typed language like C. Not the same, but should prevent some sillyness
"Is there a static code analyzer [like Lint] for PHP files" lists many of these.