Introducing php-cs-fixer


Welcome php-cs-fixer!

We constantly try to push ownCloud's quality further - besides all heavy lifting in the area of test automation (we will most likely blog about this soon-ish) also coding style is a measurement of quality.

For a project of the size of ownCloud with many developers working on the code base a minimum of common coding styles is required to have as little interruptions when reading code.

The general coding styles have been written down long time back and are still valid as of today.

But we want to push our selves a bit further and therefore decided to introduce

For now this is only relevant for the code repo but we will slowly introduce this to all repos in the ownCloud organization on GitHub.

How to use it

php-cs-fixer is installed via composer as dev dependency. As soon as you run make it'll be installed and is ready to be used.

In order to find out if the code is compliant to the selected rules (see below about rules) just run

$ make test-php-style

This will run php-cs-fixer in dry run mode which will not change the code. Given the output you shall adopt the code to make php-cs-fixer happy.

Our CI system will also run this command on each and every pull request (build in general) to ensure that the code standards are properly applied.


php-cs-fixer as a great variety of rules. We will slowly introduce rules one by one.

We just started with the native_function_invocation rule which will force us to use a backslash before each and every native function. This can have a performance impact - for more details see blogs like

More rules will be added - so watch out your pull request status :wink: