-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged branch '1.3' of ezsystems/ezplatform-kernel into 4.5 (#306)
This is a cross-merge of ezsystems/ezplatform#386. See also #306 for more details.
- Loading branch information
Showing
8 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/contracts/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Core\MVC\Symfony\ErrorHandler; | ||
|
||
use const PHP_VERSION_ID; | ||
use Symfony\Component\Runtime\Internal\BasicErrorHandler; | ||
|
||
final class Php82HideDeprecationsErrorHandler | ||
{ | ||
public static function register(bool $debug): void | ||
{ | ||
BasicErrorHandler::register($debug); | ||
|
||
if (PHP_VERSION_ID > 80200) { | ||
error_reporting(E_ALL & ~E_DEPRECATED); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
tests/lib/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandlerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Tests\Core\MVC\Symfony\ErrorHandler; | ||
|
||
use Ibexa\Contracts\Core\MVC\Symfony\ErrorHandler\Php82HideDeprecationsErrorHandler; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @requires PHP >= 8.2.0 | ||
*/ | ||
final class Php82HideDeprecationsErrorHandlerTest extends TestCase | ||
{ | ||
private int $originalErrorReporting; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->originalErrorReporting = error_reporting(); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
error_reporting($this->originalErrorReporting); | ||
restore_error_handler(); | ||
} | ||
|
||
public function testRegisterDebug(): void | ||
{ | ||
Php82HideDeprecationsErrorHandler::register(true); | ||
$errorReporting = error_reporting(); | ||
|
||
$this->assertSame(E_ALL & ~E_DEPRECATED, $errorReporting); | ||
} | ||
|
||
public function testRegisterNoDebug(): void | ||
{ | ||
Php82HideDeprecationsErrorHandler::register(false); | ||
$errorReporting = error_reporting(); | ||
|
||
$this->assertSame(E_ALL & ~E_DEPRECATED, $errorReporting); | ||
} | ||
} |