PhpParser\ErrorHandler\Collecting::hasErrors PHP Method

hasErrors() public method

Check whether there are any errors.
public hasErrors ( ) : boolean
return boolean
    public function hasErrors()
    {
        return !empty($this->errors);
    }

Usage Example

Example #1
0
 public function testHandleError()
 {
     $errorHandler = new Collecting();
     $this->assertFalse($errorHandler->hasErrors());
     $this->assertEmpty($errorHandler->getErrors());
     $errorHandler->handleError($e1 = new Error('Test 1'));
     $errorHandler->handleError($e2 = new Error('Test 2'));
     $this->assertTrue($errorHandler->hasErrors());
     $this->assertSame([$e1, $e2], $errorHandler->getErrors());
     $errorHandler->clearErrors();
     $this->assertFalse($errorHandler->hasErrors());
     $this->assertEmpty($errorHandler->getErrors());
 }