/docker-php-code-fixer

Docker image for wapmorgan/PhpCodeFixer

Primary LanguageShell

version php Lines

docker-php-code-fixer

Docker container for wapmorgan/PhpCodeFixer.

Version of this repository, and docker images on dockerhub, follow wapmorgan/PhpCodeFixer versions.

If some fixes has to be made on this repository, we will add a 4th level in version, like 2.0.23.1.

Installation

You don't need to install this repository, use the Docker image directly.

Usage

Locally with Docker

Create bin/phpcf:

#!/usr/bin/env sh

set -e

if [ $(which docker || false) ]; then
    readonly PROJECT_DIRECTORY="$(realpath $(dirname $(realpath $0))/..)"
    docker \
        run \
        --rm \
        -it \
        -v ${PROJECT_DIRECTORY}:/app:ro \
        -w /app \
        steevanb/php-code-fixer:2.0.23 \
        bin/phpcf
else
    phpcf --exclude=/vendor/ .
fi

Integration with CircleCI

Add phpcf in .circleci/config.yml:

version: '2.1'

jobs:
    phpcf:
        docker:
            - image: steevanb/php-code-fixer:2.0.23
        working_directory: /app
        steps:
            - checkout
            - run:
                  name: phpcf
                  command: bin/phpcf

workflows:
    version: '2.1'
    Code quality:
        jobs:
            - phpcf