Skip to content

Commit

Permalink
[DX] Hide console output in tests (#2018)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba authored Apr 7, 2022
1 parent 5eb84d5 commit 0a6b3b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -562,3 +562,6 @@ parameters:
- '#Add explicit array type to assigned "\$spreadParams" expression#'

- '#foreach\(\), while\(\), for\(\) or if\(\) cannot contain a complex expression\. Extract it to a new variable on a line before#'

# false positive
- '#Method Rector\\Php71\\Rector\\FuncCall\\RemoveExtraParametersRector\:\:resolveMaximumAllowedParameterCount\(\) should return int but returns int<0, max>\|false#'
12 changes: 12 additions & 0 deletions src/Console/Style/RectorConsoleOutputStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use OndraM\CiDetector\CiDetector;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

final class RectorConsoleOutputStyle extends SymfonyStyle
Expand All @@ -18,6 +20,16 @@ final class RectorConsoleOutputStyle extends SymfonyStyle

private bool|null $isCiDetected = null;

public function __construct(InputInterface $input, OutputInterface $output)
{
parent::__construct($input, $output);

// silent output in tests
if (defined('PHPUNIT_COMPOSER_INSTALL')) {
$this->setVerbosity(OutputInterface::VERBOSITY_QUIET);
}
}

/**
* @see https://github.com/phpstan/phpstan-src/commit/0993d180e5a15a17631d525909356081be59ffeb
*/
Expand Down

0 comments on commit 0a6b3b3

Please sign in to comment.