Skip to content

Commit cfc92dd

Browse files
author
Kirill Nesmeyanov
committed
Add exceptions in normalizer/denormalizer interfaces
1 parent adc2652 commit cfc92dd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/DenormalizerInterface.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
namespace TypeLang\Mapper;
66

77
use JetBrains\PhpStorm\Language;
8+
use TypeLang\Mapper\Exception\Definition\DefinitionException;
89
use TypeLang\Mapper\Exception\Definition\TypeNotFoundException;
10+
use TypeLang\Mapper\Exception\Mapping\RuntimeException;
911

1012
interface DenormalizerInterface
1113
{
@@ -23,14 +25,17 @@ interface DenormalizerInterface
2325
* ```
2426
*
2527
* @param non-empty-string $type
28+
* @throws RuntimeException in case of runtime mapping exception occurs
29+
* @throws DefinitionException in case of type building exception occurs
30+
* @throws \Throwable in case of any internal error occurs
2631
*/
2732
public function denormalize(mixed $value, #[Language('PHP')] string $type): mixed;
2833

2934
/**
3035
* Returns {@see true} if the value can be denormalized for the given type.
3136
*
3237
* @param non-empty-string $type
33-
* @throws TypeNotFoundException in case of type not found
38+
* @throws DefinitionException in case of type building exception occurs
3439
* @throws \Throwable in case of any internal error occurs
3540
*/
3641
public function isDenormalizable(mixed $value, #[Language('PHP')] string $type): bool;

src/NormalizerInterface.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
namespace TypeLang\Mapper;
66

77
use JetBrains\PhpStorm\Language;
8+
use TypeLang\Mapper\Exception\Definition\DefinitionException;
89
use TypeLang\Mapper\Exception\Definition\TypeNotFoundException;
10+
use TypeLang\Mapper\Exception\Mapping\RuntimeException;
911

1012
interface NormalizerInterface
1113
{
@@ -26,6 +28,9 @@ interface NormalizerInterface
2628
* ```
2729
*
2830
* @param non-empty-string|null $type
31+
* @throws RuntimeException in case of runtime mapping exception occurs
32+
* @throws DefinitionException in case of type building exception occurs
33+
* @throws \Throwable in case of any internal error occurs
2934
*/
3035
public function normalize(mixed $value, #[Language('PHP')] ?string $type = null): mixed;
3136

@@ -36,7 +41,7 @@ public function normalize(mixed $value, #[Language('PHP')] ?string $type = null)
3641
* inferred from the passed value.
3742
*
3843
* @param non-empty-string|null $type
39-
* @throws TypeNotFoundException in case of type not found
44+
* @throws DefinitionException in case of type building exception occurs
4045
* @throws \Throwable in case of any internal error occurs
4146
*/
4247
public function isNormalizable(mixed $value, #[Language('PHP')] ?string $type = null): bool;

0 commit comments

Comments
 (0)