|
14 | 14 | use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
15 | 15 | use Symfony\Component\Console\Output\OutputInterface;
|
16 | 16 |
|
17 |
| -if (\PHP_VERSION_ID < 80000 |
18 |
| - // look for the "string|iterable" type on OutputInterface::write() |
19 |
| - || !(new \ReflectionMethod(OutputInterface::class, 'write'))->getParameters()[0]->getType()) { |
| 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 | 20 | class MigrationDiffFilteredOutput implements OutputInterface
|
21 | 21 | {
|
22 | 22 | use BaseMakerMigrationDiffFilteredOuputTrait;
|
@@ -47,13 +47,12 @@ public function setDecorated($decorated)
|
47 | 47 |
|
48 | 48 | trait BaseMakerMigrationDiffFilteredOuputTrait
|
49 | 49 | {
|
50 |
| - private $output; |
51 |
| - private $buffer = ''; |
52 |
| - private $previousLineWasRemoved = false; |
| 50 | + private string $buffer = ''; |
| 51 | + private bool $previousLineWasRemoved = false; |
53 | 52 |
|
54 |
| - public function __construct(OutputInterface $output) |
55 |
| - { |
56 |
| - $this->output = $output; |
| 53 | + public function __construct( |
| 54 | + private OutputInterface $output, |
| 55 | + ) { |
57 | 56 | }
|
58 | 57 |
|
59 | 58 | public function _write($messages, bool $newline = false, $options = 0)
|
@@ -144,7 +143,7 @@ private function filterMessages($messages, bool $newLine)
|
144 | 143 |
|
145 | 144 | $this->previousLineWasRemoved = false;
|
146 | 145 | foreach ($hiddenPhrases as $hiddenPhrase) {
|
147 |
| - if (false !== strpos($message, $hiddenPhrase)) { |
| 146 | + if (str_contains($message, $hiddenPhrase)) { |
148 | 147 | $this->previousLineWasRemoved = true;
|
149 | 148 | unset($messages[$key]);
|
150 | 149 |
|
|
0 commit comments