From eeb6da3eea3481c796c3041d44522fd9f5c777cc Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 13 May 2021 20:36:44 +0200 Subject: [PATCH] Add friendicaci/php-cs image --- php-cs/Dockerfile | 9 +++++++++ php-cs/check-php-cs.sh | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 php-cs/Dockerfile create mode 100755 php-cs/check-php-cs.sh diff --git a/php-cs/Dockerfile b/php-cs/Dockerfile new file mode 100644 index 0000000..ef9bdcd --- /dev/null +++ b/php-cs/Dockerfile @@ -0,0 +1,9 @@ +FROM php:7.2 + +RUN apt-get update -q && \ + DEBIAN_FRONTEND=noninteractive apt-get install -q -y \ + git \ + && apt-get clean \ + && rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* + +COPY check-php-cs.sh /check-php-cs.sh diff --git a/php-cs/check-php-cs.sh b/php-cs/check-php-cs.sh new file mode 100755 index 0000000..b3d2869 --- /dev/null +++ b/php-cs/check-php-cs.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# +# Checks the PHP CS syntax +# +if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php_cs(\\.dist)?|composer\\.lock)$"; then + EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); +else + EXTRA_ARGS=''; +fi + +./bin/dev/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --diff --diff-format=udiff --dry-run --using-cache=no ${EXTRA_ARGS}