You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
}
The text was updated successfully, but these errors were encountered:
In Wiki: Responding With An Error it states:
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.)The text was updated successfully, but these errors were encountered: