Skip to content

Commit

Permalink
Allow phpcbf to use the cache
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed May 6, 2024
1 parent 4fd52f7 commit 5858c50
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/Files/LocalFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ public function process()
$this->fixableCount = $cache['fixableCount'];
}

if (PHP_CODESNIFFER_VERBOSITY > 0
|| (PHP_CODESNIFFER_CBF === true && empty($this->config->files) === false)
) {
if (PHP_CODESNIFFER_VERBOSITY > 0) {
echo "[loaded from cache]... ";
}

Expand Down
5 changes: 5 additions & 0 deletions src/Fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ public function startFile(File $phpcsFile)
*/
public function fixFile()
{
if ($this->currentFile === null) {
// This is a run with a cache, where we previously failed to fix the file.
return false;
}

$fixable = $this->currentFile->getFixableCount();
if ($fixable === 0) {
// Nothing to fix.
Expand Down
1 change: 0 additions & 1 deletion src/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ public function runPHPCBF()
$this->config->generator = null;
$this->config->explain = false;
$this->config->interactive = false;
$this->config->cache = false;
$this->config->showSources = false;
$this->config->recordErrors = false;
$this->config->reportFile = null;
Expand Down

0 comments on commit 5858c50

Please sign in to comment.