composer.json - Explicitly set target PHP platform
authorTim Otten <totten@civicrm.org>
Wed, 29 Jan 2020 20:12:47 +0000 (12:12 -0800)
committerTim Otten <totten@civicrm.org>
Wed, 29 Jan 2020 20:24:23 +0000 (12:24 -0800)
commitdc3ace931406f85b3c3349100fb0ce8a9944da6a
treee3ec61eb3704ec1d0653d27c2b4798471677b874
parent395bc78b3796993371e2b04210d864469110ccf4
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!
CRM/Upgrade/Form.php
composer.json
composer.lock