Why would a developer commit a .dist file instead of the actual file?
For example: https://github.com/FriendsOfPHP/PHP-CS-Fixer
.php_cs.dist
phpunit.xml.dist
https://github.com/symfony/symfony
.php_cs.dist
phpunit.xml.dist
Why are .php_cs
and phpunit.xml
committed as .dist
files?
Code formatting rules are in .php_cs.dist
and if every contributor should follow the same rules why .dist
file?
Update
Reasoning behind parameter.yml.dist
is obvious but why in particular .php_cs
is not committed? Why somebody would change the .php_cs
which contains code formatting rules? isn't the whole point of .php_cs
that every contributor use same rules to format their code?
Please reply regards to only these two files.
You can see .dist
files as template files. On your specific distribution, the configuration might be slightly different. Using the dist files, you can simply copy them to e.g. phpunit.xml
and tweak it to fit your needs. (e.g. set some specific ENV variables or the like).
Little side-note: Another common dist file in Symfony projects is
app/config/parameters.yml.dist
I found my answer here: https://github.com/symfony/recipes/issues/41
the difference is that PHPUnit will load the phpunit.xml.dist file if phpunit.xml does not exist. So you don't need to copy it unless you want to do special stuff. So committing a phpunit.xml.dist in the repo (and adding phpunit.xml in the gitignore) is just about following the PHPUnit best practice
The reason behind .dist file for those specific files is phpunit and php-cs-fixer use .dist file in absence of the local file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With