diff --git a/src/Compiler/MapperFactory/DefaultMapperCompilerFactory.php b/src/Compiler/MapperFactory/DefaultMapperCompilerFactory.php index 4a1121e..b94b142 100644 --- a/src/Compiler/MapperFactory/DefaultMapperCompilerFactory.php +++ b/src/Compiler/MapperFactory/DefaultMapperCompilerFactory.php @@ -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), }, }; @@ -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'),