samb0057
November 15th, 2007, 07:01 PM
I have written a patch for PHP that allows type hinting for basic variable types (int, float, string, etc.)
It supports:
integers
floats (decimals)
strings
booleans (true/false)
resources (mysql queries, etc)
objects (matches any object)
numbers (matches integers/floats)
This way you can have a function with specific input arguments:
function myFunc(integer $a, number $b, object $c)
I tried to submit it to the PHP internals mailing list but they say that they do not want to implement. I think we should appeal to them to apply the patch. All type hinting is 100% optional and backwards compatible.
If anyone is interested in the patch send me a pm.
It supports:
integers
floats (decimals)
strings
booleans (true/false)
resources (mysql queries, etc)
objects (matches any object)
numbers (matches integers/floats)
This way you can have a function with specific input arguments:
function myFunc(integer $a, number $b, object $c)
I tried to submit it to the PHP internals mailing list but they say that they do not want to implement. I think we should appeal to them to apply the patch. All type hinting is 100% optional and backwards compatible.
If anyone is interested in the patch send me a pm.