#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

PHP_CS_FIXER=vendor/bin/php-cs-fixer

FILES=$(git diff --name-only --cached --diff-filter=d | grep -E '\.(php)$'  | tr '\n' ' ')
if [ -z "$FILES" ]
then
    echo "php files not found."
elif [ -f "$PHP_CS_FIXER" ]; then
    $PHP_CS_FIXER fix --config=.php-cs-fixer.dist.php ${FILES}
    git add ${FILES}
fi
