Hey,
I've just noticed a somewhat annoying feature with PHP5 type hinting.
You cannot hint types on optional arguments like this:
class MyClass
{
function someFunc(Type1 $arg1, Type2 $arg2 = new Type2()) { }
//or
function someFunc(Type1 $arg1, Type2 $arg2 = null) { }
//or
function someFunc(Type1 $arg1, Type2 $arg2 = Type2::getInsta nce()) { }
}
In fact, there doesn't seem to be any way to do this. I guess you could do
something with global variables, but no thanks....
Any ideas??
Rob Long.
I've just noticed a somewhat annoying feature with PHP5 type hinting.
You cannot hint types on optional arguments like this:
class MyClass
{
function someFunc(Type1 $arg1, Type2 $arg2 = new Type2()) { }
//or
function someFunc(Type1 $arg1, Type2 $arg2 = null) { }
//or
function someFunc(Type1 $arg1, Type2 $arg2 = Type2::getInsta nce()) { }
}
In fact, there doesn't seem to be any way to do this. I guess you could do
something with global variables, but no thanks....
Any ideas??
Rob Long.
Comment