Problem/Motivation
I've stumbled over the following inspection in the PHPStorm plugin "Php Inspections (EA Extended)" called "promote ->willReturn*".
This points out PHPUnit MockObject ->expects()->will() which have $this->returnValue (and friends) as a stub and replaces them with ->expects()->willReturn() (and friends).
I think at the very least it improves readability.
Remaining tasks
- Patch/MR
- Review
- Commit
- Rejoice
Issue fork drupal-3220128
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3220128--willreturn-would-make
changes, plain diff MR !861
Comments
Comment #2
mondrakeIndeed... #3217717-10: Replace usages of the at() matcher, which is deprecated
Comment #3
spokjeAh, I knew I saw it somewhere but couldn't find it with the search! Thanks @mondrake!
Comment #4
mondrakeNono, that one does not address this... this is a followup to that, rather. Work still to do :)
Comment #5
spokjeAh, misunderstood (again!) Thanks @mondrake (again! :)
Comment #6
spokjePostponed until [##3217717] gets committed, to prevent double work.
Comment #7
spokjeComment #8
spokjeUnpostponing since #3217717: Replace usages of the at() matcher, which is deprecated is committed.
Comment #9
mondrakeComment #10
mondrakeComment #11
spokje@mondrake (and others): Any idea on how to scope this one?
If we try to do this all in one patch we're looking at a huge one (although negative in lines count).
Splitting off all more specific
willReturn(...)(likewillReturnMap()in one sub-issue (there aren't much of them) can be a start.But even after that only the
willReturn()ones will still be huge (read HUGE).Comment #13
longwaveWe could either convert this to a meta, get willReturnMap in first and then figure out scoping for the rest, or accept this will be a disruptive patch and schedule it for the next beta window (mid November).
Comment #14
spokjeAs much as I don't like it, I think @longwave is right:
- Split off all the little ones like
willReturnMapinto a sub-issue, so those can get in.- Make this one, with the only remaining
willReturns, a "disruptive patch" for 9.4-betaComment #15
spokjeLet's make this a [meta] (for now) and make a sub-issue to get all "friends" except
->willReturnitself in first.I highly doubt this will make a big enough dent into this (currently) 450KB patch to make this a non-disruptive patch, but at least we'll be able to get something in before we get to
9.4-beta.Comment #16
spokjeComment #19
spokjeComment #21
spokjeComment #22
immaculatexavier commentedComment #23
spokje@immaculatexavier: Thanks for wanting to work on this, but this is a [META] issue, all the work is done in the child issues.
Comment #24
immaculatexavier commentedOkay @Spokje. I am unassigning.
Comment #25
spokjeClosing this [META] since all sub-issues are committed now.