Skip to content

Instantly share code, notes, and snippets.

@diaolizhi
diaolizhi / gist:67588a6be3d96b316fc0fb7d177b2dd2
Created November 9, 2021 12:13 — forked from codemis/gist:8225337
A Git pre-commit hook for validating code follows PHP's Fig Coding Standard. The script requires PEAR's Code Sniffer library. Change the variables to fit your project code structure. Just drop this file in your .git/hooks/ directory. This script is a modified file created by Soenke Ruempler.
#!/bin/bash
# PHP CodeSniffer pre-commit hook for git
#
# @author Soenke Ruempler <soenke@ruempler.eu>
# @author Sebastian Kaspari <s.kaspari@googlemail.com>
#
# see the README
PHPCS_BIN=/usr/local/bin/phpcs
PHPCS_CODING_STANDARD=PSR2