Add php-cs-fixer as a commit hook
This commit is contained in:
parent
5a1207271e
commit
c4b18d1d1e
5 changed files with 55 additions and 25 deletions
51
.hooks/pre-commit
Executable file
51
.hooks/pre-commit
Executable file
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to verify what is about to be committed.
|
||||||
|
# Called by "git commit" with no arguments. The hook should
|
||||||
|
# exit with non-zero status after issuing an appropriate message if
|
||||||
|
# it wants to stop the commit.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "pre-commit".
|
||||||
|
|
||||||
|
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
against=HEAD
|
||||||
|
else
|
||||||
|
# Initial commit: diff against an empty tree object
|
||||||
|
against=$(git hash-object -t tree /dev/null)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# If you want to allow non-ASCII filenames set this variable to true.
|
||||||
|
allownonascii=$(git config --bool hooks.allownonascii)
|
||||||
|
|
||||||
|
# Redirect output to stderr.
|
||||||
|
exec 1>&2
|
||||||
|
|
||||||
|
# PHP CS Fix.
|
||||||
|
php-cs-fixer fix
|
||||||
|
|
||||||
|
# Cross platform projects tend to avoid non-ASCII filenames; prevent
|
||||||
|
# them from being added to the repository. We exploit the fact that the
|
||||||
|
# printable range starts at the space character and ends with tilde.
|
||||||
|
if [ "$allownonascii" != "true" ] &&
|
||||||
|
# Note that the use of brackets around a tr range is ok here, (it's
|
||||||
|
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
||||||
|
# the square bracket bytes happen to fall in the designated range.
|
||||||
|
test $(git diff --cached --name-only --diff-filter=A -z $against |
|
||||||
|
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
|
||||||
|
then
|
||||||
|
cat <<\EOF
|
||||||
|
Error: Attempt to add a non-ASCII file name.
|
||||||
|
|
||||||
|
This can cause problems if you want to work with people on other platforms.
|
||||||
|
|
||||||
|
To be portable it is advisable to rename the file.
|
||||||
|
|
||||||
|
If you know what you are doing you can disable this check using:
|
||||||
|
|
||||||
|
git config hooks.allownonascii true
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
2
Makefile
Normal file
2
Makefile
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
install-hooks:
|
||||||
|
cp -v .hooks/* .git/hooks/
|
||||||
|
|
@ -19,8 +19,6 @@ class Filter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $orderDirection
|
|
||||||
*
|
|
||||||
* @throws FilterDecodeException
|
* @throws FilterDecodeException
|
||||||
*
|
*
|
||||||
* @return Filter
|
* @return Filter
|
||||||
|
|
@ -74,8 +72,6 @@ class Filter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $limit
|
|
||||||
*
|
|
||||||
* @return Filter
|
* @return Filter
|
||||||
*/
|
*/
|
||||||
public function setLimit($limit): self
|
public function setLimit($limit): self
|
||||||
|
|
@ -91,8 +87,6 @@ class Filter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $offset
|
|
||||||
*
|
|
||||||
* @return Filter
|
* @return Filter
|
||||||
*/
|
*/
|
||||||
public function setOffset($offset): self
|
public function setOffset($offset): self
|
||||||
|
|
@ -108,8 +102,6 @@ class Filter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $wheres
|
|
||||||
*
|
|
||||||
* @return Filter
|
* @return Filter
|
||||||
*/
|
*/
|
||||||
public function setWheres($wheres): self
|
public function setWheres($wheres): self
|
||||||
|
|
@ -125,8 +117,6 @@ class Filter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $order
|
|
||||||
*
|
|
||||||
* @return Filter
|
* @return Filter
|
||||||
*/
|
*/
|
||||||
public function setOrder($order): self
|
public function setOrder($order): self
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@ use Monolog\Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A wrapper around \Redis for my own sanity.
|
* A wrapper around \Redis for my own sanity.
|
||||||
*
|
|
||||||
* @package Benzine\Redis
|
|
||||||
*/
|
*/
|
||||||
class Redis
|
class Redis
|
||||||
{
|
{
|
||||||
|
|
@ -35,7 +33,7 @@ class Redis
|
||||||
{
|
{
|
||||||
$this->runBeforeRedisCommand();
|
$this->runBeforeRedisCommand();
|
||||||
|
|
||||||
if(method_exists($this->redis, $name)){
|
if (method_exists($this->redis, $name)) {
|
||||||
return call_user_func_array([$this->redis, $name], $arguments);
|
return call_user_func_array([$this->redis, $name], $arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,21 +48,16 @@ class Redis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Redis
|
|
||||||
*/
|
|
||||||
public function getUnderlyingRedis(): \Redis
|
public function getUnderlyingRedis(): \Redis
|
||||||
{
|
{
|
||||||
return $this->redis;
|
return $this->redis;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Logger
|
|
||||||
*/
|
|
||||||
public function getLogger(): Logger
|
public function getLogger(): Logger
|
||||||
{
|
{
|
||||||
return $this->logger;
|
return $this->logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAvailable(): bool
|
public function isAvailable(): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,6 @@ class Route
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $propertyOptions
|
|
||||||
*
|
|
||||||
* @return Route
|
* @return Route
|
||||||
*/
|
*/
|
||||||
public function setPropertyOptions($propertyOptions)
|
public function setPropertyOptions($propertyOptions)
|
||||||
|
|
@ -330,8 +328,6 @@ class Route
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $exampleEntity
|
|
||||||
*
|
|
||||||
* @return Route
|
* @return Route
|
||||||
*/
|
*/
|
||||||
public function setExampleEntity($exampleEntity)
|
public function setExampleEntity($exampleEntity)
|
||||||
|
|
@ -347,8 +343,6 @@ class Route
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $exampleEntityFinderFunction
|
|
||||||
*
|
|
||||||
* @return Route
|
* @return Route
|
||||||
*/
|
*/
|
||||||
public function setExampleEntityFinderFunction($exampleEntityFinderFunction)
|
public function setExampleEntityFinderFunction($exampleEntityFinderFunction)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue