Skip to content

Fix Static Analyse failure by declaring apiCode in ExtensionStoreApiException generator type - #198

Closed
Soner (shyim) with Copilot wants to merge 5 commits into
trunkfrom
copilot/fix-static-analyse-job
Closed

Fix Static Analyse failure by declaring apiCode in ExtensionStoreApiException generator type#198
Soner (shyim) with Copilot wants to merge 5 commits into
trunkfrom
copilot/fix-static-analyse-job

Conversation

Copilot AI commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Static Analyse was failing in CI because ExtensionStoreApiException::getErrors() yielded an extended error payload (apiCode) that was not represented in the method’s declared generator value shape. PHPStan treated this as a contract violation.

  • Root cause

    • getErrors() merges parent error entries with an additional apiCode key.
    • The generator return type did not explicitly include apiCode, so yielded values were inferred as incompatible.
  • Change made

    • Added an explicit PHPDoc return type to ExtensionStoreApiException::getErrors() that includes apiCode in the yielded array shape.
    • No runtime behavior changed; this is a type-contract alignment for static analysis.
  • Code update

    /**
     * @return \Generator<int, array{
     *   code: string,
     *   status: string,
     *   title: string,
     *   detail: string,
     *   meta: array{documentationLink: string},
     *   trace?: string,
     *   apiCode: string
     * }>
     */
    public function getErrors(bool $withTrace = false): \Generator

Co-authored-by: shyim <6224096+shyim@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job "Static Analyse" Fix Static Analyse failure by declaring apiCode in ExtensionStoreApiException generator type Aug 9, 2026
Copilot AI requested a review from Soner (shyim) August 9, 2026 05:21
Copilot AI and others added 3 commits August 10, 2026 05:13
…eption

Co-authored-by: shyim <6224096+shyim@users.noreply.github.com>
Co-authored-by: shyim <6224096+shyim@users.noreply.github.com>
Co-authored-by: shyim <6224096+shyim@users.noreply.github.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.

3 participants