Skip to content

Commit

Permalink
Closes #5956
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Sep 19, 2024
1 parent 9009862 commit d7d8e73
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog-8.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil

### Changed

* [#5956](https://github.com/sebastianbergmann/phpunit/issues/5956): Deprecation of the `E_STRICT` constant in PHP 8.4
* Removed `.phpstorm.meta.php` file as methods such as `TestCase::createStub()` use generics / template types for their return types and PhpStorm, for example, uses that information

## [8.5.39] - 2024-07-10
Expand Down
11 changes: 10 additions & 1 deletion src/Util/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use const E_USER_NOTICE;
use const E_USER_WARNING;
use const E_WARNING;
use function defined;
use function error_reporting;
use function restore_error_handler;
use function set_error_handler;
Expand Down Expand Up @@ -93,10 +94,18 @@ public function __invoke(int $errorNumber, string $errorString, string $errorFil
return false;
}

/**
* E_STRICT is deprecated since PHP 8.4.
*
* @see https://github.com/sebastianbergmann/phpunit/issues/5956
*/
if (defined('E_STRICT') && $errorNumber === @E_STRICT) {
$errorNumber = E_NOTICE;
}

switch ($errorNumber) {
case E_NOTICE:
case E_USER_NOTICE:
case E_STRICT:
if (!$this->convertNoticesToExceptions) {
return false;
}
Expand Down

0 comments on commit d7d8e73

Please sign in to comment.