Find a Rector rule

Find the best Rector rule to solve your problem. Searching through 1082 rules.

Found 1 rule. That's the one: Clear

Code Quality 1 match

Add a "return false" fallback to a willReturnCallback() closure that only returns booleans, but can fall through without a return

 use PHPUnit\Framework\TestCase;

 final class SomeTest extends TestCase
 {
     public function test()
     {
         $matcher = $this->exactly(2);

         $this->eventMock->expects($matcher)
             ->method('checkContext')
             ->willReturnCallback(function (...$parameters) use ($matcher) {
                 if ($matcher->numberOfInvocations() === 1) {
                     return true;
                 }
                 if ($matcher->numberOfInvocations() === 2) {
                     return false;
                 }
+
+                return false;
             });
     }
 }