Skip to content

Commit

Permalink
remove php 7 conditional check
Browse files Browse the repository at this point in the history
  • Loading branch information
jrushlow committed May 24, 2022
1 parent c639f63 commit f2c8985
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/Console/MigrationDiffFilteredOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Output\OutputInterface;

if (\PHP_VERSION_ID < 80000
// look for the "string|iterable" type on OutputInterface::write()
|| !(new \ReflectionMethod(OutputInterface::class, 'write'))->getParameters()[0]->getType()) {
// look for the "string|iterable" type on OutputInterface::write()
// @legacy - Use MigrationDiffFilteredOutput_php8 when Symfony 5.4 is no longer supported
if (!(new \ReflectionMethod(OutputInterface::class, 'write'))->getParameters()[0]->getType()) {
class MigrationDiffFilteredOutput implements OutputInterface
{
use BaseMakerMigrationDiffFilteredOuputTrait;
Expand Down Expand Up @@ -47,13 +47,12 @@ public function setDecorated($decorated)

trait BaseMakerMigrationDiffFilteredOuputTrait
{
private $output;
private $buffer = '';
private $previousLineWasRemoved = false;
private string $buffer = '';
private bool $previousLineWasRemoved = false;

public function __construct(OutputInterface $output)
{
$this->output = $output;
public function __construct(
private OutputInterface $output,
) {
}

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

$this->previousLineWasRemoved = false;
foreach ($hiddenPhrases as $hiddenPhrase) {
if (false !== strpos($message, $hiddenPhrase)) {
if (str_contains($message, $hiddenPhrase)) {
$this->previousLineWasRemoved = true;
unset($messages[$key]);

Expand Down

0 comments on commit f2c8985

Please sign in to comment.