From 950d7c06000cee2996dc07eef75bfe5050defe71 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Mon, 13 Jan 2025 20:43:08 -0500 Subject: [PATCH] Fix CS errors --- src/Tool/ClassUtils.php | 2 ++ src/Tool/Logging/DBAL/QueryAnalyzer.php | 4 +--- tests/Gedmo/IpTraceable/IpTraceableTest.php | 8 ++++---- tests/Gedmo/Mapping/MappingEventAdapterTest.php | 6 +++--- tests/Gedmo/Tool/BaseTestCaseMongoODM.php | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Tool/ClassUtils.php b/src/Tool/ClassUtils.php index 9e96fa24ee..5edbe321e0 100644 --- a/src/Tool/ClassUtils.php +++ b/src/Tool/ClassUtils.php @@ -28,7 +28,9 @@ private function __construct() * If doctrine/common is not installed, this method behaves like {@see get_class()}. * * @param TObject $object + * * @return class-string + * * @template TObject of object */ public static function getClass(object $object): string diff --git a/src/Tool/Logging/DBAL/QueryAnalyzer.php b/src/Tool/Logging/DBAL/QueryAnalyzer.php index e323ce0138..e57c2b23ec 100644 --- a/src/Tool/Logging/DBAL/QueryAnalyzer.php +++ b/src/Tool/Logging/DBAL/QueryAnalyzer.php @@ -31,10 +31,8 @@ class QueryAnalyzer implements SQLLogger /** * Start time of currently executed query - * - * @var float */ - private $queryStartTime; + private ?float $queryStartTime = null; /** * Total execution time of all queries diff --git a/tests/Gedmo/IpTraceable/IpTraceableTest.php b/tests/Gedmo/IpTraceable/IpTraceableTest.php index 4b6640b897..8fd2a53892 100644 --- a/tests/Gedmo/IpTraceable/IpTraceableTest.php +++ b/tests/Gedmo/IpTraceable/IpTraceableTest.php @@ -58,9 +58,9 @@ public function testIpV4(): void $listener = new IpTraceableListener(); $listener->setIpValue('123.218.45.39'); static::assertSame('123.218.45.39', $listener->getFieldValue( - $this->createStub(ClassMetadata::class), + static::createStub(ClassMetadata::class), 'ip', - $this->createStub(AdapterInterface::class) + static::createStub(AdapterInterface::class) )); } @@ -69,9 +69,9 @@ public function testIpV6(): void $listener = new IpTraceableListener(); $listener->setIpValue('2001:0db8:0000:85a3:0000:0000:ac1f:8001'); static::assertSame('2001:0db8:0000:85a3:0000:0000:ac1f:8001', $listener->getFieldValue( - $this->createStub(ClassMetadata::class), + static::createStub(ClassMetadata::class), 'ip', - $this->createStub(AdapterInterface::class) + static::createStub(AdapterInterface::class) )); } diff --git a/tests/Gedmo/Mapping/MappingEventAdapterTest.php b/tests/Gedmo/Mapping/MappingEventAdapterTest.php index d4240ba124..8b5a0eba28 100644 --- a/tests/Gedmo/Mapping/MappingEventAdapterTest.php +++ b/tests/Gedmo/Mapping/MappingEventAdapterTest.php @@ -24,7 +24,7 @@ final class MappingEventAdapterTest extends TestCase public function testCustomizedAdapter(): void { $subscriber = new EventSubscriberCustomMock(); - $args = new PrePersistEventArgs(new \stdClass(), $this->createStub(EntityManagerInterface::class)); + $args = new PrePersistEventArgs(new \stdClass(), static::createStub(EntityManagerInterface::class)); $adapter = $subscriber->getAdapter($args); static::assertInstanceOf(CustomizedORMAdapter::class, $adapter); @@ -32,7 +32,7 @@ public function testCustomizedAdapter(): void public function testCorrectAdapter(): void { - $emMock = $this->createStub(EntityManagerInterface::class); + $emMock = static::createStub(EntityManagerInterface::class); $subscriber = new EventSubscriberMock(); $args = new PrePersistEventArgs(new \stdClass(), $emMock); @@ -44,7 +44,7 @@ public function testCorrectAdapter(): void public function testAdapterBehavior(): void { - $emMock = $this->createStub(EntityManagerInterface::class); + $emMock = static::createStub(EntityManagerInterface::class); $entity = new \stdClass(); $args = new PrePersistEventArgs($entity, $emMock); diff --git a/tests/Gedmo/Tool/BaseTestCaseMongoODM.php b/tests/Gedmo/Tool/BaseTestCaseMongoODM.php index 0d31c5d59f..7fe53d6ac8 100644 --- a/tests/Gedmo/Tool/BaseTestCaseMongoODM.php +++ b/tests/Gedmo/Tool/BaseTestCaseMongoODM.php @@ -85,7 +85,7 @@ protected function getDefaultDocumentManager(?EventManager $evm = null): Documen */ protected function getMockMappedDocumentManager(?EventManager $evm = null, ?Configuration $config = null): DocumentManager { - $conn = $this->createStub(Client::class); + $conn = static::createStub(Client::class); $config ??= $this->getMockAnnotatedConfig();