Skip to content

Commit

Permalink
ProcessorCallContext: remove unused method getClass()
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed Jan 5, 2025
1 parent 65316c8 commit 7eef857
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
15 changes: 1 addition & 14 deletions src/Context/ProcessorCallContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,18 @@ final class ProcessorCallContext

private RuntimeMeta $meta;

/** @var class-string<T> */
private string $class;

/** @var array<int|string, SkippedFieldContext> */
private array $skippedFields = [];

/**
* @param class-string<T> $class
* @param ObjectHolder<T> $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<T>
*/
public function getClass(): string
{
return $this->class;
}

/**
* @return ObjectHolder<T>
*/
Expand Down
8 changes: 3 additions & 5 deletions src/Processing/DefaultProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -204,17 +204,15 @@ private function createMappedObjectContext(

/**
* @template T of MappedObject
* @param class-string<T> $class
* @param ObjectHolder<T> $holder
* @return ProcessorCallContext<T>
*/
private function createProcessorRunContext(
string $class,
RuntimeMeta $meta,
ObjectHolder $holder
): ProcessorCallContext
{
return new ProcessorCallContext($class, $holder, $meta);
return new ProcessorCallContext($holder, $meta);
}

/**
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions tests/Unit/Context/ProcessorCallContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 7eef857

Please sign in to comment.