Skip to content

[4.0] Fix exit code when phpcbf is processing STDIN #1175

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

Open
wants to merge 2 commits into
base: 4.x
Choose a base branch
from

Conversation

fredden
Copy link
Member

@fredden fredden commented Aug 8, 2025

Description

When running phpcbf with a PHP file as input (eg, phpcbf < test.php), the exit code was not reported correctly. This pull request fixes that bug. For more details, see #1082.

Suggested changelog entry

Fixed exit code when phpcbf is processing STDIN

Related issues/external references

Fixes #1082

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
    • This change is only breaking for integrators, not for external standards or end-users.
  • Documentation improvement

PR checklist

  • I have checked there is no other PR open for the same change.
  • I have read the Contribution Guidelines.
  • I grant the project the right to include and distribute the code under the BSD-3-Clause license (and I have the right to grant these rights).
  • I have added tests to cover my changes.
  • I have verified that the code complies with the projects coding standards.
  • [Required for new sniffs] I have added XML documentation for the sniff.
  • I have opened a sister-PR in the documentation repository to update the Wiki.

@fredden
Copy link
Member Author

fredden commented Aug 8, 2025

@jrfnl how would you like to cover this change with tests?

@jrfnl
Copy link
Member

jrfnl commented Aug 8, 2025

how would you like to cover this change with tests?

I imagine it may be difficult to cover this change via the PHPUnit setup as it would require mocking STDIN. How about adding some tests to the bashunit E2E testsuite ?

@jrfnl jrfnl added this to the 4.0.0 milestone Aug 8, 2025
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.

2 participants