sebastianbergmann / phpunit-mock-objects

Mock Object library for PHPUnit
https://phpunit.de/
Other
4.97k stars 153 forks source link

Add support for void return types in generator #330

Closed prolic closed 8 years ago

prolic commented 8 years ago

resolves: https://github.com/sebastianbergmann/phpunit-mock-objects/issues/329

sebastianbergmann commented 8 years ago
prolic commented 8 years ago

About the template:

php > function foo() : void { echo 'foo'; }
php > function bar() : void { return foo(); }
PHP Fatal error:  A void function must not return a value in php shell code on line 1

Fatal error: A void function must not return a value in php shell code on line 1

And I updated the title of this PR.

sebastianbergmann commented 8 years ago

Of course, that makes sense; my bad.

It would be nice to get an error when trying to configure a return value for a method that has a void return type declaration. Do you want to look into this?

prolic commented 8 years ago

@sebastianbergmann I tried to, but it seems like this is not so easy possible. I don't know much about the internals. Feel free to submit a PR to my PR to improve this, I'm sure you spot it quickly.

sebastianbergmann commented 8 years ago

I'll try to work on this over the weekend, at least to get your PR merged.