Skip to content

[Symfony44] Cover ConsoleExecuteReturnIntRector try/catch with \Throwable and trailing comment - #1063

Closed
TomasVotruba wants to merge 1 commit into
mainfrom
console-execute-throwable-try-catch-fixtures
Closed

[Symfony44] Cover ConsoleExecuteReturnIntRector try/catch with \Throwable and trailing comment#1063
TomasVotruba wants to merge 1 commit into
mainfrom
console-execute-throwable-try-catch-fixtures

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Sep 8, 2026

Copy link
Copy Markdown
Member

Follow-up to rectorphp/rector-src#8472, covering the ConsoleExecuteReturnIntRector side of rectorphp/rector#9897.

A try/catch (\Throwable) where both branches return, and the catch ends with a trailing comment (parsed as a Nop, e.g. // @codeCoverageIgnoreEnd), already returns int on every path. The rule must not append an unreachable return 0;. New fixture skip_try_catch_throwable_trailing_comment.php.inc pins this.

Existing try/catch fixtures switched from \Exception to \Throwable: only a \Throwable catch guarantees the block ends control flow, since an Error escapes an \Exception-only catch. This matches the analyzer change in rector-src#8472.

Depends on rectorphp/rector-src#8472 - CI here goes green once that lands and dev-main picks it up (the trailing-comment skip relies on the Nop-skip added there).

@TomasVotruba
TomasVotruba force-pushed the console-execute-throwable-try-catch-fixtures branch from 4a38a2c to ab06c87 Compare September 8, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant