Debian Codegraph @

lib/3rdParty/composer/illuminate/support/Facades/Exceptions.php

raw symbols SCIP
1 <?php
2
3 namespace Illuminate\Support\Facades;
4
5 use Illuminate\Contracts\Debug\ExceptionHandler;
6 use Illuminate\Support\Arr;
7 use Illuminate\Support\Testing\Fakes\ExceptionHandlerFake;
8
9 /**
10 * @method static void register()
11 * @method static \Illuminate\Foundation\Exceptions\ReportableHandler reportable(callable $reportUsing)
12 * @method static \Illuminate\Foundation\Exceptions\Handler renderable(callable $renderUsing)
13 * @method static \Illuminate\Foundation\Exceptions\Handler map(\Closure|string $from, \Closure|string|null $to = null)
14 * @method static \Illuminate\Foundation\Exceptions\Handler dontReport(array|string $exceptions)
15 * @method static \Illuminate\Foundation\Exceptions\Handler dontReportWhen(callable $dontReportWhen)
16 * @method static \Illuminate\Foundation\Exceptions\Handler ignore(array|string $exceptions)
17 * @method static \Illuminate\Foundation\Exceptions\Handler dontFlash(array|string $attributes)
18 * @method static \Illuminate\Foundation\Exceptions\Handler level(string $type, string $level)
19 * @method static void report(\Throwable $e)
20 * @method static bool shouldReport(\Throwable $e)
21 * @method static \Illuminate\Foundation\Exceptions\Handler throttleUsing(callable $throttleUsing)
22 * @method static \Illuminate\Foundation\Exceptions\Handler stopIgnoring(array|string $exceptions)
23 * @method static \Illuminate\Foundation\Exceptions\Handler buildContextUsing(\Closure $contextCallback)
24 * @method static \Symfony\Component\HttpFoundation\Response render(\Illuminate\Http\Request $request, \Throwable $e)
25 * @method static \Illuminate\Foundation\Exceptions\Handler respondUsing(callable $callback)
26 * @method static \Illuminate\Foundation\Exceptions\Handler shouldRenderJsonWhen(callable $callback)
27 * @method static \Illuminate\Foundation\Exceptions\Handler dontReportDuplicates()
28 * @method static \Illuminate\Contracts\Debug\ExceptionHandler handler()
29 * @method static void assertReported(\Closure|string $exception)
30 * @method static void assertReportedCount(int $count)
31 * @method static void assertNotReported(\Closure|string $exception)
32 * @method static void assertNothingReported()
33 * @method static void renderForConsole(\Symfony\Component\Console\Output\OutputInterface $output, \Throwable $e)
34 * @method static \Illuminate\Support\Testing\Fakes\ExceptionHandlerFake throwOnReport()
35 * @method static \Illuminate\Support\Testing\Fakes\ExceptionHandlerFake throwFirstReported()
36 * @method static array reported()
37 * @method static \Illuminate\Support\Testing\Fakes\ExceptionHandlerFake setHandler(\Illuminate\Contracts\Debug\ExceptionHandler $handler)
38 *
39 * @see \Illuminate\Foundation\Exceptions\Handler
40 * @see \Illuminate\Support\Testing\Fakes\ExceptionHandlerFake
41 */
42 class Exceptions extends Facade
43 {
44 /**
45 * Replace the bound instance with a fake.
46 *
47 * @param array<int, class-string<\Throwable>>|class-string<\Throwable> $exceptions
48 * @return \Illuminate\Support\Testing\Fakes\ExceptionHandlerFake
49 */
50 public static function fake(array|string $exceptions = [])
51 {
52 $exceptionHandler = static::isFake()
53 ? static::getFacadeRoot()->handler()
54 : static::getFacadeRoot();
55
56 return tap(new ExceptionHandlerFake($exceptionHandler, Arr::wrap($exceptions)), function ($fake) {
57 static::swap($fake);
58 });
59 }
60
61 /**
62 * Get the registered name of the component.
63 *
64 * @return string
65 */
66 protected static function getFacadeAccessor()
67 {
68 return ExceptionHandler::class;
69 }
70 }