Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command "api:upgrade-resource" fails with sebastian/diff 5.x #5426

Closed
mbrodala opened this issue Mar 1, 2023 · 2 comments
Closed

Command "api:upgrade-resource" fails with sebastian/diff 5.x #5426

mbrodala opened this issue Mar 1, 2023 · 2 comments

Comments

@mbrodala
Copy link
Contributor

mbrodala commented Mar 1, 2023

API Platform version(s) affected: v2.7.10

Description

Trying to run the api:upgrade-resource command in preparation for v3.x fails:

$ console api:upgrade-resource 
[2023-03-01T13:01:39.282475+01:00] console.CRITICAL: Error thrown while running command "api:upgrade-resource". Message: "Too few arguments to function SebastianBergmann\Diff\Differ::__construct(), 0 passed in /.../vendor/api-platform/core/src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php on line 218 and exactly 1 expected" {"exception":"[object] (ArgumentCountError(code: 0): Too few arguments to function SebastianBergmann\\Diff\\Differ::__construct(), 0 passed in /.../vendor/api-platform/core/src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php on line 218 and exactly 1 expected at /.../vendor/sebastian/diff/src/Differ.php:44)","command":"api:upgrade-resource","message":"Too few arguments to function SebastianBergmann\\Diff\\Differ::__construct(), 0 passed in /.../vendor/api-platform/core/src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php on line 218 and exactly 1 expected"} []
[2023-03-01T13:01:39.283043+01:00] php.CRITICAL: Uncaught Error: Too few arguments to function SebastianBergmann\Diff\Differ::__construct(), 0 passed in /.../vendor/api-platform/core/src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php on line 218 and exactly 1 expected {"exception":"[object] (ArgumentCountError(code: 0): Too few arguments to function SebastianBergmann\\Diff\\Differ::__construct(), 0 passed in /.../vendor/api-platform/core/src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php on line 218 and exactly 1 expected at /.../vendor/sebastian/diff/src/Differ.php:44)"} []

In Differ.php line 44:
                                                                                                                                                                                                                                   
  Too few arguments to function SebastianBergmann\Diff\Differ::__construct(), 0 passed in /.../vendor/api-platform/core/src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php on line 218 and exactly 1 e  
  xpected                                                                                                                                                                                                                          
                                                                                                                                                                                                                                   

api:upgrade-resource [-d|--dry-run [DRY-RUN]] [-s|--silent] [-f|--force]

This is due to a constructor change of Differ with sebastian/diff 5.x:

sebastianbergmann/diff@6fb7a31

How to reproduce

  1. Install api-platform/core 2.7 and phpunit/phpunit 10.x which requires sebastian/diff 5.x
  2. Run the api:upgrade-resource console command
@soyuka
Copy link
Member

soyuka commented Mar 1, 2023

solution: use phpunit < 10 just to run the command or please provide a patch thanks

mbrodala added a commit to mbrodala/core that referenced this issue Apr 19, 2023
The Differ now expects a output builder as mandatory argument.

Fixes api-platform#5426
@mbrodala
Copy link
Contributor Author

Finally had some time for this (embarrassingly simple) fix.

soyuka added a commit that referenced this issue Apr 20, 2023
* fix(symfony): update for PHPUnit 10

The Differ now expects a output builder as mandatory argument.

Fixes #5426

* support many phpunit versions

---------

Co-authored-by: Antoine Bluchet <[email protected]>
@soyuka soyuka closed this as completed Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants