Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
fab2s committed Apr 27, 2024
1 parent 6e2da39 commit 44988dc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Caster/ArrayOfCaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
class ArrayOfCaster implements CasterInterface
{
public readonly ArrayType|ScalarType|string $logicalType;
protected ?ScalarCaster $scalarTypeCaster;
protected ?ScalarCaster $scalarCaster;

/**
* @throws CasterException
*/
public function __construct(
/** @var class-string<Dt0|UnitEnum>|ScalarType|string */
public readonly ScalarType|string $type,
Expand All @@ -37,8 +40,8 @@ public function __construct(
throw new CasterException('[' . Dt0::classBasename(static::class) . "] $type is not an ArrayType nor a ScalarType");
}

$this->logicalType = $logicalType;
$this->scalarTypeCaster = $this->logicalType instanceof ScalarType ? new ScalarCaster($this->logicalType) : null;
$this->logicalType = $logicalType;
$this->scalarCaster = $this->logicalType instanceof ScalarType ? new ScalarCaster($this->logicalType) : null;
}

public function cast(mixed $value): ?array
Expand All @@ -52,7 +55,7 @@ public function cast(mixed $value): ?array
$result[] = match ($this->logicalType) {
ArrayType::DT0 => $this->type::tryFrom($item),
ArrayType::ENUM => Property::tryEnum($this->type, $item),
default => $this->scalarTypeCaster->cast($item),
default => $this->scalarCaster->cast($item),
};
}

Expand Down

0 comments on commit 44988dc

Please sign in to comment.