Aziz S. Hussain
|Your idea of giving the option for object properties to declare the type is a great step of having PHP become a better scripting language.|
Most developers, including myself, are already doing so using the property docblock comments, I don't see a reason why allowing such option is in any way a bad idea.
Good article. Just learned about type inference.
|2012-06-15 00:10:09 - In reply to message 1 from Aziz S. Hussain|
|I think the problem is more with the current Zend Engine version that would have to take care of checking value types at run time and so hurt PHP performance.|
Now when you use a JIT compiler, those checks happen at compile time, so no performance problems would seem to occur at run time.
I am just afraid that you would probably need to use a lot of type casting with PHP functions as many of them have return type "mixed", which does not help much type inference.