Skip to content

Using local patches for dev dependencies breaks projects that use cweagans/composer-patches #660

@Berdir

Description

@Berdir

Describe the bug

Follow-up of #632, which didn't fully address this issue

Adding patches to composer.json for dev dependencies seems incorrect to me, for two reasons:

a) The local patch files won't be found in the module, AFAIK composer-patches won't look there
b) Even if they would be found, the project is likely to use a different version of phpunit where the patches don't apply.

To Reproduce
Steps to reproduce the behavior:

  1. composer init
  2. composer require cweagans/composer-patches predis/predis
  3. composer config extra.enable-patching true
  4. composer require --dev phpunit/phpunit
  - Applying patches for phpunit/phpunit
    ./tests/phpunit_php7.patch (Fix PHP 7 compatibility)
   Could not apply patch! Skipping. The error was: The "./tests/phpunit_php7.patch" file could not be downloaded: failed to open stream: No such file or directory
    ./tests/phpunit_php8.patch (Fix PHP 8 compatibility)
   Could not apply patch! Skipping. The error was: The "./tests/phpunit_php8.patch" file could not be downloaded: failed to open stream: No such file or directory

Expected behavior
A clear and concise description of what you expected to happen.

Versions (please complete the following information):

  • Predis: 1.1.x
  • PHP 7.4
  • Redis Server irrelevant
  • OS: Ubuntu 20.10

I don't think it is possible to do this, not without cweagans/composer-patches introducing a patches-dev. My suggestion would be to switch to applying those patches with a script/travis commands (or whatever CI you use)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions