1414use Symfony \Component \Console \Formatter \OutputFormatterInterface ;
1515use Symfony \Component \Console \Output \OutputInterface ;
1616
17- // look for the "string|iterable" type on OutputInterface::write()
18- // @legacy - Use MigrationDiffFilteredOutput_php8 when Symfony 5.4 is no longer supported
19- if (!(new \ReflectionMethod (OutputInterface::class, 'write ' ))->getParameters ()[0 ]->getType ()) {
20- class MigrationDiffFilteredOutput implements OutputInterface
21- {
22- use BaseMakerMigrationDiffFilteredOuputTrait;
23-
24- public function write ($ messages , $ newline = false , $ options = 0 )
25- {
26- $ this ->_write ($ messages , $ newline , $ options );
27- }
28-
29- public function writeln ($ messages , $ options = 0 )
30- {
31- $ this ->_writeln ($ messages , $ options );
32- }
33-
34- public function setVerbosity ($ level )
35- {
36- $ this ->output ->setVerbosity ($ level );
37- }
38-
39- public function setDecorated ($ decorated )
40- {
41- $ this ->output ->setDecorated ($ decorated );
42- }
43- }
44- } else {
45- require __DIR__ .'/MigrationDiffFilteredOutput_php8 ' ;
46- }
47-
48- trait BaseMakerMigrationDiffFilteredOuputTrait
17+ class MigrationDiffFilteredOutput implements OutputInterface
4918{
5019 private string $ buffer = '' ;
5120 private bool $ previousLineWasRemoved = false ;
@@ -55,20 +24,30 @@ public function __construct(
5524 ) {
5625 }
5726
58- public function _write ($ messages , bool $ newline = false , $ options = 0 )
27+ public function write ($ messages , bool $ newline = false , $ options = 0 ): void
5928 {
6029 $ messages = $ this ->filterMessages ($ messages , $ newline );
6130
6231 $ this ->output ->write ($ messages , $ newline , $ options );
6332 }
6433
65- public function _writeln ($ messages , int $ options = 0 )
34+ public function writeln ($ messages , int $ options = 0 ): void
6635 {
6736 $ messages = $ this ->filterMessages ($ messages , true );
6837
6938 $ this ->output ->writeln ($ messages , $ options );
7039 }
7140
41+ public function setVerbosity (int $ level ): void
42+ {
43+ $ this ->output ->setVerbosity ($ level );
44+ }
45+
46+ public function setDecorated (bool $ decorated ): void
47+ {
48+ $ this ->output ->setDecorated ($ decorated );
49+ }
50+
7251 public function getVerbosity (): int
7352 {
7453 return $ this ->output ->getVerbosity ();
@@ -99,7 +78,7 @@ public function isDecorated(): bool
9978 return $ this ->output ->isDecorated ();
10079 }
10180
102- public function setFormatter (OutputFormatterInterface $ formatter )
81+ public function setFormatter (OutputFormatterInterface $ formatter ): void
10382 {
10483 $ this ->output ->setFormatter ($ formatter );
10584 }
0 commit comments