composer / composer/satis

No way to respect PHP version requirements when `only-best-candidates` set to `true`

Open
#687 0 comments 1 reaction 0 assignees View on GitHub
bug feature
Dominant language
PHP
Stars
3.3k
Forks
530
Avg merge
6h 53m
Merged PRs (30d)
13

Description

**Is your feature request related to a problem? Please describe.**
It seems that there is no way to configure satis to build repository working for given PHP version if `only-best-candidates` is set to `true`.

For example if we have an environment running PHP 7.3 and we want to use `"friendsofphp/php-cs-fixer": "2.18.1"`, which is compatible with `php: ^5.6 || ^7.0 || ^8.0`, setting the flag `only-best-candidates` to `true` will cause building a repo with some of the dependencies that are compatible only with PHP 8 (for example `"symfony/string": "v6.0.2"`).

Then, if we try to use our satis repository in the application, composer will fail with the message:
![image](https://user-images.githubusercontent.com/7046294/147771293-031ef64d-5f21-4d0a-a374-b350a77f3ba0.png)

I tried to set desired environment in satis.json file `require` section, but then building fails with the message:
![image](https://user-images.githubusercontent.com/7046294/147771445-db70d60f-cadb-4087-a7ca-eb4c3db6b343.png)

**Describe the solution you'd like**
There should be possibility to define desired platform requirement.

**Describe alternatives you've considered**
Alternatively, setting the flag `only-best-candidates` to `true` should result in including best dependency candidate for each PHP version compatible with packages defined in satis.json

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.