index.php
Codice PHP:
<?php
/**
* Set exception handler
*/
set_exception_handler(array('system\bootstrap\Blind', 'exceptionHandler'));
/**
* Set php error handler
*/
set_error_handler(array('system\bootstrap\Blind', 'errorHandler'), E_ALL);
// [...]
public static final function exceptionHandler(\Exception $e) {
// var_dump($e);
if ($e instanceof IException) {
$e->show();
}
}
public static final function errorHandler($errorNo, $message, $filename, $lineNo) {
throw new BlindException($errorNo, $message, $filename, $lineNo);
}
includes/Error/BaseErrorHandler.php
Codice PHP:
<?php
namespace Error;
class BaseErrorHandler extends \Exception {
// [...]
}
includes/Error/BlindException.php
Codice PHP:
<?php
namespace Error;
class BlindException extends BaseErrorHandler implements IException {
public function show() {
die("show");
}
}
includes/Error/IException.php
Codice PHP:
<?php
namespace error;
interface IException {
public function show();
}
Perchè l'if ($e instanceof IException) non viene eseguito?