If one is type hinting for a specific class type but wishes for there to be a default option of no object at all (e.g., to work on the object if it exists, or do something else (e.g., print out data) if it doesn't exist), this can be done by (and only by) NULL:
<?php
function printBreadcrumbs(Smarty &$smarty = NULL) {
$breadcrumbs = <add code here to make or obtain breadcrumbs>;
if ($smarty != NULL) {
$smarty->assign('breadcrumbs', $breadcrumbs);
}
else {
print $breadcrumbs;
}
}
?>
If one tries to change NULL to '' or the like, one will get this error message:
Default value for parameters with a class type hint can only be NULL