@@ -96,17 +96,17 @@ discard block |
||
| 96 | 96 | $commonAncestorCommitInfo = $this->getMergeBaseCommit($notMergedBranchInfo['branchName'], $stableBranch); |
| 97 | 97 | $stableBranchLastCommitInfo = $this->getBranchLastCommitInfo($stableBranch); |
| 98 | 98 | |
| 99 | - if ($lrAheadCommitsCount[$stableBranch] >= (int)$this->config['threshold-commits-behind']) { |
|
| 99 | + if ($lrAheadCommitsCount[$stableBranch] >= (int) $this->config['threshold-commits-behind']) { |
|
| 100 | 100 | $failed = true; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $interval = $this->compareCommitInfosDatesDiff($commonAncestorCommitInfo, $stableBranchLastCommitInfo); |
| 104 | - if ((int)$interval->format('%r%a') >= (int)$this->config['threshold-days-behind']) { |
|
| 104 | + if ((int) $interval->format('%r%a') >= (int) $this->config['threshold-days-behind']) { |
|
| 105 | 105 | $failed = true; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | if ($failed) { |
| 109 | - $message = sprintf('The branch <fg=green>%s</> is behind <fg=green>%s</> by %s commits spread through %s days.', $notMergedBranchInfo['branchName'], $stableBranch, $lrAheadCommitsCount[$stableBranch], (int)$interval->format('%r%a')); |
|
| 109 | + $message = sprintf('The branch <fg=green>%s</> is behind <fg=green>%s</> by %s commits spread through %s days.', $notMergedBranchInfo['branchName'], $stableBranch, $lrAheadCommitsCount[$stableBranch], (int) $interval->format('%r%a')); |
|
| 110 | 110 | $message .= sprintf(' <fg=green>%s</> should update the branch %s', $notMergedBranchInfo['authorName'], $notMergedBranchInfo['branchName']); |
| 111 | 111 | throw new ExpectationFailedException($notMergedBranchInfo, $message); |
| 112 | 112 | } |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | $branchesRegex = ['^$']; |
| 280 | 280 | |
| 281 | 281 | if (is_array($this->config[$configKey]) && count($this->config[$configKey])) { |
| 282 | - $branchesRegex = array_map(function ($element) { |
|
| 283 | - return '\(^[ ]*'.$element.'$\)'; |
|
| 282 | + $branchesRegex = array_map(function($element) { |
|
| 283 | + return '\(^[ ]*' . $element . '$\)'; |
|
| 284 | 284 | }, $this->config[$configKey]); |
| 285 | 285 | } |
| 286 | 286 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | * @param \Iterator $iterator |
| 27 | 27 | * @param array $ruleNames |
| 28 | 28 | */ |
| 29 | - public function __construct(\Iterator $iterator , array $ruleNames = []) |
|
| 29 | + public function __construct(\Iterator $iterator, array $ruleNames = []) |
|
| 30 | 30 | { |
| 31 | 31 | parent::__construct($iterator); |
| 32 | 32 | $this->ruleNames = $ruleNames; |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $output->writeln(sprintf('<error>%s: KO</error>', $rule::getRuleName())); |
| 46 | 46 | |
| 47 | 47 | foreach ($e->getExpectationFailedExceptions() as $expectationFailedException) { |
| 48 | - $reason = ($expectationFailedException->getReason()) ? sprintf(' Reason: %s', $expectationFailedException->getReason()): ''; |
|
| 48 | + $reason = ($expectationFailedException->getReason()) ? sprintf(' Reason: %s', $expectationFailedException->getReason()) : ''; |
|
| 49 | 49 | $output->writeln(sprintf('<comment>Expectation failed: %s.%s</comment>', $expectationFailedException->getMessage(), $reason)); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | private static function createTestSuite($name, array $tests) |
| 100 | 100 | { |
| 101 | - $testSuite = '<h2> '.strtoupper($name).', tests: '.count($tests).' failures: '.static::sumArraysKey('failures', $tests, 'sum').', errors: '.static::sumArraysKey('errors', $tests, 'sum').', time: '.static::sumArraysKey('time', $tests).'</h2>'; |
|
| 101 | + $testSuite = '<h2> ' . strtoupper($name) . ', tests: ' . count($tests) . ' failures: ' . static::sumArraysKey('failures', $tests, 'sum') . ', errors: ' . static::sumArraysKey('errors', $tests, 'sum') . ', time: ' . static::sumArraysKey('time', $tests) . '</h2>'; |
|
| 102 | 102 | |
| 103 | 103 | $testSuite .= '<table class="testsuite"> |
| 104 | 104 | <tr> |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | if ($test['failures']['sum'] > 0) { |
| 134 | 134 | foreach ($test['failures']['list'] as $failure) { |
| 135 | 135 | $testCase .= '<tr class="failure"> |
| 136 | - <td>'.$failure['type'].'</td> |
|
| 137 | - <td>'.self::sanitizeTags($failure['message']).'</td> |
|
| 136 | + <td>'.$failure['type'] . '</td> |
|
| 137 | + <td>'.self::sanitizeTags($failure['message']) . '</td> |
|
| 138 | 138 | </tr>'; |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | if ($test['errors']['sum'] > 0) { |
| 143 | 143 | foreach ($test['errors']['list'] as $error) { |
| 144 | 144 | $testCase .= '<tr class="error"> |
| 145 | - <td>'.$error['type'].'</td> |
|
| 146 | - <td>'.self::sanitizeTags($error['message']).'</td> |
|
| 145 | + <td>'.$error['type'] . '</td> |
|
| 146 | + <td>'.self::sanitizeTags($error['message']) . '</td> |
|
| 147 | 147 | </tr>'; |
| 148 | 148 | } |
| 149 | 149 | } |