If you need any help, don't hesitate to ask the community on Gitter.
A fixer is a class that tries to fix one code style issue (a Fixer
class
must implement FixerInterface
).
A config knows about the code style rules and the files and directories that must be scanned by the tool when run in the directory of your project. It is useful for projects that follow a well-known directory structures (like for Symfony projects for instance).
master
in other cases (new feature, deprecation, or backwards compatibility breaking changes). Note that most of the time, master
represents the next minor release of PHP CS Fixer, so Pull Requests that break backwards compatibility might be postponed.composer install
.feature-foo
or bugfix-bar
../dev-tools/check_file_permissions.sh
../dev-tools/check_trailing_spaces.sh
.php dev-tools/doc.php
. This requires the highest version of PHP supported by PHP CS Fixer. If it is not installed on your system, you can run it in a Docker container instead: docker run -it --rm --user="$(id -u):$(id -g)" -w="/app" --volume="$(pwd):/app" php:7.4-cli php dev-tools/doc.php
.dev-tools/install.sh
php -d memory_limit=256M dev-tools/vendor/bin/phpstan analyse
vendor/bin/phpunit
.php php-cs-fixer fix
.This project provides a Docker setup that allows working on it using any of the supported PHP versions.
To use it, you first need to install:
Make sure the versions installed support Compose file format 3.8.
Next, copy docker-compose.override.yaml.dist
to docker-compose.override.yaml
and edit it to your needs. The relevant parameters that might require some tweaking have comments to help you.
You can then build the images:
docker-compose build --parallel
Now you can run commands needed to work on the project. For example, say you want to run PHPUnit tests on PHP 7.4:
docker-compose run php-7.4 vendor/bin/phpunit
Sometimes it can be more convenient to have a shell inside the container:
docker-compose run php-7.4 sh
/app vendor/bin/phpunit
The images come with an xdebug
script that allows running any PHP command with
Xdebug enabled to help debug problems.
docker-compose run php-7.4 xdebug vendor/bin/phpunit
If you're using PhpStorm, you need to create a server with a
name that matches the PHP_IDE_CONFIG
environment variable defined in the Docker Compose configuration files, which is
php-cs-fixer
by default.
All images use port 9003 for debug connections.
You can do some things to increase the chance that your Pull Request is accepted the first time:
There is a cookbook with basic instructions on how to build a new fixer. Consider reading it before opening a PR.