Do not generate a return statement in the constructor of a test double#6800
Closed
lazerg wants to merge 1 commit into
Closed
Do not generate a return statement in the constructor of a test double#6800lazerg wants to merge 1 commit into
lazerg wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 12.5 #6800 +/- ##
=========================================
Coverage 96.00% 96.00%
- Complexity 7568 7569 +1
=========================================
Files 798 798
Lines 23180 23180
=========================================
Hits 22253 22253
Misses 927 927 ☔ View full report in Codecov by Harness. |
Owner
|
Thank you for your contribution and for taking the time to prepare this pull request. I appreciate the effort. However, I've decided not to merge it as-is, since this issue needs to be addressed across the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an interface (or class) that declares a
__construct()method is doubled, the generated constructor ends withreturn $__phpunit_result;. A constructor cannot declare a return type, soReflectionMapperresolves it toUnknownType(neithervoidnornever) andDoubledMethod::generateCode()emits the return statement. On PHP 8.6 this triggers theReturning a value from a constructor is deprecateddeprecation.This suppresses the return statement when the generated method is a constructor. The existing generator test for #4139 (which doubles an interface declaring a constructor) is updated to the corrected output; it fails before this change and passes after.
Closes #6797