10
10
use Symfony \Component \Console \Input \InputInterface ;
11
11
use Symfony \Component \Console \Input \InputOption ;
12
12
use Symfony \Component \Console \Output \OutputInterface ;
13
- use Symfony \Component \Console \Style \SymfonyStyle ;
14
- use Symplify \PackageBuilder \Console \ShellCode ;
15
- use Symplify \SmartFileSystem \SmartFileInfo ;
16
- use Symplify \SmartFileSystem \SmartFileSystem ;
17
13
18
14
final class DumpNodesCommand extends Command
19
15
{
@@ -22,42 +18,16 @@ final class DumpNodesCommand extends Command
22
18
*/
23
19
private const OUTPUT_FILE = 'output-file ' ;
24
20
25
- /**
26
- * @var MarkdownNodeInfosPrinter
27
- */
28
- private $ markdownNodeInfosPrinter ;
29
-
30
- /**
31
- * @var NodeInfosFactory
32
- */
33
- private $ nodeInfosFactory ;
34
-
35
- /**
36
- * @var SmartFileSystem
37
- */
38
- private $ smartFileSystem ;
39
-
40
- /**
41
- * @var SymfonyStyle
42
- */
43
- private $ symfonyStyle ;
44
-
45
21
public function __construct (
46
- MarkdownNodeInfosPrinter $ markdownNodeInfosPrinter ,
47
- NodeInfosFactory $ nodeInfosFactory ,
48
- SmartFileSystem $ smartFileSystem ,
49
- SymfonyStyle $ symfonyStyle
22
+ private readonly MarkdownNodeInfosPrinter $ markdownNodeInfosPrinter ,
23
+ private readonly NodeInfosFactory $ nodeInfosFactory ,
50
24
) {
51
- $ this ->markdownNodeInfosPrinter = $ markdownNodeInfosPrinter ;
52
- $ this ->nodeInfosFactory = $ nodeInfosFactory ;
53
- $ this ->smartFileSystem = $ smartFileSystem ;
54
- $ this ->symfonyStyle = $ symfonyStyle ;
55
-
56
25
parent ::__construct ();
57
26
}
58
27
59
28
protected function configure (): void
60
29
{
30
+ $ this ->setName ('dump-nodes ' );
61
31
$ this ->setDescription ('Dump nodes overview ' );
62
32
63
33
$ this ->addOption (
@@ -74,18 +44,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
74
44
$ outputFile = (string ) $ input ->getOption (self ::OUTPUT_FILE );
75
45
76
46
$ nodeInfos = $ this ->nodeInfosFactory ->create ();
77
-
78
47
$ printedContent = $ this ->markdownNodeInfosPrinter ->print ($ nodeInfos );
79
- $ this ->smartFileSystem ->dumpFile ($ outputFile , $ printedContent );
80
48
81
- $ outputFileFileInfo = new SmartFileInfo ($ outputFile );
82
- $ message = sprintf (
49
+ file_put_contents ($ outputFile , $ printedContent );
50
+
51
+ $ output ->writeln (sprintf (
83
52
'Documentation for "%d" PhpParser Nodes was generated to "%s" ' ,
84
53
count ($ nodeInfos ),
85
- $ outputFileFileInfo ->getRelativeFilePathFromCwd ()
86
- );
87
- $ this ->symfonyStyle ->success ($ message );
54
+ $ outputFile
55
+ ));
88
56
89
- return ShellCode ::SUCCESS ;
57
+ return self ::SUCCESS ;
90
58
}
91
59
}
0 commit comments