From d6352f86cc757e9833fd2ee91ddcc316370ce00a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 9 Feb 2024 09:32:06 +0100 Subject: [PATCH] fix tests --- .../Fixtures/{ReadonlyTest.php => ReadOnlyClass.php} | 2 +- .../Tests/LazyProxy/PhpDumper/LazyServiceDumperTest.php | 8 ++++---- src/Symfony/Component/VarExporter/ProxyHelper.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) rename src/Symfony/Component/DependencyInjection/Tests/Fixtures/{ReadonlyTest.php => ReadOnlyClass.php} (92%) diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ReadonlyTest.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ReadOnlyClass.php similarity index 92% rename from src/Symfony/Component/DependencyInjection/Tests/Fixtures/ReadonlyTest.php rename to src/Symfony/Component/DependencyInjection/Tests/Fixtures/ReadOnlyClass.php index f49931bf39c3b..b247ea21686d0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ReadonlyTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ReadOnlyClass.php @@ -11,7 +11,7 @@ namespace Symfony\Component\DependencyInjection\Tests\Fixtures; -readonly class ReadonlyTest +readonly class ReadOnlyClass { public function say(): string { diff --git a/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/LazyServiceDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/LazyServiceDumperTest.php index 9a5da0721f0d5..467972a882c78 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/LazyServiceDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/LazyServiceDumperTest.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\LazyServiceDumper; -use Symfony\Component\DependencyInjection\Tests\Fixtures\ReadonlyTest; +use Symfony\Component\DependencyInjection\Tests\Fixtures\ReadOnlyClass; class LazyServiceDumperTest extends TestCase { @@ -55,15 +55,15 @@ public function testInvalidClass() } /** - * @requires PHP 8.2 + * @requires PHP 8.3 */ public function testReadonlyClass() { $dumper = new LazyServiceDumper(); - $definition = (new Definition(ReadonlyTest::class))->setLazy(true); + $definition = (new Definition(ReadOnlyClass::class))->setLazy(true); $this->assertTrue($dumper->isProxyCandidate($definition)); - $this->assertStringContainsString('readonly class ReadonlyTestGhost', $dumper->getProxyCode($definition)); + $this->assertStringContainsString('readonly class ReadOnlyClassGhost', $dumper->getProxyCode($definition)); } } diff --git a/src/Symfony/Component/VarExporter/ProxyHelper.php b/src/Symfony/Component/VarExporter/ProxyHelper.php index f55588b2d6f01..51e0d2afa7dfd 100644 --- a/src/Symfony/Component/VarExporter/ProxyHelper.php +++ b/src/Symfony/Component/VarExporter/ProxyHelper.php @@ -28,7 +28,7 @@ final class ProxyHelper public static function generateLazyGhost(\ReflectionClass $class): string { if (\PHP_VERSION_ID >= 80200 && \PHP_VERSION_ID < 80300 && $class->isReadOnly()) { - throw new LogicException(sprintf('Cannot generate lazy ghost: class "%s" is readonly.', $class->name)); + throw new LogicException(sprintf('Cannot generate lazy ghost with PHP < 8.3: class "%s" is readonly.', $class->name)); } if ($class->isFinal()) { throw new LogicException(sprintf('Cannot generate lazy ghost: class "%s" is final.', $class->name)); @@ -92,7 +92,7 @@ public static function generateLazyProxy(?\ReflectionClass $class, array $interf throw new LogicException(sprintf('Cannot generate lazy proxy: class "%s" is final.', $class->name)); } if (\PHP_VERSION_ID >= 80200 && \PHP_VERSION_ID < 80300 && $class?->isReadOnly()) { - throw new LogicException(sprintf('Cannot generate lazy proxy: class "%s" is readonly.', $class->name)); + throw new LogicException(sprintf('Cannot generate lazy proxy with PHP < 8.3: class "%s" is readonly.', $class->name)); } $methodReflectors = [$class?->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) ?? []];