middlewares / json-exception-handler

Middleware to catch exceptions and output them as JSON
MIT License
5 stars 1 forks source link

Consider fixing failed quaili step #3

Open peter279k opened 3 years ago

peter279k commented 3 years ago

When running the Quality assurance step, it will present following error message:

You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.
No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Error: Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires wyrihaximus/json-throwable ^2.0 -> satisfiable by wyrihaximus/json-throwable[2.0.0].
    - wyrihaximus/json-throwable 2.0.0 requires php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
  Problem 2
    - middlewares/utils[v2.1.0, ..., v2.2.0] require php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
    - Root composer.json requires middlewares/utils ^2.1 -> satisfiable by middlewares/utils[v2.1.0, v2.1.1, v2.2.0].

  Problem 1
    - Root composer.json requires wyrihaximus/json-throwable ^2.0 -> satisfiable by wyrihaximus/json-throwable[2.0.0].
    - wyrihaximus/json-throwable 2.0.0 requires php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
  Problem 2
    - middlewares/utils[v2.1.0, ..., v2.2.0] require php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
    - Root composer.json requires middlewares/utils ^2.1 -> satisfiable by middlewares/utils[v2.1.0, v2.1.1, v2.2.0].

I think it should be considered.

peter279k commented 3 years ago

The problem is about the wyrihaximus/json-throwable:^2.0 version.

When upgrading the wyrihaximus/json-throwable:^3.0, it should let this package require php-7.4 version at least because the wyrihaximus/json-throwable:^3.0 requires php-7.4 version at least.

@oscarotero, do you have any idea about this?

WyriHaximus commented 3 years ago

@peter279k Or, you could go with wyrihaximus/json-throwable:^4 || ^2 and support both the currently used version and the latest version which includes PHP 8. IIRC they are compatible.

peter279k commented 3 years ago

@peter279k Or, you could go with wyrihaximus/json-throwable:^4 || ^2 and support both the currently used version and the latest version which includes PHP 8. IIRC they are compatible.

Thanks for your reply and recommendation. This issue has been resolved.

But it presents about middlewares/utils depedency:

 Problem 1
    - middlewares/utils[v2.1.0, ..., v2.2.0] require php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
    - Root composer.json requires middlewares/utils ^2.1 -> satisfiable by middlewares/utils[v2.1.0, v2.1.1, v2.2.0].
WyriHaximus commented 3 years ago

@peter279k You can do the same there, target both v2 and v3. (3.2 adds PHP 8 support.

peter279k commented 3 years ago

After upgrading the middlewares/utils to be ^2.1 || ^3.2, this will have the failed PHPUnit tests:

PHPUnit 9.5.0 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.13
Configuration: /data/json-exception-handler/phpunit.xml.dist
Warning:       XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set
Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

EEEE                                                                4 / 4 (100%)

Time: 00:00.150, Memory: 8.00 MB

There were 4 errors:

1) Middlewares\Tests\JsonExceptionHandlerTest::testMiddleware
RuntimeException: No PSR-17 factory detected to create a response

/data/json-exception-handler/vendor/middlewares/utils/src/FactoryDiscovery.php:178
/data/json-exception-handler/vendor/middlewares/utils/src/FactoryDiscovery.php:104
/data/json-exception-handler/vendor/middlewares/utils/src/Factory.php:53
/data/json-exception-handler/src/JsonExceptionHandler.php:39
/data/json-exception-handler/tests/JsonExceptionHandlerTest.php:18

2) Middlewares\Tests\JsonExceptionHandlerTest::testContentType
RuntimeException: No PSR-17 factory detected to create a response

/data/json-exception-handler/vendor/middlewares/utils/src/FactoryDiscovery.php:178
/data/json-exception-handler/vendor/middlewares/utils/src/FactoryDiscovery.php:104
/data/json-exception-handler/vendor/middlewares/utils/src/Factory.php:53
/data/json-exception-handler/src/JsonExceptionHandler.php:39
/data/json-exception-handler/tests/JsonExceptionHandlerTest.php:40

3) Middlewares\Tests\JsonExceptionHandlerTest::testDisableTrace
RuntimeException: No PSR-17 factory detected to create a response

/data/json-exception-handler/vendor/middlewares/utils/src/FactoryDiscovery.php:178
/data/json-exception-handler/vendor/middlewares/utils/src/FactoryDiscovery.php:104
/data/json-exception-handler/vendor/middlewares/utils/src/Factory.php:53
/data/json-exception-handler/src/JsonExceptionHandler.php:39
/data/json-exception-handler/tests/JsonExceptionHandlerTest.php:59

4) Middlewares\Tests\JsonExceptionHandlerTest::testJsonOptions
RuntimeException: No PSR-17 factory detected to create a response

/data/json-exception-handler/vendor/middlewares/utils/src/FactoryDiscovery.php:178
/data/json-exception-handler/vendor/middlewares/utils/src/FactoryDiscovery.php:104
/data/json-exception-handler/vendor/middlewares/utils/src/Factory.php:53
/data/json-exception-handler/src/JsonExceptionHandler.php:39
/data/json-exception-handler/tests/JsonExceptionHandlerTest.php:82

It seems that the behavior will be different for middlewares/utils:^2.1 and midlewares/utils:^3.2 versions.

I think it should be considered or fix the failed tests. Is there any idea about this?