ErrorReporting/src/Bootstrap.php
public static function shutdownHandler()
    {
        if ($err = error_get_last()) {
            switch ($err['type']) {
                case E_ERROR:
                case E_PARSE:
                case E_COMPILE_ERROR:
                case E_CORE_ERROR:
                    $service = self::$psrLogger
                        ->getMetadataProvider()
                        ->serviceId();
                    $version = self::$psrLogger
                        ->getMetadataProvider()
                        ->versionId();
                    $message = sprintf(
                        '%s: %s in %s on line %d',
                        self::getErrorPrefix($err['type']),
                        $err['message'],
                        $err['file'],
                        $err['line']
                    );
                    $context = [
                        'context' => [
                            'reportLocation' => [
                                'filePath' => $err['file'],
                                'lineNumber' => $err['line'],
                                'functionName' =>
                                    self::getFunctionNameForReport(),
                            ]
                        ],
                        'serviceContext' => [
                            'service' => $service,
                            'version' => $version
                        ]
                    ];
                    if (self::$psrLogger) {
                        self::$psrLogger->log(
                            self::getErrorLevelString($err['type']),
                            $message,
                            $context
                        );
                    }
                    break;
            }
        }
    }
public static function shutdownHandler()
    {
        if ($err = error_get_last()) {
            switch ($err['type']) {
                case E_ERROR:
                case E_PARSE:
                case E_COMPILE_ERROR:
                case E_CORE_ERROR:
                    $service = self::$psrLogger
                        ->getMetadataProvider()
                        ->serviceId();
                    $version = self::$psrLogger
                        ->getMetadataProvider()
                        ->versionId();
                    $message = sprintf(
                        '%s: %s in %s on line %d',
                        self::getErrorPrefix($err['type']),
                        $err['message'],
                        $err['file'],
                        $err['line']
                    );
                    $context = [
                        'context' => [
                            'reportLocation' => [
                                'filePath' => $err['file'],
                                'lineNumber' => $err['line'],
                                'functionName' =>
                                    self::getFunctionNameForReport(),
                            ]
                        ],
                        'serviceContext' => [
                            'service' => $service,
                            'version' => $version
                        ]
                    ];
                    if (self::$psrLogger) {
                        self::$psrLogger->log(
                            self::getErrorLevelString($err['type']),
                            $message,
                            $context
                        );
                    }
                    break;
            }
        }
    }
public static function shutdownHandler ( ) { if ( $ err = error_get_last ( ) ) { switch ( $ err [ 'type' ] ) { case E_ERROR : case E_PARSE : case E_COMPILE_ERROR : case E_CORE_ERROR : $ service = self :: $ psrLogger -> getMetadataProvider ( ) -> serviceId ( ) ; $ version = self :: $ psrLogger -> getMetadataProvider ( ) -> versionId ( ) ; $ message = sprintf ( '%s: %s in %s on line %d' , self :: getErrorPrefix ( $ err [ 'type' ] ) , $ err [ 'message' ] , $ err [ 'file' ] , $ err [ 'line' ] ) ; $ context = [ 'context' => [ 'reportLocation' => [ 'filePath' => $ err [ 'file' ] , 'lineNumber' => $ err [ 'line' ] , 'functionName' => self :: getFunctionNameForReport ( ) , ] ] , 'serviceContext' => [ 'service' => $ service , 'version' => $ version ] ] ; if ( self :: $ psrLogger ) { self :: $ psrLogger -> log ( self :: getErrorLevelString ( $ err [ 'type' ] ) , $ message , $ context ) ; } break ; } } }
Called at exit, to check there's a fatal error and report the error if
any.
Called at exit to check there s a fatal error and report the error if any .