If I have a function that expects first argument to be of type (class
foo) and second argument to be of type class foobar,how do I check/
ensure that I have been passed the right parameter types?
In C++, it would be done something luike this:
void Func(const foo& foo_objectRef, const foobar& foobar_objectRe f)
How can I enforce the requirement that only these data types can be
passed to the function Func above?
Since PHP is loosely typed, I suspect that there is no way of enforcing
this kind of type integrity, - so in case I can't enforce this - how can
I atleast check that I have not been passed a string (for example), when
I am expecting an object of type foo or foobar?
foo) and second argument to be of type class foobar,how do I check/
ensure that I have been passed the right parameter types?
In C++, it would be done something luike this:
void Func(const foo& foo_objectRef, const foobar& foobar_objectRe f)
How can I enforce the requirement that only these data types can be
passed to the function Func above?
Since PHP is loosely typed, I suspect that there is no way of enforcing
this kind of type integrity, - so in case I can't enforce this - how can
I atleast check that I have not been passed a string (for example), when
I am expecting an object of type foo or foobar?
Comment