Skip to content
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

Iterable return types should return empty array by default #4678

Merged

Conversation

Slamdunk
Copy link
Contributor

@Slamdunk Slamdunk commented May 20, 2021

Without this fix, mocked method with traversable|Generator|iterable return types return an array with one null element:

https://3v4l.org/mR8kdU

1) ./tests/end-to-end/mock-objects/generator/return_type_declarations_generator_empty_by_default.phpt
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
-array(0) {
+array(1) {
+  [0]=>
+  NULL
 }
-array(0) {
+array(1) {
+  [0]=>
+  NULL
 }
-array(0) {
+array(1) {
+  [0]=>
+  NULL
 }

@sebastianbergmann sebastianbergmann added feature/test-doubles type/bug labels May 20, 2021
@sebastianbergmann sebastianbergmann merged commit 73e9d2b into sebastianbergmann:8.5 May 20, 2021
9 of 24 checks passed
@Slamdunk Slamdunk deleted the iterable_empty_return branch May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-doubles type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants