Completed
Push — master ( 7b9015...c5b311 )
by Vladimir
26s queued 11s
created

bootstrap.php ➔ customErrorHandler()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 4
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
require __DIR__ . "/../vendor/autoload.php";
4
5
// The only deprecation warnings we need to ignore/handle are in PHP 7.4 so far
6
if (PHP_VERSION_ID >= 70400) {
7
    function customErrorHandler($errno, $errstr, $errfile, $errline) {
8
        // We know about this deprecation warning exists and it's already been
9
        // fixed in the 2.x branch. For BC reasons in the 1.x branch, we'll
10
        // ignore this warning to let tests pass.
11
        if ($errno === E_DEPRECATED) {
12
            if ($errstr === "Function ReflectionType::__toString() is deprecated") {
13
                return true;
14
            }
15
        }
16
17
        // Any other error should be left up to PHPUnit to handle
18
        return \PHPUnit_Util_ErrorHandler::handleError($errno, $errstr, $errfile, $errline);
19
    }
20
21
    set_error_handler("customErrorHandler");
22
}
23