Should you be able to override coding standards locally?

And why am I even asking this question?

Joel Clermont
Joel Clermont
2023-11-29

PHP Coding Standards Fixer recommends creating your project configuration file with the name .php-cs-fixer.dist.php and then adding .php-cs-fixer.php to the .gitignore file, so you can override the project configuration locally.

I'm not quite sure the rationale behind this recommendation. Coding standards are meant to be consistent for all developers on a project, so why would you want to override this locally?

We made the decision to not follow this recommendation, so instead we have a .php-cs-fixer.php file in our project root, and we don't add it to .gitignore. It's a tracked file and makes sure all developers have the same coding standards applied universally.

Why do I bring any of this up? It's a good example of reading the docs, understanding what a project recommends, but ultimately deciding for yourself how you want to use a tool in your development team.

Here to help,

Joel

P.S. Enforcing a coding standard is a great way to avoid a lot of needless debate on a team. Need help getting this setup on your project?

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼

Level up your Laravel skills!

Each 2-minute email has real-world advice you can use.