1010use Symfony \Component \Console \Input \InputInterface ;
1111use Symfony \Component \Console \Input \InputOption ;
1212use 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 ;
1713
1814final class DumpNodesCommand extends Command
1915{
@@ -22,42 +18,16 @@ final class DumpNodesCommand extends Command
2218 */
2319 private const OUTPUT_FILE = 'output-file ' ;
2420
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-
4521 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 ,
5024 ) {
51- $ this ->markdownNodeInfosPrinter = $ markdownNodeInfosPrinter ;
52- $ this ->nodeInfosFactory = $ nodeInfosFactory ;
53- $ this ->smartFileSystem = $ smartFileSystem ;
54- $ this ->symfonyStyle = $ symfonyStyle ;
55-
5625 parent ::__construct ();
5726 }
5827
5928 protected function configure (): void
6029 {
30+ $ this ->setName ('dump-nodes ' );
6131 $ this ->setDescription ('Dump nodes overview ' );
6232
6333 $ this ->addOption (
@@ -74,18 +44,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7444 $ outputFile = (string ) $ input ->getOption (self ::OUTPUT_FILE );
7545
7646 $ nodeInfos = $ this ->nodeInfosFactory ->create ();
77-
7847 $ printedContent = $ this ->markdownNodeInfosPrinter ->print ($ nodeInfos );
79- $ this ->smartFileSystem ->dumpFile ($ outputFile , $ printedContent );
8048
81- $ outputFileFileInfo = new SmartFileInfo ($ outputFile );
82- $ message = sprintf (
49+ file_put_contents ($ outputFile , $ printedContent );
50+
51+ $ output ->writeln (sprintf (
8352 'Documentation for "%d" PhpParser Nodes was generated to "%s" ' ,
8453 count ($ nodeInfos ),
85- $ outputFileFileInfo ->getRelativeFilePathFromCwd ()
86- );
87- $ this ->symfonyStyle ->success ($ message );
54+ $ outputFile
55+ ));
8856
89- return ShellCode ::SUCCESS ;
57+ return self ::SUCCESS ;
9058 }
9159}
0 commit comments