#!/bin/sh
set -eu

STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.php$' || true)

if [ -z "$STAGED_FILES" ]; then
    echo "No PHP files staged, skipping checks."
    exit 0
fi

composer phpcs $STAGED_FILES
composer phpstan-githook $STAGED_FILES
