This is the scenario.
You have package A and package B in your composer.json (your app depends on this 2 packages).
Both package A and B depend on package C, but on different versions. Say A depend on C v2.1, and B depends on C v2.2.
And you get version conflicts.
Both A, B and C are third party packages.
How to resolve this?
A very common solution to this problem is to have a standardized numbering system, wherein software uses a specific number for each version (aka major version), and also a subnumber for each revision (aka minor version), e.g.: 10. 1, or 5.
Now just open the composer. json file and delete the dependency which you want to remove. Now we just need to run the composer update command once more and it will remove all the phpunit dependencies which we don't want as shown below: Running composer update once again.
This is a hack but will probably let you move forward.
You could overwrite repositories for "A", "B" and "C" packages and make that "A" and "B" rely on the same version of "C" (actually, might be that it's enough to overwrite repositories for "A" and "B" only).
This should work as long as both "A" and "B" can work with the latest version of "C" (so probably a maintainer didn't update the package version). If it's the case I'd also consider sending a pull request to the project which has an older version of a dependency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With