Repository navigation
Register shopware/conflicts composer repository on install and update - #24
Merged
Merged
Conversation
…update Add https://shopware.github.io/conflicts/ as a composer repository so the shopware/conflicts package can be resolved during new installations and updates. - install-template/composer.json: include the conflicts composer repository in the template used to bootstrap new installations - ProjectComposerJsonUpdater: idempotently ensure the conflicts composer repository is present on every update() run (covers both install and update flows, including Flex projects where FlexMigrator is not invoked) - Tests: update assertions to reflect the conflicts repository and add a test verifying an existing conflicts repository is preserved without duplication
…) repo
The previous implementation always inserted the shopware/conflicts
repository under a named key ("shopware-conflicts"), which corrupted an
existing indexed-list "repositories" array into a mixed
{"0":...,"1":...,"shopware-conflicts":...} structure on JSON encode.
composer.json "repositories" can be either an indexed list or a keyed
(named) map. Preserve the existing layout:
- Add a shared addRepository() helper that appends a list item when the
existing "repositories" is an indexed list (or empty), and adds a named
entry when it is a keyed map.
- Refactor ensureConflictsRepository() to use it (with URL-based dedupe via
hasRepository() so an existing conflicts repo is never duplicated).
- Apply the same form-preserving behavior to configureRepositories() for
the SW_RECOVERY_REPOSITORY override, fixing the same latent corruption.
Tests:
- Existing assertions updated to the now-correct list-form output when
starting without repositories.
- testConflictsRepositoryPreservesIndexedListForm and
testConflictsRepositoryPreservesKeyedMapForm explicitly cover both
layouts.
This was referenced Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What & why
This PR ensures
https://shopware.github.io/conflicts/is registered as a Composer repository on new installations and on updates, so theshopware/conflictspackage can always be resolved.See the conflicts package usage docs: https://github.com/shopware/conflicts/blob/main/USAGES.md
Changes
Resources/install-template/composer.json— add the conflicts composer repository to the template that bootstraps new installations.Services/ProjectComposerJsonUpdater.php— new idempotentensureConflictsRepository()method, called fromupdate().update()is the common choke point invoked by bothInstallController::run(new installs, after the template is copied) andUpdateController::run(updates, against the existing projectcomposer.json— including Flex projects whereFlexMigratoris not invoked). The repo is matched by URL, so it is not duplicated whether existingrepositoriesis an indexed list or a named map.Tests/Services/ProjectComposerJsonUpdaterTest.php— updated assertions to reflect the conflicts repository and addedtestUpdateKeepsExistingConflictsRepositoryto verify an already-present conflicts repo is preserved without duplication.FlexMigrator::patchRootComposerJsonis intentionally untouched:ProjectComposerJsonUpdater::update()runs in both flows, so adding the repo there covers all cases without duplicating logic and without perturbing theFlexMigratorTestsymlink-repository expectations.Verification
vendor/bin/phpunit→ 86 tests, 257 assertions, OKvendor/bin/phpstan analyse→ No errorsvendor/bin/php-cs-fixer fix --dry-run→ 0 files to fixcomposer.jsonis valid JSON