Skip to content

cleverage/process-bundle#143 - ZipTask and UnzipTask: compatibility with process-bundle v6.0 - #24

Draft
njoubert-cleverage wants to merge 1 commit into
mainfrom
process-bundle-143
Draft

njoubert-cleverage wants to merge 1 commit into
mainfrom
process-bundle-143

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Refs cleverage/process-bundle#143, linked to cleverage/process-bundle#253 (draft, milestone v6.0). Draft, attached to the v2.3 milestone: archive v2.3 must be released before process-bundle v6.0.

In process-bundle v6.0, AbstractConfigurableTask::getOptions() returns an array instead of ?array. ZipTask and UnzipTask override it with a ?array return type, which is then a fatal error (Declaration of ...UnzipTask::getOptions(...): ?array must be compatible with ...AbstractConfigurableTask::getOptions(...): array). This PR:

  • declares an array return type on both overrides (covariant with the v5 ?array, so it works with v5 and v6), and removes the @phpstan-ignore return.type;
  • always resolves the options in getOptions() (from the contextualized options, merged with the input when it is an array), instead of returning null when the input is not an array;
  • overrides initialize() as a no-op: the options depend on the input, so they cannot be validated on initialization. This keeps the current behaviour (on initialization, getOptions() used to return null without resolving anything);
  • reads the contextualized options with an (array) cast instead of ?? [] (not nullable in v6);
  • allows cleverage/process-bundle ^5.0 || ^6.0.

Checked against process-bundle v5 (installed) and v6 (sources of cleverage/process-bundle#253): PHPStan (level 10, no ignore), PHPUnit, PHP-CS-Fixer and Rector pass with both. With v6, the current main fails with the fatal error above. Rector would remove the (array) cast once only v6 is supported.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests (no behaviour change, covered by the existing tests)

Breaking changes

None for users of the tasks. Classes extending ZipTask / UnzipTask and overriding getOptions() with a ?array return type must declare array.

🤖 Generated with Claude Code

…ons() returns an array and options are not read on initialization, for compatibility with cleverage/process-bundle v6.0

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant