-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated item to use ItemInterface * Fix style * Update readme * added more ignore path * fixes from php cs-fixer * added cs fixer * Update config * update from cs fixer * Styles and files * Added new rules * Added ItemInterface * Apply diff from styleCI * More fixes * Fix style * Update types * Fix docblock
- Loading branch information
Showing
15 changed files
with
368 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ composer.phar | |
composer.lock | ||
priv-test.php | ||
.idea | ||
.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: '2' | ||
|
||
services: # sorted alphabetically | ||
csfixer: | ||
build: ./docker/csfixer | ||
image: docker.lenius.dk/csfixer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM php:7.2-fpm | ||
|
||
RUN apt-get update && \ | ||
apt-get install git libpq-dev libldap2-dev zlib1g-dev libcurl4-gnutls-dev libicu-dev libmcrypt-dev libxml2-dev g++ -y && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \ | ||
docker-php-ext-install -j$(nproc) zip ldap intl curl pdo pdo_mysql pdo_pgsql pgsql bcmath soap zip sockets && \ | ||
pecl install redis apcu && \ | ||
docker-php-ext-enable redis apcu | ||
|
||
# Unzip is required for composer. | ||
RUN apt-get update && apt-get install -y unzip | ||
|
||
# Install composer | ||
ADD https://getcomposer.org/installer /composer-setup.php | ||
|
||
RUN php /composer-setup.php \ | ||
--install-dir=/usr/local/bin/ \ | ||
--filename=composer \ | ||
&& rm /composer-setup.php | ||
|
||
# Allow Composer to be run as root. | ||
ENV COMPOSER_ALLOW_SUPERUSER 1 | ||
|
||
ENV PATH="~/.composer/vendor/bin:${PATH}" | ||
|
||
RUN composer global require friendsofphp/php-cs-fixer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash -e | ||
|
||
# Directory or file - Should be relative path | ||
PROJECT_PATH="${1}" | ||
|
||
# Default | ||
if [[ ${PROJECT_PATH} = "" ]]; then | ||
|
||
DEFAULT_DIRS=(src tests) | ||
|
||
echo "Running $0 on default directories: ${DEFAULT_DIRS[@]}" | ||
|
||
for dir_to_check in "${DEFAULT_DIRS[@]}"; do | ||
$0 "${dir_to_check}" | ||
done | ||
|
||
exit 0 | ||
fi | ||
|
||
# Sanity check | ||
if [[ ! -e ${PROJECT_PATH} ]]; then | ||
echo "Doesn't seem to exist: ${PROJECT_PATH}" >&2 | ||
exit 1 | ||
fi | ||
|
||
PROJECT_DIR=${PROJECT_PATH} | ||
|
||
if [[ -f ${PROJECT_PATH} ]]; then | ||
PROJECT_DIR=$(dirname ${PROJECT_PATH}) | ||
fi | ||
|
||
echo "Fixing: ${PROJECT_PATH}" | ||
|
||
docker run \ | ||
--rm \ | ||
-v "$(pwd)/${PROJECT_DIR}":/source/${PROJECT_DIR} \ | ||
docker.lenius.dk/csfixer \ | ||
/root/.composer/vendor/bin/php-cs-fixer \ | ||
--verbose \ | ||
--using-cache=yes \ | ||
--cache-file=/source/${PROJECT_DIR}/.php_cs.cache \ | ||
--rules=' | ||
{ | ||
"@PSR2": true, | ||
"array_indentation": true, | ||
"binary_operator_spaces": { | ||
"operators": {"=>": "align_single_space"} | ||
}, | ||
"blank_line_after_opening_tag": false, | ||
"blank_line_before_statement": {"statements": ["do", "for", "foreach", "if", "switch", "throw", "while", "return"]}, | ||
"concat_space": {"spacing": "one"}, | ||
"no_blank_lines_after_phpdoc": false, | ||
"no_blank_lines_after_class_opening": true, | ||
"no_whitespace_in_blank_line": true, | ||
"no_trailing_comma_in_singleline_array": true, | ||
"no_trailing_comma_in_list_call": true, | ||
"no_extra_blank_lines": true, | ||
"no_empty_phpdoc": true, | ||
"no_unused_imports": true, | ||
"method_argument_space": true, | ||
"method_separation": true, | ||
"phpdoc_indent": true, | ||
"phpdoc_scalar": true, | ||
"phpdoc_order": true, | ||
"phpdoc_align": true, | ||
"phpdoc_separation": true, | ||
"phpdoc_inline_tag": true, | ||
"phpdoc_no_access": true, | ||
"phpdoc_no_package": true, | ||
"phpdoc_separation": true, | ||
"phpdoc_summary": true, | ||
"phpdoc_to_comment": true, | ||
"phpdoc_trim": true, | ||
"phpdoc_order": true, | ||
"single_quote": {"strings_containing_single_quote_chars": true}, | ||
"whitespace_after_comma_in_array": true, | ||
"concat_space": { | ||
"spacing": "none" | ||
} | ||
}' \ | ||
fix /source/${PROJECT_PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.