Skip to content

Commit ef6c17d

Browse files
committed
feat: institutionalize PHPStan pre-push hook via composer scripts
1 parent 5d4ada9 commit ef6c17d

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

.githooks/pre-push

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
# Prevent direct pushes to the 'main' branch to enforce PRs against upstream.
3+
4+
# Run TDD tests via Docker (Codeception) before pushing any branch
5+
echo "Running PHPStan analysis..."
6+
docker compose exec -T php vendor/bin/phpstan analyse
7+
if [ $? -ne 0 ]; then
8+
echo "🚨 PHPStan failed! Please fix errors before pushing."
9+
exit 1
10+
fi
11+
12+
exit 0

composer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@
119119
]
120120
}
121121
},
122+
"scripts": {
123+
"post-install-cmd": [
124+
"git config core.hooksPath .githooks || true"
125+
],
126+
"post-update-cmd": [
127+
"git config core.hooksPath .githooks || true"
128+
]
129+
},
122130
"repositories": [
123131
{
124132
"type": "composer",

0 commit comments

Comments
 (0)