Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik committed Mar 11, 2024
1 parent 637872c commit 40f2773
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Compiler/MapperFactory/DefaultMapperCompilerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ public function create(TypeNode $type, array $options = []): MapperCompiler
default => match ($type->name) {
'list' => new MapList(new MapMixed()),
'non-empty-list' => new ValidatedMapperCompiler(new MapList(new MapMixed()), [new AssertListLength(min: 1)]),
'negative-int' => new ValidatedMapperCompiler(new MapInt(), [new AssertNegativeInt()]),
'non-negative-int' => new ValidatedMapperCompiler(new MapInt(), [new AssertNonNegativeInt()]),
'non-positive-int' => new ValidatedMapperCompiler(new MapInt(), [new AssertNonPositiveInt()]),
'positive-int' => new ValidatedMapperCompiler(new MapInt(), [new AssertPositiveInt()]),
'negative-int' => new ValidatedMapperCompiler($this->createInner(new IdentifierTypeNode('int'), $options), [new AssertNegativeInt()]),
'non-negative-int' => new ValidatedMapperCompiler($this->createInner(new IdentifierTypeNode('int'), $options), [new AssertNonNegativeInt()]),
'non-positive-int' => new ValidatedMapperCompiler($this->createInner(new IdentifierTypeNode('int'), $options), [new AssertNonPositiveInt()]),
'positive-int' => new ValidatedMapperCompiler($this->createInner(new IdentifierTypeNode('int'), $options), [new AssertPositiveInt()]),
default => throw CannotCreateMapperCompilerException::fromType($type),
},
};
Expand All @@ -153,7 +153,7 @@ public function create(TypeNode $type, array $options = []): MapperCompiler
default => throw CannotCreateMapperCompilerException::fromType($type),
},
'int' => match (count($type->genericTypes)) {
2 => new ValidatedMapperCompiler(new MapInt(), [
2 => new ValidatedMapperCompiler($this->createInner(new IdentifierTypeNode('int'), $options), [
new AssertIntRange(
gte: $this->resolveIntegerBoundary($type, $type->genericTypes[0], 'min'),
lte: $this->resolveIntegerBoundary($type, $type->genericTypes[1], 'max'),
Expand Down

0 comments on commit 40f2773

Please sign in to comment.