@@ -24,19 +24,14 @@ class WorkerMock implements HostConnectionInterface
2424{
2525 private WorkerFactoryInterface $ factory ;
2626
27- /** @var array */
2827 private array $ in ;
2928
30- /** @var array */
3129 private array $ out ;
3230
33- /** @var int */
3431 private int $ indexIn ;
3532
36- /** @var int */
3733 private int $ indexOut ;
3834
39- /** @var bool */
4035 private bool $ debug ;
4136
4237 private TestCase $ testCase ;
@@ -55,29 +50,27 @@ public static function createMock(): WorkerMock
5550 return $ mock ;
5651 }
5752
58- public function registerWorkflowAndActivities ()
53+ public function registerWorkflowAndActivities (): void
5954 {
6055 $ taskQueue = $ this ->factory ->newWorker ('default ' );
6156
6257 foreach ($ this ->getClasses (__DIR__ . '/src/Workflow ' ) as $ name ) {
63- $ taskQueue ->registerWorkflowTypes ('Temporal \\Tests \\Workflow \\' . $ name );
58+ $ class = 'Temporal \\Tests \\Workflow \\' . $ name ;
59+ if (\class_exists ($ class )) {
60+ $ taskQueue ->registerWorkflowTypes ($ class );
61+ }
6462 }
6563
6664 // register all activity
6765 foreach ($ this ->getClasses (__DIR__ . '/src/Activity ' ) as $ name ) {
6866 $ class = '\\Temporal \\Tests \\Activity \\' . $ name ;
6967 if (\class_exists ($ class )) {
70- $ taskQueue ->registerActivityImplementations (new $ class );
68+ $ taskQueue ->registerActivityImplementations (new $ class() );
7169 }
7270 }
7371 }
7472
75- /**
76- * @param TestCase $testCase
77- * @param array $queue
78- * @param bool $debug
79- */
80- public function run (TestCase $ testCase , array $ queue , bool $ debug = false )
73+ public function run (TestCase $ testCase , array $ queue , bool $ debug = false ): void
8174 {
8275 $ this ->debug = $ debug ;
8376
@@ -92,9 +85,6 @@ public function run(TestCase $testCase, array $queue, bool $debug = false)
9285 $ this ->factory ->run ($ this );
9386 }
9487
95- /**
96- * @return CommandBatch|null
97- */
9888 public function waitBatch (): ?CommandBatch
9989 {
10090 if (!isset ($ this ->out [$ this ->indexOut ])) {
@@ -110,13 +100,10 @@ public function waitBatch(): ?CommandBatch
110100
111101 return new CommandBatch (
112102 $ pair [0 ],
113- json_decode ($ pair [1 ], true ),
103+ \ json_decode ($ pair [1 ], true ),
114104 );
115105 }
116106
117- /**
118- * @param string $frame
119- */
120107 public function send (string $ frame ): void
121108 {
122109 $ pair = $ this ->in [$ this ->indexIn ];
@@ -149,7 +136,6 @@ public function send(string $frame): void
149136 }
150137
151138 /**
152- * @param \Throwable $error
153139 * @throws \Throwable
154140 */
155141 public function error (\Throwable $ error ): void
0 commit comments