Skip to content

Commit

Permalink
Revert "Simplify"
Browse files Browse the repository at this point in the history
This reverts commit 7b0ef67.
  • Loading branch information
sebastianbergmann committed Aug 2, 2019
1 parent dab10be commit 4095cdf
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 6 deletions.
17 changes: 17 additions & 0 deletions src/Framework/Error/Deprecation.php
@@ -0,0 +1,17 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework\Error;

/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class Deprecation extends Error
{
}
17 changes: 17 additions & 0 deletions src/Framework/Error/Notice.php
@@ -0,0 +1,17 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework\Error;

/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class Notice extends Error
{
}
17 changes: 17 additions & 0 deletions src/Framework/Error/Warning.php
@@ -0,0 +1,17 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework\Error;

/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class Warning extends Error
{
}
13 changes: 7 additions & 6 deletions src/Util/ErrorHandler.php
Expand Up @@ -9,7 +9,10 @@
*/
namespace PHPUnit\Util;

use PHPUnit\Framework\Error\Deprecation;
use PHPUnit\Framework\Error\Error;
use PHPUnit\Framework\Error\Notice;
use PHPUnit\Framework\Error\Warning;

final class ErrorHandler
{
Expand Down Expand Up @@ -84,33 +87,31 @@ public function __invoke(int $errorNumber, string $errorString, string $errorFil
return false;
}

break;
throw new Notice($errorString, $errorNumber, $errorFile, $errorLine);

case \E_WARNING:
case \E_USER_WARNING:
if (!$this->convertWarningsToExceptions) {
return false;
}

break;
throw new Warning($errorString, $errorNumber, $errorFile, $errorLine);

case \E_DEPRECATED:
case \E_USER_DEPRECATED:
if (!$this->convertDeprecationsToExceptions) {
return false;
}

break;
throw new Deprecation($errorString, $errorNumber, $errorFile, $errorLine);

default:
if (!$this->convertErrorsToExceptions) {
return false;
}

break;
throw new Error($errorString, $errorNumber, $errorFile, $errorLine);
}

throw new Error($errorString, $errorNumber, $errorFile, $errorLine);
}

public function register(): void
Expand Down

0 comments on commit 4095cdf

Please sign in to comment.