Fixes #796 and sebastianbergmann/phpunit-mock-objects#116

 * Fixed a call-time pass-by-reference issue exposed by de6d32a.
 * Cleaned up some slightly obfuscated code.
Merge pull request #799 from whatthejeff/issue_796