Skip to content

Commit 156dfbc

Browse files
committed
Revert "Fix exit code when phpcbf is processing STDIN"
This reverts commit 4f225c4.
1 parent 7bfebcc commit 156dfbc

2 files changed

Lines changed: 19 additions & 30 deletions

File tree

src/Files/File.php

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,22 @@ class File
153153
protected $warningCount = 0;
154154

155155
/**
156-
* The original total number of errors and warnings (first run on a file).
156+
* The original total number of errors that can be fixed (first run on a file).
157157
*
158158
* {@internal This should be regarded as an immutable property.}
159159
*
160-
* @var array<string, int>
160+
* @var integer
161+
*/
162+
private $fixableErrorCountFirstRun;
163+
164+
/**
165+
* The original total number of warnings that can be fixed (first run on a file).
166+
*
167+
* {@internal This should be regarded as an immutable property.}
168+
*
169+
* @var integer
161170
*/
162-
private $firstRunCounts;
171+
private $fixableWarningCountFirstRun;
163172

164173
/**
165174
* The current total number of errors that can be fixed.
@@ -546,18 +555,14 @@ public function process()
546555
StatusWriter::write('*** END SNIFF PROCESSING REPORT ***', 1);
547556
}
548557

549-
if (isset($this->firstRunCounts) === false) {
550-
$this->firstRunCounts = [
551-
'error' => $this->errorCount,
552-
'warning' => $this->warningCount,
553-
'fixableError' => $this->fixableErrorCount,
554-
'fixableWarning' => $this->fixableWarningCount,
555-
];
558+
if (isset($this->fixableErrorCountFirstRun, $this->fixableWarningCountFirstRun) === false) {
559+
$this->fixableErrorCountFirstRun = $this->fixableErrorCount;
560+
$this->fixableWarningCountFirstRun = $this->fixableWarningCount;
556561
}
557562

558563
$this->fixedCount += $this->fixer->getFixCount();
559-
$this->fixedErrorCount = ($this->firstRunCounts['fixableError'] - $this->fixableErrorCount);
560-
$this->fixedWarningCount = ($this->firstRunCounts['fixableWarning'] - $this->fixableWarningCount);
564+
$this->fixedErrorCount = ($this->fixableErrorCountFirstRun - $this->fixableErrorCount);
565+
$this->fixedWarningCount = ($this->fixableWarningCountFirstRun - $this->fixableWarningCount);
561566

562567
}//end process()
563568

@@ -1212,22 +1217,6 @@ public function getFixedWarningCount()
12121217
}//end getFixedWarningCount()
12131218

12141219

1215-
/**
1216-
* Retrieve information about the first run.
1217-
*
1218-
* @param $type string
1219-
*
1220-
* @internal This method does not form part of any public API nor backwards compatibility guarantee.
1221-
*
1222-
* @return int
1223-
*/
1224-
public function getFirstRunCount(string $type):int
1225-
{
1226-
return $this->firstRunCounts[$type];
1227-
1228-
}//end getFirstRunCount()
1229-
1230-
12311220
/**
12321221
* Returns the list of ignored lines.
12331222
*

src/Reports/Cbf.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ public function __construct()
276276
};
277277

278278
$reporter->totalFiles = 1;
279-
$reporter->totalErrors = $phpcsFile->getFirstRunCount('error');
280-
$reporter->totalWarnings = $phpcsFile->getFirstRunCount('warning');
279+
$reporter->totalErrors = $phpcsFile->getErrorCount();
280+
$reporter->totalWarnings = $phpcsFile->getWarningCount();
281281
$reporter->totalFixableErrors = $phpcsFile->getFixableErrorCount();
282282
$reporter->totalFixableWarnings = $phpcsFile->getFixableWarningCount();
283283
$reporter->totalFixedErrors = $phpcsFile->getFixedErrorCount();

0 commit comments

Comments
 (0)