Open
Description
In Wiki: Responding With An Error it states:
return $this->response->errorUnauthorized();
However, all the method does is throws an error. The method itself has no return statement. Isn't the return
redundant?
Consider the following controller method as example. If a return is added to the errorResponse, it does nothing except adds a warning to the IDE because there's a conflict between return void
and the declared return type. (Adding |void
to @return
causes a warning too.)
/**
* Display the specified resource.
*
* @param \App\Letter $letter
* @return \Dingo\Api\Http\Response
*/
public function show(Letter $letter)
{
/** @var User $user */
$user = $this->auth->user();
if( $user->cannot('view', $letter) ) {
$this->response->errorUnauthorized();
}
return $this->response->item($letter, new LetterTransformer);
}
Metadata
Metadata
Assignees
Labels
No labels