Open dalepgrant opened 10 months ago
🤔 interesting!
I have a few initial concerns:
8.4.yml
file right?But on the other hand, requiring no code changes for people running Trellis projects is a benefit too and that's probably your main reason for proposing this change.
Say for example 8.4 required a new package, then we'd have to include 8.4.yml file right?
Correct. As it stands though, we have to add a 8.4.yml file even if there are no package changes.
it might be less obvious when Trellis "officially" supports a new PHP version since there'd be code changes
A suitable PR (and changelog entry) can still change the 'out of the box' php version to highlight official support, like #1484. We could also add a line to the readme and/or the docs stating something along the lines of "Trellis officially supports PHP 7.4 - 8.2, more recent versions may also work but have not yet been tested by the community."
Edit to add - thanks for reviewing!
Refactors php version vars to be dynamic by default whilst allowing overrides.
Motivation
The current approach requires a file to be duplicated and renamed for every php version release. At time of writing, the contents of said files covering 7.4 - 8.2 (4 files total) are identical, except for the php version number itself. ~To add support for php 8.3, a fifth file would need to be added.~ Edit to add: since #1514, this fifth file has now been added.
Proposal
By making the default file dynamic, we can avoid duplicating files each time a new php version is released. If something changes from one release to the next, an override file can be created using the php version as the filename (i.e. we can fallback to the existing method).
Considerations
I initially started to put these vars in the
php/defaults/main.yml
file, as these are essentially defaults. However, ultimately I settled onphp/vars/version-specific-defaults.yml
which a) is closer to what developers are currently familiar with, b) separates php version specific defaults from other defaults and c) allows for easy duplicate & rename to override.I've only tested this on local so far and everything provisions as expected using php 8.3.
Comments have been written with ~8.1~ 8.2 as that is the current default version for Trellis.