Skip to content

Commit 32936cc

Browse files
authored
Fix typo [skip ci]
1 parent 58bdf4a commit 32936cc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ $application->add(
156156
You can even go further and use `NegationFilter` to exclude specific files as shown in [unit tests](https://github.com/riverwaysoft/dto-converter/blob/a8d5df2c03303c02bc9148bd1d7822d7fe48c5d8/tests/EndToEndTest.php#L297).
157157

158158
### How to write custom type resolvers?
159-
`dto-converter` takes care of converting basic PHP types like number, string and so on. But what to do if you have to convert a type that isn't a DTO? For example `\DateTimeImmutable`. You can write a class that implements [UnknownTypeResolverInterface](https://github.com/riverwaysoft/dto-converter/blob/2d434562c1bc73bcb6819257b31dd75c818f4ab1/src/Language/UnknownTypeResolverInterface.php). `dto-convert` already includes such class in core functionality. There is also a shortcut to achieve it - use [InlineTypeResolver](https://github.com/riverwaysoft/dto-converter/blob/2d434562c1bc73bcb6819257b31dd75c818f4ab1/src/Language/TypeScript/InlineTypeResolver.php):
159+
`dto-converter` takes care of converting basic PHP types like number, string and so on. But what if you have a type that isn't a DTO? For example `\DateTimeImmutable`. You can write a class that implements [UnknownTypeResolverInterface](https://github.com/riverwaysoft/dto-converter/blob/2d434562c1bc73bcb6819257b31dd75c818f4ab1/src/Language/UnknownTypeResolverInterface.php). There is also a shortcut to achieve it - use [InlineTypeResolver](https://github.com/riverwaysoft/dto-converter/blob/2d434562c1bc73bcb6819257b31dd75c818f4ab1/src/Language/TypeScript/InlineTypeResolver.php):
160160

161161
```diff
162162
$application->add(
@@ -170,9 +170,9 @@ $application->add(
170170
new DateTimeTypeResolver(),
171171
new ClassNameTypeResolver(),
172172
+ new InlineTypeResolver([
173-
+ // Convert libphonnumber object to string
173+
+ // Convert libphonnumber object to a string
174174
+ 'PhoneNumber' => 'string',
175-
+ // Convert PHP Money object to a custom TS type
175+
+ // Convert PHP Money object to a custom TypeScript type
176176
+ 'Money' => '{ amount: number; currency: string }',
177177
+ // Convert Doctrine Embeddable to an existing Dto marked as #[Dto]
178178
+ 'SomeDoctrineEmbeddable' => 'SomeDoctrineEmbeddableDto',

0 commit comments

Comments
 (0)