Skip to content

Commit

Permalink
Actualize docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kubk committed Aug 27, 2023
1 parent 373e938 commit 4642a37
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/class-filtering.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Customize class filtering
Suppose you don't want to individually mark each DTO with the #[Dto] annotation, but instead, you want to automatically convert all files that end with "Dto":

```php
```diff
return static function (PhpConverterConfig $config) {
$config->setCodeProvider(new FileSystemCodeProvider('/Dto\.php$/'));
+ $config->setCodeProvider(new FileSystemCodeProvider('/Dto\.php$/', __DIR__ . '/path/to/src'));
$config->addVisitor(new DtoVisitor());

$config->setOutputGenerator(new TypeScriptGenerator(
Expand Down
6 changes: 0 additions & 6 deletions docs/customize-output-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ You might want to apply some transformations to the resultant file containing ty

```php
return static function (PhpConverterConfig $config) {
$config->setCodeProvider(new FileSystemCodeProvider('/\.php$/'));

$config->addVisitor(new DtoVisitor(new PhpAttributeFilter(Dto::class)));

$config->setOutputGenerator(new TypeScriptGenerator(
Expand Down Expand Up @@ -57,8 +55,6 @@ Then add it to the list:

```php
return static function (PhpConverterConfig $config) {
$config->setCodeProvider(new FileSystemCodeProvider('/\.php$/'));

$config->addVisitor(new DtoVisitor(new PhpAttributeFilter(Dto::class)));

$config->setOutputGenerator(new TypeScriptGenerator(
Expand All @@ -80,8 +76,6 @@ By default, `php-converter` writes all the types into one file. You can configur

```diff
return static function (PhpConverterConfig $config) {
$config->setCodeProvider(new FileSystemCodeProvider('/\.php$/'));

$config->addVisitor(new DtoVisitor(new PhpAttributeFilter(Dto::class)));

+ $fileNameGenerator = new KebabCaseFileNameGenerator('.ts');
Expand Down
2 changes: 0 additions & 2 deletions docs/unknown-type-resolvers.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ There is also a shortcut to achieve it - use [InlineTypeResolver](https://github
use Riverwaysoft\PhpConverter\Dto\PhpType\PhpBaseType;

return static function (PhpConverterConfig $config) {
$config->setCodeProvider(new FileSystemCodeProvider('/\.php$/'));

$config->addVisitor(new DtoVisitor(new PhpAttributeFilter(Dto::class)));

$config->setOutputGenerator(new TypeScriptGenerator(
Expand Down

0 comments on commit 4642a37

Please sign in to comment.