Skip to content

Commit

Permalink
Merge pull request #66 from jyggen/master
Browse files Browse the repository at this point in the history
Add compatibility with phpunit/php-timer 2.x
  • Loading branch information
povils committed Feb 16, 2018
2 parents e64fad5 + 411a303 commit 05fb7ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -18,10 +18,10 @@
"symfony/finder": "^2.2 || ^3.0 || ^4.0",
"nikic/php-parser": "^3.0",
"jakub-onderka/php-console-highlighter": "^0.3.2",
"phpunit/php-timer": "^1.0"
"phpunit/php-timer": "^1.0 || ^2.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^6.0",
"phpunit/phpunit": "^5.7 || ^6.0 || ^7.0",
"squizlabs/php_codesniffer": "^2.8.1"
},
"autoload": {
Expand Down
8 changes: 7 additions & 1 deletion src/Console/Command.php
Expand Up @@ -8,6 +8,7 @@
use Povils\PHPMND\HintList;
use Povils\PHPMND\PHPFinder;
use Povils\PHPMND\Printer;
use SebastianBergmann\Timer\Timer;
use Symfony\Component\Console\Command\Command as BaseCommand;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputArgument;
Expand Down Expand Up @@ -162,7 +163,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($output->getVerbosity() !== OutputInterface::VERBOSITY_QUIET) {
$output->writeln('');
$printer->printData($output, $fileReportList, $hintList);
$output->writeln('<info>' . \PHP_Timer::resourceUsage() . '</info>');

$resourceUsage = class_exists(Timer::class)
? Timer::resourceUsage()
: \PHP_Timer::resourceUsage();

$output->writeln('<info>' . $resourceUsage . '</info>');
}

if ($input->getOption('non-zero-exit-on-violation') && $fileReportList->hasMagicNumbers()) {
Expand Down

0 comments on commit 05fb7ca

Please sign in to comment.