66use Moka \Exception \MissingDependencyException ;
77use Moka \Strategy \AbstractMockingStrategy ;
88use Moka \Stub \MethodStub ;
9- use PHPUnit_Framework_MockObject_Generator as MockGenerator ;
10- use PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount as AnyInvokedCountMatcher ;
11- use PHPUnit_Framework_MockObject_MockObject as MockObject ;
9+ use PHPUnit \ Framework \ MockObject \ Generator ;
10+ use PHPUnit \ Framework \ MockObject \ Matcher \ AnyInvokedCount ;
11+ use PHPUnit \ Framework \ MockObject \ MockObject ;
1212
1313/**
1414 * Class PHPUnitMockingStrategy
1515 * @package Moka\Strategy
1616 */
1717class PHPUnitMockingStrategy extends AbstractMockingStrategy
1818{
19- const CLASS_NAME = MockGenerator ::class;
19+ const CLASS_NAME = Generator ::class;
2020 const PACKAGE_NAME = 'phpunit/phpunit-mock-objects ' ;
2121
2222 /**
23- * @var MockGenerator
23+ * @var Generator
2424 */
2525 private $ generator ;
2626
@@ -33,16 +33,17 @@ public function __construct()
3333 {
3434 self ::checkDependencies (self ::CLASS_NAME , self ::PACKAGE_NAME );
3535
36- $ this ->generator = new MockGenerator ();
36+ $ this ->generator = new Generator ();
3737 $ this ->setMockType (MockObject::class);
3838 }
3939
4040 /**
4141 * @param string $fqcn
4242 * @return MockObject
4343 *
44- * @throws \InvalidArgumentException
45- * @throws \PHPUnit_Framework_MockObject_RuntimeException
44+ * @throws \PHPUnit\Framework\Exception
45+ * @throws \PHPUnit\Framework\MockObject\RuntimeException
46+ * @throws \ReflectionException
4647 */
4748 protected function doBuild (string $ fqcn )
4849 {
@@ -58,14 +59,15 @@ protected function doBuild(string $fqcn)
5859 /**
5960 * @param MockObject $mock
6061 * @param MethodStub $stub
61- * @return void
62+ *
63+ * @throws \PHPUnit\Framework\MockObject\RuntimeException
6264 */
6365 protected function doDecorateWithMethod ($ mock , MethodStub $ stub )
6466 {
6567 $ methodName = $ stub ->getName ();
6668 $ methodValue = $ stub ->getValue ();
6769
68- $ partial = $ mock ->expects (new AnyInvokedCountMatcher ())->method ($ methodName );
70+ $ partial = $ mock ->expects (new AnyInvokedCount ())->method ($ methodName );
6971 $ methodValue instanceof \Throwable
7072 ? $ partial ->willThrowException ($ methodValue )
7173 : $ partial ->willReturn ($ methodValue );
0 commit comments