summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold Daniels <arnold@jasny.net>2016-10-27 23:54:49 +0200
committerArnold Daniels <arnold@jasny.net>2016-10-27 23:54:49 +0200
commit414bce100e6fcc913bdb79fb21c553ebdea3a51e (patch)
tree08a7807bc4a679fa32291d09567cf6581388a770
parent87c2179cbe19d7f365fe031225f3e5240059925e (diff)
downloaderror-handler-414bce100e6fcc913bdb79fb21c553ebdea3a51e.zip
error-handler-414bce100e6fcc913bdb79fb21c553ebdea3a51e.tar.gz
error-handler-414bce100e6fcc913bdb79fb21c553ebdea3a51e.tar.bz2
Renamed `errorHandler()` to `handleError()`
If the method is named the same as the class, php (still) sees it as a constructor
-rw-r--r--src/ErrorHandler.php4
-rw-r--r--tests/ErrorHandlerTest.php14
2 files changed, 9 insertions, 9 deletions
diff --git a/src/ErrorHandler.php b/src/ErrorHandler.php
index 8d38010..1f24c53 100644
--- a/src/ErrorHandler.php
+++ b/src/ErrorHandler.php
@@ -252,7 +252,7 @@ class ErrorHandler implements LoggerAwareInterface
protected function initErrorHandler()
{
if (!isset($this->chainedErrorHandler)) {
- $this->chainedErrorHandler = $this->setErrorHandler([$this, 'errorHandler']) ?: false;
+ $this->chainedErrorHandler = $this->setErrorHandler([$this, 'handleError']) ?: false;
}
}
@@ -266,7 +266,7 @@ class ErrorHandler implements LoggerAwareInterface
* @param int $line
* @param array $context
*/
- public function errorHandler($type, $message, $file, $line, $context)
+ public function handleError($type, $message, $file, $line, $context)
{
if ($this->errorReporting() & $type) {
$error = new \ErrorException($message, 0, $type, $file, $line);
diff --git a/tests/ErrorHandlerTest.php b/tests/ErrorHandlerTest.php
index b693690..e8f3523 100644
--- a/tests/ErrorHandlerTest.php
+++ b/tests/ErrorHandlerTest.php
@@ -261,7 +261,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
$errorHandler = $this->errorHandler;
$errorHandler->expects($this->once())->method('setErrorHandler')
- ->with([$errorHandler, 'errorHandler'])
+ ->with([$errorHandler, 'handleError'])
->willReturn(null);
$errorHandler->converErrorsToExceptions();
@@ -297,7 +297,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
$errorHandler = $this->errorHandler;
$errorHandler->expects($expectErrorHandler)->method('setErrorHandler')
- ->with([$errorHandler, 'errorHandler'])
+ ->with([$errorHandler, 'handleError'])
->willReturn(null);
$errorHandler->expects($expectShutdownFunction)->method('registerShutdownFunction')
@@ -328,7 +328,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
$callback = function() {};
$errorHandler->expects($this->once())->method('setErrorHandler')
- ->with([$errorHandler, 'errorHandler'])
+ ->with([$errorHandler, 'handleError'])
->willReturn($callback);
$errorHandler->alsoLog(E_WARNING);
@@ -385,7 +385,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
* @param int $code
* @param InvokedCount $expectsLog
*/
- public function testErrorHandlerWithLogging($alsoLog, $code, InvokedCount $expectsLog)
+ public function testHandleErrorWithLogging($alsoLog, $code, InvokedCount $expectsLog)
{
$logger = $this->createMock(LoggerInterface::class);
$logger->expects($expectsLog)->method('log')
@@ -397,7 +397,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
$errorHandler->setLogger($logger);
$errorHandler->alsoLog($alsoLog);
- $this->errorHandler->errorHandler($code, 'no good', 'foo.php', 42, []);
+ $this->errorHandler->handleError($code, 'no good', 'foo.php', 42, []);
}
/**
@@ -408,7 +408,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
* @param InvokedCount $expectsLog Ignored
* @param boolean $expectException
*/
- public function testErrorHandlerWithConvertError($alsoLog, $code, InvokedCount $expectsLog, $expectException)
+ public function testHandleErrorWithConvertError($alsoLog, $code, InvokedCount $expectsLog, $expectException)
{
$logger = $this->createMock(LoggerInterface::class);
$logger->expects($this->never())->method('log');
@@ -421,7 +421,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
$errorHandler->converErrorsToExceptions();
try {
- $this->errorHandler->errorHandler($code, 'no good', 'foo.php', 42, []);
+ $this->errorHandler->handleError($code, 'no good', 'foo.php', 42, []);
if ($expectException) {
$this->fail("Expected error exception wasn't thrown");