diff --git a/composer.json b/composer.json index 208d172a7d..8cbab703f1 100644 --- a/composer.json +++ b/composer.json @@ -69,7 +69,8 @@ "matthiasnoback/symfony-dependency-injection-test": "^4.1", "symfony/phpunit-bridge": "^5.1", "symfony/proxy-manager-bridge": "^5.3", - "phpstan/phpstan": "^1.2" + "phpstan/phpstan": "^1.2", + "symfony/runtime": "^5.3.0" }, "conflict": { "friendsofphp/php-cs-fixer": "3.5.0", diff --git a/eZ/Bundle/EzPublishCoreBundle/Features/Context/UserContext.php b/eZ/Bundle/EzPublishCoreBundle/Features/Context/UserContext.php index 2f4f835741..885ac2569b 100644 --- a/eZ/Bundle/EzPublishCoreBundle/Features/Context/UserContext.php +++ b/eZ/Bundle/EzPublishCoreBundle/Features/Context/UserContext.php @@ -544,7 +544,7 @@ public function assertUserWithNameExistsWithFields($username, TableNode $table) */ private function findNonExistingUserEmail($username = 'User') { - $email = "${username}@ez.no"; + $email = "{$username}@ez.no"; if ($this->checkUserExistenceByEmail($email)) { return $email; } diff --git a/eZ/Publish/API/Repository/Tests/BaseTest.php b/eZ/Publish/API/Repository/Tests/BaseTest.php index fec0373452..ef4b0ecd76 100644 --- a/eZ/Publish/API/Repository/Tests/BaseTest.php +++ b/eZ/Publish/API/Repository/Tests/BaseTest.php @@ -171,7 +171,7 @@ protected function getSetupFactory(): SetupFactory if (null === $this->setupFactory) { if (false === ($setupClass = getenv('setupFactory'))) { $setupClass = LegacySetupFactory::class; - putenv("setupFactory=${setupClass}"); + putenv("setupFactory={$setupClass}"); } if (false === getenv('fixtureDir')) { diff --git a/eZ/Publish/API/Repository/Tests/ContentTypeServiceTest.php b/eZ/Publish/API/Repository/Tests/ContentTypeServiceTest.php index 79f9e425c5..b76bab4f72 100644 --- a/eZ/Publish/API/Repository/Tests/ContentTypeServiceTest.php +++ b/eZ/Publish/API/Repository/Tests/ContentTypeServiceTest.php @@ -841,7 +841,7 @@ public function testCreateContentTypeStructValues(array $data) $this->assertEquals( $typeCreate->$propertyName, $contentType->$propertyName, - "Did not assert that property '${propertyName}' is equal on struct and resulting value object" + "Did not assert that property '{$propertyName}' is equal on struct and resulting value object" ); break; } diff --git a/eZ/Publish/Core/FieldType/GatewayBasedStorage.php b/eZ/Publish/Core/FieldType/GatewayBasedStorage.php index 6e0eedf5b1..261c115029 100644 --- a/eZ/Publish/Core/FieldType/GatewayBasedStorage.php +++ b/eZ/Publish/Core/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/eZ/Publish/Core/Persistence/Cache/AbstractHandler.php b/eZ/Publish/Core/Persistence/Cache/AbstractHandler.php index f5509d6c0f..9daaec953a 100644 --- a/eZ/Publish/Core/Persistence/Cache/AbstractHandler.php +++ b/eZ/Publish/Core/Persistence/Cache/AbstractHandler.php @@ -66,11 +66,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/eZ/Publish/Core/Persistence/Cache/AbstractInMemoryHandler.php b/eZ/Publish/Core/Persistence/Cache/AbstractInMemoryHandler.php index 3cbd1dcb7c..7424f45d26 100644 --- a/eZ/Publish/Core/Persistence/Cache/AbstractInMemoryHandler.php +++ b/eZ/Publish/Core/Persistence/Cache/AbstractInMemoryHandler.php @@ -183,7 +183,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/eZ/Publish/Core/Persistence/Cache/ContentHandler.php b/eZ/Publish/Core/Persistence/Cache/ContentHandler.php index 4e77e1ddf6..eacaa7fcd8 100644 --- a/eZ/Publish/Core/Persistence/Cache/ContentHandler.php +++ b/eZ/Publish/Core/Persistence/Cache/ContentHandler.php @@ -128,7 +128,7 @@ public function copy($contentId, $versionNo = null, $newOwnerId = null) */ public function load($contentId, $versionNo = null, array $translations = null) { - $keySuffix = $versionNo ? "-${versionNo}-" : '-'; + $keySuffix = $versionNo ? "-{$versionNo}-" : '-'; $keySuffix .= empty($translations) ? self::ALL_TRANSLATIONS_KEY : implode('|', $translations); return $this->getCacheValue( @@ -235,7 +235,7 @@ function () use ($remoteId) { */ public function loadVersionInfo($contentId, $versionNo = null) { - $keySuffix = $versionNo ? "-${versionNo}" : ''; + $keySuffix = $versionNo ? "-{$versionNo}" : ''; $cacheItem = $this->cache->getItem( $this->cacheIdentifierGenerator->generateKey( self::CONTENT_VERSION_INFO_IDENTIFIER, 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/tests/lib/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandlerTest.php b/tests/lib/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandlerTest.php new file mode 100644 index 0000000000..a4eadebe86 --- /dev/null +++ b/tests/lib/MVC/Symfony/ErrorHandler/Php82HideDeprecationsErrorHandlerTest.php @@ -0,0 +1,48 @@ += 8.2.0 + */ +final class Php82HideDeprecationsErrorHandlerTest extends TestCase +{ + /** @var int */ + private $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); + } +}