What you could try is the following:
get last commit id: (How to get the last commit ID of a remote repo using curl-like command?)
git log --format="%H" -n 1
Then get files in last commit: (How to list all the files in a commit?)
git diff-tree --no-commit-id --name-only -r `git log --format="%H" -n 1`
You can see that previous command is used here. The first part before backtits needs a commit id to list files from. This commit id is found with the first command.
And then if you want only php files you can use grep :
git diff-tree --no-commit-id --name-only -r `git log --format="%H" -n 1` | grep .php
Output on one of my php project:
app/Http/Controllers/BarterController.php
app/Http/Controllers/HomeController.php
app/Talk.php
resources/views/profiles/index.blade.php
resources/views/talks/show-comments.blade.php
Simply replace your command $(find ./ -name '*.php')
with the one I gave above and it should work. Your command would become the following:
phpcs --standard=PSR2 $(git diff-tree --no-commit-id --name-only -r `git log --format="%H" -n 1` | grep .php)