So let's say that in my controller inside some of my methods I want to return a view like this:
return $this->render('home', [
'model' => $model,
]);
In my doc block, I want to document what this method is returning. I do not know how to document that this method is returning a view. Is that a resource ? Is it mixed ?
Is this valid? :
@return resource
And how do you document that your method is returning redirect to some other page ?
Your docblock is just giving you typehinting in your IDE and making things more readable. You can absolutely do @return resource, if that's what you're returning, but you can also just include more comments too
/**
* This function returns a view which then redirects the user to another page
*
* @param string $model The model we looked at
* @return resource The page to redirect to
*/
function foo($model){
return $this->render('home', [
'model' => $model,
]);
}
If there's a more specific class in your framework for what the actual return from $this->render is, then you should probably include that, but if you're saying $this->render redirects the page, then there's actually no reason to return it inside this function since those calls won't happen, and it can just be a void function (or you can return a boolean in case things fail)