From 07afdbf544f62b46f7bf1034b88439db22164729 Mon Sep 17 00:00:00 2001 From: Patrick Allaert Date: Mon, 13 Feb 2023 15:19:53 +0100 Subject: [PATCH] Fixed: Deprecation notices in string interpolation with PHP 8.2 --- src/bundle/Core/DependencyInjection/IbexaCoreExtension.php | 2 +- src/bundle/Core/Features/Context/UserContext.php | 2 +- src/lib/FieldType/GatewayBasedStorage.php | 2 +- src/lib/Persistence/Cache/ContentHandler.php | 4 ++-- tests/integration/Core/Repository/BaseTest.php | 2 +- tests/integration/Core/Repository/ContentTypeServiceTest.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php b/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php index 77cc0604f6..51175e6526 100644 --- a/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php +++ b/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php @@ -782,7 +782,7 @@ private function configureGenericSetup(ContainerBuilder $container): void // Cache settings // If CACHE_POOL env variable is set, check if there is a yml file that needs to be loaded for it - if (($pool = $_SERVER['CACHE_POOL'] ?? false) && file_exists($projectDir . "/config/packages/cache_pool/${pool}.yaml")) { + if (($pool = $_SERVER['CACHE_POOL'] ?? false) && file_exists($projectDir . "/config/packages/cache_pool/$pool.yaml")) { $loader = new Loader\YamlFileLoader($container, new FileLocator($projectDir . '/config/packages/cache_pool')); $loader->load($pool . '.yaml'); } diff --git a/src/bundle/Core/Features/Context/UserContext.php b/src/bundle/Core/Features/Context/UserContext.php index b486fa47d9..d5e7808193 100644 --- a/src/bundle/Core/Features/Context/UserContext.php +++ b/src/bundle/Core/Features/Context/UserContext.php @@ -544,7 +544,7 @@ public function assertUserWithNameExistsWithFields($username, TableNode $table) */ private function findNonExistingUserEmail($username = 'User') { - $email = "${username}@ibexa.co"; + $email = "{$username}@ibexa.co"; if ($this->checkUserExistenceByEmail($email)) { return $email; } diff --git a/src/lib/FieldType/GatewayBasedStorage.php b/src/lib/FieldType/GatewayBasedStorage.php index 4d2c358291..ffac60fb11 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/ContentHandler.php b/src/lib/Persistence/Cache/ContentHandler.php index 5e9b28eebb..5938eef614 100644 --- a/src/lib/Persistence/Cache/ContentHandler.php +++ b/src/lib/Persistence/Cache/ContentHandler.php @@ -131,7 +131,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( @@ -238,7 +238,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/tests/integration/Core/Repository/BaseTest.php b/tests/integration/Core/Repository/BaseTest.php index d08bfe5d4f..03714237ae 100644 --- a/tests/integration/Core/Repository/BaseTest.php +++ b/tests/integration/Core/Repository/BaseTest.php @@ -173,7 +173,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/tests/integration/Core/Repository/ContentTypeServiceTest.php b/tests/integration/Core/Repository/ContentTypeServiceTest.php index ffa7e7c490..7f125bedee 100644 --- a/tests/integration/Core/Repository/ContentTypeServiceTest.php +++ b/tests/integration/Core/Repository/ContentTypeServiceTest.php @@ -874,7 +874,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; }