Skip to content

Commit

Permalink
Use branch-specific cache file for PHP-CS-Fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 18, 2023
1 parent 6d7416d commit 5bb4a31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# PHP-CS-Fixer
/.php-cs-fixer.php
/.php-cs-fixer.cache
/.php-cs-fixer.cache*

# Psalm
/.psalm/cache
Expand Down
6 changes: 6 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,10 @@
'whitespace_after_comma_in_array' => true,
]);

$branch = @trim((string) @shell_exec('git rev-parse --abbrev-ref HEAD'));

if (!empty($branch)) {
$config->setCacheFile(__DIR__ . '/.php-cs-fixer.cache.' . $branch);
}

return $config;

0 comments on commit 5bb4a31

Please sign in to comment.