To reduce complexity inside PHPUnit's test double functionality, these methods will be deprecated and then removed:
TestCase::returnValue() (use $double->willReturn() instead of $double->will($this->returnValue()))
TestCase::onConsecutiveCalls() (use $double->willReturn() instead of $double->will($this->onConsecutiveCalls()))
TestCase::returnValueMap() (use $double->willReturnMap() instead of $double->will($this->returnValueMap()))
TestCase::returnArgument() (use $double->willReturnArgument() instead of $double->will($this->returnArgument()))
TestCase::returnSelf() (use $double->willReturnSelf() instead of $double->will($this->returnSelf()))
TestCase::returnCallback() (use $double->willReturnCallback() instead of $double->will($this->returnCallback()))
TestCase::throwException() (use $double->willThrowException() instead of $double->will($this->throwException()))
Timeline
- soft deprecation in PHPUnit 10.3 (add
@deprecated annotation to the method declaration)
- deprecation in PHPUnit 11 (using the method will trigger a deprecation)
- removal in PHPUnit 12
To reduce complexity inside PHPUnit's test double functionality, these methods will be deprecated and then removed:
TestCase::returnValue()(use$double->willReturn()instead of$double->will($this->returnValue()))TestCase::onConsecutiveCalls()(use$double->willReturn()instead of$double->will($this->onConsecutiveCalls()))TestCase::returnValueMap()(use$double->willReturnMap()instead of$double->will($this->returnValueMap()))TestCase::returnArgument()(use$double->willReturnArgument()instead of$double->will($this->returnArgument()))TestCase::returnSelf()(use$double->willReturnSelf()instead of$double->will($this->returnSelf()))TestCase::returnCallback()(use$double->willReturnCallback()instead of$double->will($this->returnCallback()))TestCase::throwException()(use$double->willThrowException()instead of$double->will($this->throwException()))Timeline
@deprecatedannotation to the method declaration)