diff --git a/composer.json b/composer.json index 8263cd6026..a5dfef18b1 100644 --- a/composer.json +++ b/composer.json @@ -71,6 +71,7 @@ "matthiasnoback/symfony-dependency-injection-test": "^4.1", "symfony/phpunit-bridge": "^5.1", "symfony/proxy-manager-bridge": "^5.3", + "symfony/runtime": "^5.3.0", "phpstan/phpstan": "^1.2", "phpstan/phpstan-symfony": "^1.3", "phpstan/phpstan-phpunit": "^1.3" diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 0af59c60ea..ac2649e3e0 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -15585,6 +15585,11 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php + - + message: "#^Cannot call method addAttribute\\(\\) on SimpleXMLElement\\|null\\.$#" + count: 1 + path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php + - message: "#^Cannot call method getAttribute\\(\\) on DOMElement\\|null\\.$#" count: 6 @@ -20170,11 +20175,6 @@ parameters: count: 1 path: src/lib/Repository/ContentService.php - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 1 - path: src/lib/Repository/ContentService.php - - message: "#^Method Ibexa\\\\Core\\\\Repository\\\\ContentTypeService\\:\\:__construct\\(\\) has parameter \\$settings with no value type specified in iterable type array\\.$#" count: 1 diff --git a/src/bundle/IO/Command/MigrateFilesCommand.php b/src/bundle/IO/Command/MigrateFilesCommand.php index f5c56f04dc..213369d40f 100644 --- a/src/bundle/IO/Command/MigrateFilesCommand.php +++ b/src/bundle/IO/Command/MigrateFilesCommand.php @@ -127,7 +127,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $output->writeln([ - "Migrating from '$fromHandlers[0],$fromHandlers[1]' to '$toHandlers[0],$toHandlers[1]'", + "Migrating from '{$fromHandlers[0]},{$fromHandlers[1]}' to '{$toHandlers[0]},{$toHandlers[1]}'", '', ]); diff --git a/src/contracts/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandler.php b/src/contracts/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandler.php new file mode 100644 index 0000000000..d9521c6c68 --- /dev/null +++ b/src/contracts/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandler.php @@ -0,0 +1,24 @@ + 80200) { + error_reporting(E_ALL & ~E_DEPRECATED); + } + } +} diff --git a/src/lib/FieldType/GatewayBasedStorage.php b/src/lib/FieldType/GatewayBasedStorage.php index ffac60fb11..4b0a43efeb 100644 --- a/src/lib/FieldType/GatewayBasedStorage.php +++ b/src/lib/FieldType/GatewayBasedStorage.php @@ -87,7 +87,7 @@ protected function getGateway(array $context) ); if (!isset($this->gateways[$context['identifier']])) { - throw new \OutOfBoundsException("No gateway for $context[identifier] available."); + throw new \OutOfBoundsException("No gateway for {$context['identifier']} available."); } $gateway = $this->gateways[$context['identifier']]; diff --git a/src/lib/Persistence/Cache/AbstractHandler.php b/src/lib/Persistence/Cache/AbstractHandler.php index f160b18c08..04fdddd34a 100644 --- a/src/lib/Persistence/Cache/AbstractHandler.php +++ b/src/lib/Persistence/Cache/AbstractHandler.php @@ -65,11 +65,11 @@ public function __construct( /** * Helper for getting multiple cache items in one call and do the id extraction for you. * - * Cache items must be stored with a key in the following format "${keyPrefix}${id}", like "ez-content-info-${id}", + * Cache items must be stored with a key in the following format "{$keyPrefix}{$id}", like "ez-content-info-{$id}", * in order for this method to be able to prefix key on id's and also extract key prefix afterwards. * * It also optionally supports a key suffixs, for use on a variable argument that affects all lookups, - * like translations, i.e. "ez-content-${id}-${translationKey}" where $keySuffixes = [$id => "-${translationKey}"]. + * like translations, i.e. "ez-content-{$id}-{$translationKey}" where $keySuffixes = [$id => "-{$translationKey}"]. * * @param array $ids * @param string $keyPrefix E.g "ez-content-" diff --git a/src/lib/Persistence/Cache/AbstractInMemoryHandler.php b/src/lib/Persistence/Cache/AbstractInMemoryHandler.php index 481c655c3a..8fa1ae1072 100644 --- a/src/lib/Persistence/Cache/AbstractInMemoryHandler.php +++ b/src/lib/Persistence/Cache/AbstractInMemoryHandler.php @@ -182,7 +182,7 @@ final protected function getListCacheValue( * Load items from in-memory cache, symfony cache pool or backend in that order. * If not cached the returned objects will be placed in cache. * - * Cache items must be stored with a key in the following format "${keyPrefix}${id}", like "ez-content-info-${id}", + * Cache items must be stored with a key in the following format "{$keyPrefix}{$id}", like "ez-content-info-{$id}", * in order for this method to be able to prefix key on id's and also extract key prefix afterwards. * * @param array $ids diff --git a/tests/lib/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandlerTest.php b/tests/lib/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandlerTest.php new file mode 100644 index 0000000000..d66552b029 --- /dev/null +++ b/tests/lib/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandlerTest.php @@ -0,0 +1,47 @@ += 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); + } +}