Skip to content

Commit b80cc7e

Browse files
committed
devenv: add php-cs-fixer config
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent 0aa68ee commit b80cc7e

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

.php-cs-fixer.dist.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__)
5+
->name('*.php');
6+
7+
return (new PhpCsFixer\Config())
8+
->setRules([
9+
'@PSR12' => true,
10+
'array_syntax' => ['syntax' => 'short'],
11+
])
12+
->setFinder($finder);

devenv.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66
{
77
# https://devenv.sh/git-hooks/
88
git-hooks.hooks = {
9+
php-cs-fixer = {
10+
enable = true;
11+
entry = pkgs.lib.mkForce "${pkgs.phpPackages."php-cs-fixer"}/bin/php-cs-fixer fix";
12+
args = [
13+
"--config"
14+
"./.php-cs-fixer.dist.php"
15+
];
16+
language = "system";
17+
pass_filenames = true;
18+
require_serial = true;
19+
stages = [ "pre-commit" ];
20+
types = [ "php" ];
21+
};
22+
923
# Custom pre-commit hook to format justfile
1024
qmlformat = {
1125
enable = true;

0 commit comments

Comments
 (0)