diff --git a/src/FreeDSx/Asn1/Asn1.php b/src/FreeDSx/Asn1/Asn1.php index 7bdf9db..9c4f684 100644 --- a/src/FreeDSx/Asn1/Asn1.php +++ b/src/FreeDSx/Asn1/Asn1.php @@ -67,10 +67,10 @@ public static function sequenceOf(AbstractType ...$types): SequenceOfType } /** - * @param int $int + * @param int|string $int * @return IntegerType */ - public static function integer(int $int): IntegerType + public static function integer($int): IntegerType { return new IntegerType($int); } diff --git a/tests/spec/FreeDSx/Asn1/Asn1Spec.php b/tests/spec/FreeDSx/Asn1/Asn1Spec.php index c0c5dfd..64acdea 100644 --- a/tests/spec/FreeDSx/Asn1/Asn1Spec.php +++ b/tests/spec/FreeDSx/Asn1/Asn1Spec.php @@ -66,6 +66,12 @@ public function it_should_construct_an_integer_type() $this::integer(1)->shouldBeLike(new IntegerType(1)); } + public function it_should_construct_an_integer_type_from_a_numeric_string(): void + { + $this::integer('99999999999999999') + ->shouldBeLike(new IntegerType('99999999999999999')); + } + public function it_should_construct_an_enumerated_type() { $this::enumerated(1)->shouldBeLike(new EnumeratedType(1));