From bb7b1f3321adb5a02e621328965312ff7e35d711 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Tue, 16 Sep 2014 13:27:12 +0200 Subject: [PATCH] Turned errors into exceptions --- src/AutoLoader.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/AutoLoader.php b/src/AutoLoader.php index 2a6890b9..cbdaa98f 100644 --- a/src/AutoLoader.php +++ b/src/AutoLoader.php @@ -26,3 +26,14 @@ final class AutoLoader AutoLoader::init(); require_once(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'); + +function turnErrorsIntoExceptions() +{ + set_error_handler( + function($errno, $errstr, $errfile, $errline, array $errcontext) + { + throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); + }); +} + +turnErrorsIntoExceptions();