1 | <?php |
||
9 | abstract class ErrorHandler |
||
10 | { |
||
11 | /** |
||
12 | * @var int |
||
13 | */ |
||
14 | const E_UNSUPPORTED = 8; |
||
15 | |||
16 | /** |
||
17 | * @var int |
||
18 | */ |
||
19 | const E_ERROR = 4; |
||
20 | |||
21 | /** |
||
22 | * @var int |
||
23 | */ |
||
24 | const E_WARNING = 2; |
||
25 | |||
26 | /** |
||
27 | * @var int |
||
28 | */ |
||
29 | const E_NOTICE = 1; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected static $errHandler = '\Dazzle\Throwable\Error::toString'; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected static $excHandler = '\Dazzle\Throwable\Exception::toString'; |
||
40 | |||
41 | /** |
||
42 | * Invoke default Error Handler. |
||
43 | * |
||
44 | * @param int $code |
||
45 | * @param string $message |
||
46 | * @param string $file |
||
47 | * @param int $line |
||
48 | * @throws FatalError |
||
49 | * @throws NoticeError |
||
50 | * @throws WarningError |
||
51 | */ |
||
52 | 16 | public static function handleError($code, $message, $file, $line) |
|
68 | |||
69 | /** |
||
70 | * Invoke default Shutdown Handler. |
||
71 | * |
||
72 | * @param bool $forceKill |
||
73 | */ |
||
74 | public static function handleShutdown($forceKill = false) |
||
96 | |||
97 | /** |
||
98 | * @param int $type |
||
99 | * @return array |
||
100 | */ |
||
101 | 16 | private static function getSystemError($type) |
|
154 | } |
||
155 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: