I have this constructor that takes an optional argument. The main problem is usability. A developer using my infrastructure will immediately catch a headache because he does not know if he can give an argument, which argument or not at all. Conclusion: it just sucks. But PHPDoc might help a little if someone has a reasonable IDE like Netbeans;)
So:
class ChildClass extends ParentClass {
public function __construct() {
$tplFile = func_get_arg(0);
if (!isset($tpl)) {
$tpl = 'index';
}
parent::__construct($tpl);
}
}
How can I use PHPDoc here to indicate that the optional argument [$ tpl] can be provided?
source
share