991010 * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
1111 */
12+
1213namespace Hyperf \Testing \Concerns ;
1314
1415use Closure ;
1516use Hyperf \Context \ApplicationContext ;
17+ use Hyperf \Contract \ApplicationInterface ;
1618use Hyperf \Di \Container ;
1719use Hyperf \Di \Definition \DefinitionSourceFactory ;
1820use Mockery ;
21+ use Mockery \MockInterface ;
1922use Psr \Container \ContainerInterface ;
2023
2124trait InteractsWithContainer
2225{
2326 /**
24- * @var null|ContainerInterface|\Hyperf\Di\ Container
27+ * @var null|Container|ContainerInterface
2528 */
2629 protected ?ContainerInterface $ container = null ;
2730
@@ -56,7 +59,7 @@ protected function instance($abstract, $instance)
5659 * Mock an instance of an object in the container.
5760 *
5861 * @param string $abstract
59- * @return \Mockery\ MockInterface
62+ * @return MockInterface
6063 */
6164 protected function mock ($ abstract , ?Closure $ mock = null )
6265 {
@@ -67,7 +70,7 @@ protected function mock($abstract, ?Closure $mock = null)
6770 * Mock a partial instance of an object in the container.
6871 *
6972 * @param string $abstract
70- * @return \Mockery\ MockInterface
73+ * @return MockInterface
7174 */
7275 protected function partialMock ($ abstract , ?Closure $ mock = null )
7376 {
@@ -78,7 +81,7 @@ protected function partialMock($abstract, ?Closure $mock = null)
7881 * Spy an instance of an object in the container.
7982 *
8083 * @param string $abstract
81- * @return \Mockery\ MockInterface
84+ * @return MockInterface
8285 */
8386 protected function spy ($ abstract , ?Closure $ mock = null )
8487 {
@@ -108,6 +111,6 @@ protected function setContainer(ContainerInterface $container): void
108111 protected function refreshContainer (): void
109112 {
110113 $ this ->container = ApplicationContext::setContainer ($ this ->createContainer ());
111- $ this ->container ->get (\ Hyperf \ Contract \ ApplicationInterface::class);
114+ $ this ->container ->get (ApplicationInterface::class);
112115 }
113116}
0 commit comments