44
55namespace Chubbyphp \Parsing \Schema ;
66
7- use Chubbyphp \Parsing \ErrorsException ;
87use Chubbyphp \Parsing \Result ;
98
10- /**
11- * @phpstan-type Call array{name: string, arguments: array<mixed>}
12- */
139final class LazySchema implements SchemaInterface
1410{
1511 private ?SchemaInterface $ schema = null ;
@@ -19,38 +15,44 @@ final class LazySchema implements SchemaInterface
1915 */
2016 public function __construct (private \Closure $ lazy ) {}
2117
18+ /**
19+ * @internal
20+ *
21+ * @infection-ignore-all
22+ */
2223 public function nullable (bool $ nullable = true ): static
2324 {
24- throw new \BadMethodCallException (
25- \sprintf (
26- 'LazySchema does not support any modification, "nullable" called with %s. ' ,
27- $ nullable ? 'true ' : 'false '
28- )
29- );
25+ throw new \BadMethodCallException ('LazySchema does not support any modification, "nullable" called. ' );
3026 }
3127
3228 /**
33- * @param \Closure(mixed $input): mixed $preParse
29+ * @internal
30+ *
31+ * @infection-ignore-all
3432 */
35- public function preParse ( \ Closure $ preParse ): static
33+ public function default ( mixed $ default ): static
3634 {
37- throw new \BadMethodCallException ('LazySchema does not support any modification, "preParse " called. ' );
35+ throw new \BadMethodCallException ('LazySchema does not support any modification, "default " called. ' );
3836 }
3937
4038 /**
41- * @param \Closure(mixed $input): mixed $postParse
39+ * @internal
40+ *
41+ * @infection-ignore-all
4242 */
43- public function postParse (\Closure $ postParse ): static
43+ public function preParse (\Closure $ preParse ): static
4444 {
45- throw new \BadMethodCallException ('LazySchema does not support any modification, "postParse " called. ' );
45+ throw new \BadMethodCallException ('LazySchema does not support any modification, "preParse " called. ' );
4646 }
4747
4848 /**
49- * @param \Closure(mixed $input, ErrorsException $e): mixed $catch
49+ * @internal
50+ *
51+ * @infection-ignore-all
5052 */
51- public function catch (\Closure $ catch ): static
53+ public function postParse (\Closure $ postParse ): static
5254 {
53- throw new \BadMethodCallException ('LazySchema does not support any modification, "catch " called. ' );
55+ throw new \BadMethodCallException ('LazySchema does not support any modification, "postParse " called. ' );
5456 }
5557
5658 public function parse (mixed $ input ): mixed
@@ -67,6 +69,14 @@ public function safeParse(mixed $input): Result
6769 return $ schema ->safeParse ($ input );
6870 }
6971
72+ /**
73+ * @internal
74+ */
75+ public function catch (\Closure $ catch ): static
76+ {
77+ throw new \BadMethodCallException ('LazySchema does not support any modification, "catch" called. ' );
78+ }
79+
7080 private function resolveSchema (): SchemaInterface
7181 {
7282 if (!$ this ->schema ) {
0 commit comments