• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aphiria / exceptions / 12614599792

04 Jan 2025 11:29PM UTC coverage: 100.0%. Remained the same
12614599792

push

github

web-flow
Updated to use PER CS 2.0 (#327)

* Updated chained methods to be on separate lines

* Updated short closure CS

* Removed empty class/interface/method bodies

* Updated CHANGELOG

34 of 34 relevant lines covered (100.0%)

2.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/FatalThrowableError.php
1
<?php
2

3
/**
4
 * Aphiria
5
 *
6
 * @link      https://www.aphiria.com
7
 * @copyright Copyright (C) 2025 David Young
8
 * @license   https://github.com/aphiria/aphiria/blob/1.x/LICENSE.md
9
 */
10

11
declare(strict_types=1);
12

13
namespace Aphiria\Exceptions;
14

15
use ErrorException;
16
use ParseError;
17
use Throwable;
18
use TypeError;
19

20
/**
21
 * Defines a wrapper for fatal throwable errors
22
 */
23
class FatalThrowableError extends ErrorException
24
{
25
    /**
26
     * @param Throwable $error The throwable that caused the error
27
     */
28
    public function __construct(Throwable $error)
29
    {
30
        if ($error instanceof TypeError) {
3✔
31
            $message = "Type error: {$error->getMessage()}";
1✔
32
            $severity = E_RECOVERABLE_ERROR;
1✔
33
        } elseif ($error instanceof ParseError) {
2✔
34
            $message = "Parse error: {$error->getMessage()}";
1✔
35
            $severity = E_PARSE;
1✔
36
        } else {
37
            $message = "Fatal error: {$error->getMessage()}";
1✔
38
            $severity = E_ERROR;
1✔
39
        }
40

41
        /** @psalm-suppress PossiblyInvalidArgument getCode() will always return an int - bug */
42
        parent::__construct($message, $error->getCode(), $severity, $error->getFile(), $error->getLine());
3✔
43
    }
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc