Пример #1
0
 public function testCallsLateLast()
 {
     $calledLate = false;
     $eh = new ErrorHandler();
     $eh->addErrorHandler(E_USER_WARNING, '/test late/', function () use(&$calledLate) {
         $this->assertEquals(false, $calledLate);
     }, ErrorHandler::Normal);
     $eh->addErrorHandler(E_USER_WARNING, '/test late/', function () use(&$calledLate) {
         $this->assertEquals(false, $calledLate);
         $calledLate = true;
         return true;
     }, ErrorHandler::Late);
     $eh->registerSelf();
     trigger_error("test late last", E_USER_WARNING);
     $this->assertEquals(true, $calledLate);
 }
Пример #2
0
 /** Registers this instance with the given ErrorHandler. */
 public function registerWith(ErrorHandler $eh)
 {
     return $eh->addErrorHandler(E_RECOVERABLE_ERROR, '/^Argument (\\d)+ passed to (?:([\\w\\\\]+)::)?(\\w+)\\(\\) must be an instance of ([\\w\\\\]+), ([\\w\\\\]+) given/', [$this, 'handleError']);
 }