composer.json - Explicitly set target PHP platform
Overview
--------
This refines the way in which `composer` resolves dependencies - so as to
prefer packages that are compatible with Civi's declared minimum requirement.
https://blog.martinhujer.cz/17-tips-for-using-composer-efficiently/#tip-%2315%3A-specify-the-production-php-version-in-%60composer.json%60
Before
------
Suppose that:
* The current minimum declared is PHP 7.0. (That happens to be the case at time of writing.)
* You locally use PHP 7.4.
* You wish to add or update a package.
`composer` may grab a version of a package that works on PHP 7.4 -- but is
not available/compatible with PHP 7.0. Then you start developing things under
the false expectation that the library will be usable -- and only discover the
problem later.
After
-----
`composer` should grab packages that are compatible with the declared PHP version,
regardless of the local PHP version.
Comment
-------
* This is orthogonal to the question of *which* PHP version should be the
platform for CiviCRM -- whatever version that is, this dynamic can play out.
The patch doesn't change that.
* The value will undoubtedly change over time, which has a small maintenance
issue to keep the PHP constants in sync with the composer metadata.
KISS solution: add a comment!