Formatter

Introduction

PXP tries to maintain compatibility with existing tooling by providing plugins or extensions to support the new language syntax. Sometimes this is not feasible since tools do not offer a public API for changing how things are parsed or tokenised.

One of the tools where this is the case is PHP-CS-Fixer, arguably the most popular code formatting tool for PHP.

Code formatting is a complex task and there are lots of opinions surrounding the "right" way of formatting your code. Inspired by the Python formatter psf/black, PXP's formatter for PHP and PXP code takes away most of that control and enforces a particular code style.

The code style that it enforces follows PER-1 very closely.

If you've got PXP installed and want to give the formatter a go, run pxp fmt in the root of your project and git diff the changes it makes.