Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Functions | Variables
bootstrap.php File Reference

Go to the source code of this file.

Functions

 setCustomErrorHandler ()
 

Variables

 if (!defined( 'TESTS_TEMP_DIR'))
 

Function Documentation

◆ setCustomErrorHandler()

setCustomErrorHandler ( )

Set custom error handler

Definition at line 29 of file bootstrap.php.

30 {
31  set_error_handler(
32  function ($errNo, $errStr, $errFile, $errLine) {
33  if (error_reporting()) {
34  $errorNames = [
35  E_ERROR => 'Error',
36  E_WARNING => 'Warning',
37  E_PARSE => 'Parse',
38  E_NOTICE => 'Notice',
39  E_CORE_ERROR => 'Core Error',
40  E_CORE_WARNING => 'Core Warning',
41  E_COMPILE_ERROR => 'Compile Error',
42  E_COMPILE_WARNING => 'Compile Warning',
43  E_USER_ERROR => 'User Error',
44  E_USER_WARNING => 'User Warning',
45  E_USER_NOTICE => 'User Notice',
46  E_STRICT => 'Strict',
47  E_RECOVERABLE_ERROR => 'Recoverable Error',
48  E_DEPRECATED => 'Deprecated',
49  E_USER_DEPRECATED => 'User Deprecated',
50  ];
51 
52  $errName = isset($errorNames[$errNo]) ? $errorNames[$errNo] : "";
53 
54  throw new \PHPUnit\Framework\Exception(
55  sprintf("%s: %s in %s:%s.", $errName, $errStr, $errFile, $errLine),
56  $errNo
57  );
58  }
59  }
60  );
61 }

Variable Documentation

◆ if

if(!defined('TESTS_TEMP_DIR'))

Copyright © Magento, Inc. All rights reserved. See COPYING.txt for license details.

Definition at line 9 of file bootstrap.php.