#!/bin/bash

# This is a PSR-2 checking example for just the code about to be committed

# Get the changes
files=$(mktemp)
diff=$(mktemp)

git diff --name-only --diff-filter=ACMR -- "*.php" $1...$2 > ${files}
git diff $1...$2 > ${diff}

# Run the phpcs report
phpcs=$(mktemp)
./vendor/bin/phpcs --file-list=${files} --parallel=2 --standard=psr2 --report=json > ${phpcs} || true

check for differences
./vendor/bin/diffFilter --phpcs ${diff} ${phpcs}
