Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Add @throws to some doc blocks #50969

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

saMahmoudzadeh
Copy link
Contributor

change 1:

/**
   * Throw an HttpException with the given data.
   *
   * @param  \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Support\Responsable|int  $code
   * @param  string  $message
   * @param  array  $headers
   * @return never
   *
   * @throws \Symfony\Component\HttpKernel\Exception\HttpException
   * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
   * @throws \Illuminate\Http\Exceptions\HttpResponseException
   */
function abort($code, $message = '', array $headers = [])
{
    if ($code instanceof Response) {
        throw new HttpResponseException($code);
    } elseif ($code instanceof Responsable) {
        throw new HttpResponseException($code->toResponse(request()));  // ==> add `@throw` to doc block
    }

    app()->abort($code, $message, $headers);
}

change 2:

/**
  * Create a new file download response.
  *
  * @param  \SplFileInfo|string  $file
  * @param  string|null  $name
  * @param  array  $headers
  * @param  string|null  $disposition
  * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
  */
public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment')
{
  $withWrappedException = function () use ($callback) {
      try {
          $callback();
      } catch (Throwable $e) {
          throw new StreamedResponseException($e);  // ==> add `@throw` to doc block
      }
  };

 ..................

Copy link

github-actions bot commented Apr 8, 2024

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@saMahmoudzadeh saMahmoudzadeh marked this pull request as ready for review April 8, 2024 18:09
@taylorotwell taylorotwell merged commit d2a8471 into laravel:11.x Apr 9, 2024
30 checks passed
@saMahmoudzadeh saMahmoudzadeh deleted the fix/add-throws branch April 9, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants