@@ -85,7 +85,7 @@ public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $opti
8585 *
8686 * @param string $taskName Task name
8787 * @param array|null $data Array of data
88- * @param string $notBefore A datetime which indicates when the job may be executed
88+ * @param string|null $notBefore A datetime which indicates when the job may be executed
8989 * @return \Queue\Model\Entity\QueuedTask Saved job entity
9090 */
9191 public function createJob ($ taskName , array $ data = null , string $ notBefore = null )
@@ -157,7 +157,7 @@ public function getStats()
157157 {
158158 $ driverName = $ this ->_getDriverName ();
159159 $ options = [
160- 'fields ' => function (Query $ query ) use ($ driverName ) {
160+ 'fields ' => function (Query $ query ) use ($ driverName ): array {
161161 $ alltime = $ query ->func ()->avg ('UNIX_TIMESTAMP(completed) - UNIX_TIMESTAMP(created) ' );
162162 $ runtime = $ query ->func ()->avg ('UNIX_TIMESTAMP(completed) - UNIX_TIMESTAMP(fetched) ' );
163163 $ fetchdelay = $ query ->func ()->avg ('UNIX_TIMESTAMP(fetched) - IF(not_before is NULL, UNIX_TIMESTAMP(created), UNIX_TIMESTAMP(not_before)) ' );
@@ -205,7 +205,7 @@ public function getStats()
205205 public function getFullStats ($ taskName = null )
206206 {
207207 $ driverName = $ this ->_getDriverName ();
208- $ fields = function (Query $ query ) use ($ driverName ) {
208+ $ fields = function (Query $ query ) use ($ driverName ): array {
209209 $ runtime = $ query ->newExpr ('UNIX_TIMESTAMP(completed) - UNIX_TIMESTAMP(fetched) ' );
210210 switch ($ driverName ) {
211211 case static ::DRIVER_SQLSERVER :
@@ -339,7 +339,7 @@ public function requestJob(array $capabilities, array $types = [])
339339 }
340340
341341 /** @var \Queue\Model\Entity\QueuedTask|null $task */
342- $ task = $ this ->getConnection ()->transactional (function () use ($ query , $ options , $ now ) {
342+ $ task = $ this ->getConnection ()->transactional (function () use ($ query , $ options , $ now ): ? QueuedTask {
343343 $ task = $ query ->find ('all ' , $ options )
344344 ->enableAutoFields (true )
345345 ->epilog ('FOR UPDATE ' )
@@ -350,6 +350,7 @@ public function requestJob(array $capabilities, array $types = [])
350350 }
351351
352352 $ key = sha1 (microtime ());
353+ /* @phan-suppress-next-line PhanPartialTypeMismatchArgument */
353354 $ task = $ this ->patchEntity ($ task , [
354355 'worker_key ' => $ key ,
355356 'fetched ' => $ now
@@ -507,7 +508,7 @@ public function truncate()
507508 protected function _getDriverName ()
508509 {
509510 $ className = explode ('\\' , $ this ->getConnection ()->config ()['driver ' ]);
510- $ name = end ($ className );
511+ $ name = end ($ className ) ?: '' ;
511512
512513 return $ name ;
513514 }
0 commit comments