In this example:
/**
*
* @param <type> $foo
* @return <type>
*/
function do_something($foo) {
return $foo->really_do_something();
}
How to indicate that $foo must be of the class Foo?
In this example:
/**
*
* @param <type> $foo
* @return <type>
*/
function do_something($foo) {
return $foo->really_do_something();
}
How to indicate that $foo must be of the class Foo?
/**
*
* @param Foo $foo
* @return <type>
*/
function do_something(Foo $foo) {
return $foo->really_do_something();
}
More recent versions of PHP (PHP 5 onwards I think) have parameter types:
function do_something(Foo $foo) {
return $foo->really_do_something();
}
Which will throw an exception if $foo is not a type of Foo.
I assume phpDoc picks this up