Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Console] Deprecate returning a non-int value from a \Closure function set via Command::setCode() #60076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2025

Conversation

yceruto
Copy link
Member

@yceruto yceruto commented Mar 28, 2025

Q A
Branch? 7.3
Bug fix? no
New feature? no
Deprecations? yes
Issues -
License MIT

This adds a missing log entry about a deprecation introduced here, and also deprecates returning a null value for \Closure code (which was allowed before) and throwing a \TypeError for the new invokable command, making this consistent with the Command::execute(): int method.

@yceruto yceruto requested a review from chalasr as a code owner March 28, 2025 13:36
@carsonbot carsonbot added this to the 7.3 milestone Mar 28, 2025
@yceruto yceruto changed the title Deprecate returning a non-int value from a \Closure function set via Command::setCode() [Console] Deprecate returning a non-int value from a \Closure function set via Command::setCode() Mar 28, 2025
@yceruto yceruto force-pushed the command_return_type branch 2 times, most recently from cedfb80 to afc81af Compare March 28, 2025 13:53
@carsonbot carsonbot changed the title [Console] Deprecate returning a non-int value from a \Closure function set via Command::setCode() Deprecate returning a non-int value from a \Closure function set via Command::setCode() Mar 28, 2025
@carsonbot carsonbot changed the title Deprecate returning a non-int value from a \Closure function set via Command::setCode() [Console] Deprecate returning a non-int value from a \Closure function set via Command::setCode() Mar 28, 2025
@yceruto yceruto force-pushed the command_return_type branch from afc81af to e0ab58a Compare March 29, 2025 04:01
@fabpot
Copy link
Member

fabpot commented Mar 29, 2025

Thank you @yceruto.

@fabpot fabpot merged commit f6b63a2 into symfony:7.3 Mar 29, 2025
11 checks passed
@yceruto yceruto deleted the command_return_type branch March 29, 2025 13:34
@fabpot fabpot mentioned this pull request May 2, 2025
xabbuh added a commit to xabbuh/symfony that referenced this pull request May 7, 2025
Since symfony#60076 using a closure as the command code that does not return an
integer is deprecated. This means that our tests can trigger deprecations
on older branches when the high deps job is run. This usually is not an
issue as we silence them with the `SYMFONY_DEPRECATIONS_HELPER` env var.
However, phpt tests are run in a child process where the deprecation error
handler of the PHPUnit bridge doesn't step in. Thus, for them deprecations
are not silenced leading to failures.
@xabbuh xabbuh mentioned this pull request May 7, 2025
xabbuh added a commit to xabbuh/symfony that referenced this pull request May 7, 2025
Since symfony#60076 using a closure as the command code that does not return an
integer is deprecated. This means that our tests can trigger deprecations
on older branches when the high deps job is run. This usually is not an
issue as we silence them with the `SYMFONY_DEPRECATIONS_HELPER` env var.
However, phpt tests are run in a child process where the deprecation error
handler of the PHPUnit bridge doesn't step in. Thus, for them deprecations
are not silenced leading to failures.
fabpot added a commit that referenced this pull request May 8, 2025
This PR was merged into the 6.4 branch.

Discussion
----------

[Runtime] fix tests

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

Since #60076 using a closure as the command code that does not return an integer is deprecated. This means that our tests can trigger deprecations on older branches when the high deps job is run. This usually is not an issue as we silence them with the `SYMFONY_DEPRECATIONS_HELPER` env var. However, phpt tests are run in a child process where the deprecation error handler of the PHPUnit bridge doesn't step in. Thus, for them deprecations are not silenced leading to failures.

Commits
-------

0b3d980 fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.