swaggest / php-json-schema

High definition PHP structures with JSON-schema based validation
MIT License
446 stars 50 forks source link

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.1.0" #135

Closed massadm closed 3 years ago

massadm commented 3 years ago

Just composer require "swaggest/json-schema" for new project and got %subj%.

Looked at what changed https://github.com/swaggest/php-json-schema/compare/v0.12.38...v0.12.39 and found out that added "Polyfill dependency for mbstring extension".

Do these directives in the package.json reflect your true intent?

  "require": {
    "symfony/polyfill-mbstring": "^1.19"
  },
  "suggest": {
    "ext-mbstring": "For better performance"
  }

I'm asking because the requirements have changed significantly with introduction of symfony/polyfill-mbstring package.

        {
            "name": "symfony/polyfill-mbstring",
            "version": "v1.23.1",

            "require": {
                "php": ">=7.1"
            },

Thanks!

vearutop commented 3 years ago

Hi, I think this is fine.

https://github.com/symfony/polyfill-mbstring/blob/v1.19.0/composer.json#L19

This lib requires PHP 5.3 at the minimal version used in composer.json (1.19). So I think composer should be able to find a version of the lib to match PHP version (use older lib for older PHP, newer lib for newer PHP).

Do you have particular issue with dependency graph resolving (e. g. unable to build lock file with older PHP)?

vearutop commented 3 years ago

Could you share your composer.json to reproduce the issue?

massadm commented 3 years ago

I think composer should be able to find a version of the lib to match PHP version (use older lib for older PHP, newer lib for newer PHP).

I see. composer require "swaggest/json-schema" installing symfony/polyfill-mbstring v1.19.0 under PHP 5.6.33 (cli) and v1.23.1 under PHP 7.1.14 (cli). Something tells me that I'm not the only one who might stumble on this. :-)

vearutop commented 3 years ago

Maybe you can help the issue by explicitly setting target PHP version like here: https://github.com/swaggest/php-json-schema/blob/v0.12.39/composer.json#L38.

massadm commented 3 years ago

That works! Thanks for the clarification!