[Feature][BC break] Allow creating diffs from array and shift URL generation to DiffEntry #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These changes are to make it easier to reuse this project as dependency as demonstrated in https://github.com/lyrixx/composer-diff. If you haven't checked it out yet, I strongly recommend you to do so - it's very useful if you don't have access to your PHP interpreter locally.
From user-perspective, there are no behavior changes except for
json
formatter. This refactoring is just opening up some classes to make it easier to integrate with this project.UrlGenerator
logic calls fromFormatter
s toDiffEntry
- this dramatically reduces complexity of each formatter and makes them more consistent. It also allows usingDiffEntry
objects in other applications.array
and not just files - this actually could make it easier to test but also allows the web version to use a simpler APIDiffEntry
is now much more powerful - it allows to fetch all details like versions, licenses and URLs in a really simple way.DiffEntry
now requires passing$urlGenerator
before$direct
(should be fine if you haven't provided the second argument.PackageDiff::setUrlGenerator()
but the call is optional - it uses defaultGeneratorContainer
out of the box.licenses
key injson
formatter is now anarray
instead ofstring|null
@giggsey you might need to adjust your flows if you rely on this keyNote: All classes in this project are to be treated as
internal
as no BC promise is provided so far and they might change without prior notice. Backward compatibility is mostly provided for user-facing components like CLI arguments and formatters output.As always, all PHP versions from 5.3 all the way to 8.5+ are supported and 100% code coverage is maintained.