From 7eef857e1e2af3b6ef547978b81c33bac511c30a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Barto=C5=A1?= Date: Sun, 5 Jan 2025 03:08:06 +0100 Subject: [PATCH] ProcessorCallContext: remove unused method getClass() --- src/Context/ProcessorCallContext.php | 15 +-------------- src/Processing/DefaultProcessor.php | 8 +++----- tests/Unit/Context/ProcessorCallContextTest.php | 3 +-- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/Context/ProcessorCallContext.php b/src/Context/ProcessorCallContext.php index 5b5a3ddd..182bac49 100644 --- a/src/Context/ProcessorCallContext.php +++ b/src/Context/ProcessorCallContext.php @@ -17,31 +17,18 @@ final class ProcessorCallContext private RuntimeMeta $meta; - /** @var class-string */ - private string $class; - /** @var array */ private array $skippedFields = []; /** - * @param class-string $class * @param ObjectHolder $objectHolder */ - public function __construct(string $class, ObjectHolder $objectHolder, RuntimeMeta $meta) + public function __construct(ObjectHolder $objectHolder, RuntimeMeta $meta) { - $this->class = $class; $this->objectHolder = $objectHolder; $this->meta = $meta; } - /** - * @return class-string - */ - public function getClass(): string - { - return $this->class; - } - /** * @return ObjectHolder */ diff --git a/src/Processing/DefaultProcessor.php b/src/Processing/DefaultProcessor.php index 9a4d686b..6634c009 100644 --- a/src/Processing/DefaultProcessor.php +++ b/src/Processing/DefaultProcessor.php @@ -116,7 +116,7 @@ private function processBase($data, string $class, ?Options $options, bool $init $holder = $this->createHolder($class, $meta->getClass()); $mappedObjectContext = $this->createMappedObjectContext($options, $typeCreator, $initializeObjects); - $callContext = $this->createProcessorRunContext($class, $meta, $holder); + $callContext = $this->createProcessorRunContext($meta, $holder); $processedData = $this->processData($data, $mappedObjectContext, $callContext); @@ -204,17 +204,15 @@ private function createMappedObjectContext( /** * @template T of MappedObject - * @param class-string $class * @param ObjectHolder $holder * @return ProcessorCallContext */ private function createProcessorRunContext( - string $class, RuntimeMeta $meta, ObjectHolder $holder ): ProcessorCallContext { - return new ProcessorCallContext($class, $holder, $meta); + return new ProcessorCallContext($holder, $meta); } /** @@ -723,7 +721,7 @@ public function processSkippedFields( $meta = $this->metaLoader->load($class); $holder = $this->createHolder($class, $meta->getClass(), $object); - $callContext = $this->createProcessorRunContext($class, $meta, $holder); + $callContext = $this->createProcessorRunContext($meta, $holder); $fieldsMeta = $meta->getFields(); foreach ($fields as $fieldName) { diff --git a/tests/Unit/Context/ProcessorCallContextTest.php b/tests/Unit/Context/ProcessorCallContextTest.php index 6f928eb7..b1e48d72 100644 --- a/tests/Unit/Context/ProcessorCallContextTest.php +++ b/tests/Unit/Context/ProcessorCallContextTest.php @@ -23,9 +23,8 @@ public function test(): void null, ); - $context = new ProcessorCallContext(DefaultsVO::class, $holder, $meta); + $context = new ProcessorCallContext($holder, $meta); - self::assertSame(DefaultsVO::class, $context->getClass()); self::assertSame($holder, $context->getObjectHolder()); self::assertSame($meta, $context->getMeta()); }