Skip to content

Commit

Permalink
Swap to pint
Browse files Browse the repository at this point in the history
  • Loading branch information
dbhynds committed Dec 15, 2023
1 parent 589c900 commit 8f60219
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 29 deletions.
10 changes: 5 additions & 5 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ function lint_php {
return 0 # There's nothing to lint.
fi

phpcsfixer="vendor/bin/php-cs-fixer"
pint="vendor/bin/pint"

if ! [ -x "$phpcsfixer" ]; then
echo -e "${C_RED}PHP-CS-Fixer is not installed. Install it with \`composer install\`.${NO_FORMAT}" && return 1
if ! [ -x "$pint" ]; then
echo -e "${C_RED}Pint is not installed. Install it with \`composer install\`.${NO_FORMAT}" && return 1
fi

php_files_arg=$(echo "$php_files" | tr '\n' ' ')

echo -e "${C_CYAN}Linting PHP-CS-Fixer...${NO_FORMAT}"
$phpcsfixer fix -q || return 1
echo -e "${C_CYAN}Linting Pint...${NO_FORMAT}"
$pint || return 1

git add $php_files_arg
}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.phpunit.result.cache
.php_cs.cache
.php-cs-fixer.cache
.pint.cache
.vscode

build
Expand Down
21 changes: 0 additions & 21 deletions .php-cs-fixer.php

This file was deleted.

6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"phpseclib/phpseclib": "^3.0"
},
"require-dev": {
"jubeki/laravel-code-style": "^2.0",
"mockery/mockery": "^1.4",
"nesbot/carbon": "^2.43",
"laravel/pint": "^1.13",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.5"
},
Expand All @@ -47,7 +47,7 @@
"phpunit",
"phpstan analyse"
],
"lint": "php-cs-fixer fix -v --dry-run",
"lint-fix": "php-cs-fixer fix -v"
"lint": "pint -v --test",
"lint-fix": "pint -v"
}
}
13 changes: 13 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"preset": "laravel",
"cache-file": ".pint.cache",
"rules": {
"not_operator_with_successor_space": false,
"class_attributes_separation": {
"elements": {
"const": "only_if_meta",
"property": "only_if_meta"
}
}
}
}

0 comments on commit 8f60219

Please sign in to comment.