Skip to content

Commit f2c8985

Browse files
committed
remove php 7 conditional check
1 parent c639f63 commit f2c8985

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/Console/MigrationDiffFilteredOutput.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
1515
use Symfony\Component\Console\Output\OutputInterface;
1616

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()) {
2020
class MigrationDiffFilteredOutput implements OutputInterface
2121
{
2222
use BaseMakerMigrationDiffFilteredOuputTrait;
@@ -47,13 +47,12 @@ public function setDecorated($decorated)
4747

4848
trait BaseMakerMigrationDiffFilteredOuputTrait
4949
{
50-
private $output;
51-
private $buffer = '';
52-
private $previousLineWasRemoved = false;
50+
private string $buffer = '';
51+
private bool $previousLineWasRemoved = false;
5352

54-
public function __construct(OutputInterface $output)
55-
{
56-
$this->output = $output;
53+
public function __construct(
54+
private OutputInterface $output,
55+
) {
5756
}
5857

5958
public function _write($messages, bool $newline = false, $options = 0)
@@ -144,7 +143,7 @@ private function filterMessages($messages, bool $newLine)
144143

145144
$this->previousLineWasRemoved = false;
146145
foreach ($hiddenPhrases as $hiddenPhrase) {
147-
if (false !== strpos($message, $hiddenPhrase)) {
146+
if (str_contains($message, $hiddenPhrase)) {
148147
$this->previousLineWasRemoved = true;
149148
unset($messages[$key]);
150149

0 commit comments

Comments
 (0)