Skip to content

Commit 2094663

Browse files
committed
Use dumpFile in example files
1 parent 50d0aba commit 2094663

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ include 'vendor/autoload.php';
100100

101101
$generator = new CodeGenerator('Example\Demo');
102102

103-
echo $generator->dump([
103+
echo $generator->dumpFile([
104104
'// Auto-generated example file',
105105
'',
106106

@@ -133,6 +133,17 @@ echo $generator->dump([
133133

134134
<!-- output: examples/class.php -->
135135
```php
136+
<?php
137+
138+
declare(strict_types=1);
139+
140+
namespace Example\Demo;
141+
142+
use DateTimeImmutable;
143+
use Example\Attributes\Something;
144+
use Example\Demo;
145+
use Example\Parent;
146+
136147
// Auto-generated example file
137148

138149
#[Something]
@@ -165,7 +176,7 @@ include 'vendor/autoload.php';
165176
$generator = new CodeGenerator('Example\Demo');
166177

167178
// First, let's see what happens step by step
168-
echo $generator->dump(function () use ($generator) {
179+
echo $generator->dumpFile(function () use ($generator) {
169180
// Comments
170181
yield '// This file demonstrates ALL CodeGenerator features';
171182
yield '// Auto-generated example file';
@@ -458,6 +469,29 @@ echo $generator->dump(function () use ($generator) {
458469

459470
<!-- output: examples/example.php -->
460471
```php
472+
<?php
473+
474+
declare(strict_types=1);
475+
476+
namespace Example\Demo;
477+
478+
use App\Enums\Status;
479+
use App\Services\MainService;
480+
use DateTime;
481+
use DateTimeImmutable;
482+
use DateTimeInterface;
483+
use Doctrine\Common\Collections\Collection;
484+
use Example\Attributes\Entity;
485+
use Example\Attributes\Table;
486+
use Example\BaseClass;
487+
use Example\Interfaces;
488+
use Example\Interfaces\BaseInterface;
489+
use Example\Interfaces\FirstInterface;
490+
use Example\SomeClass;
491+
use Logger;
492+
use self;
493+
use stdClass;
494+
461495
// This file demonstrates ALL CodeGenerator features
462496
// Auto-generated example file
463497

examples/class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
$generator = new CodeGenerator('Example\Demo');
1010

11-
echo $generator->dump([
11+
echo $generator->dumpFile([
1212
'// Auto-generated example file',
1313
'',
1414

examples/example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
$generator = new CodeGenerator('Example\Demo');
1111

1212
// First, let's see what happens step by step
13-
echo $generator->dump(function () use ($generator) {
13+
echo $generator->dumpFile(function () use ($generator) {
1414
// Comments
1515
yield '// This file demonstrates ALL CodeGenerator features';
1616
yield '// Auto-generated example file';

0 commit comments

Comments
 (0)