yiicod /
yii2-mailqueue
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace yiicod\mailqueue\commands; |
||
| 4 | |||
| 5 | use Exception; |
||
| 6 | use Yii; |
||
| 7 | use yiicod\base\helpers\LoggerMessage; |
||
| 8 | use yiicod\cron\commands\DaemonController; |
||
| 9 | use yiicod\mailqueue\components\MailHandler; |
||
| 10 | use yiicod\mailqueue\components\MailHandlerInterface; |
||
| 11 | use yiicod\mailqueue\MailQueue; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Console command |
||
| 15 | * class MailQueueCommand |
||
| 16 | */ |
||
| 17 | class MailQueueCommand extends DaemonController |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var MailHandlerInterface |
||
| 21 | */ |
||
| 22 | public $mailProvider = MailHandler::class; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Only one command can run in the same time in {n} times |
||
| 26 | * |
||
| 27 | * @param int $timeLock |
||
| 28 | */ |
||
| 29 | public $timeLock = 3600; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Daemon name |
||
| 33 | * |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | protected function daemonName(): string |
||
| 37 | { |
||
| 38 | return 'mail-queue'; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Run send mail |
||
| 43 | */ |
||
| 44 | public function worker() |
||
| 45 | { |
||
| 46 | try { |
||
| 47 | Yii::$app->db->close(); |
||
| 48 | Yii::$app->db->open(); |
||
| 49 | MailQueue::delivery(new $this->mailProvider()); |
||
| 50 | } catch (Exception $e) { |
||
| 51 | Yii::error(LoggerMessage::log($e), __METHOD__); |
||
|
0 ignored issues
–
show
|
|||
| 52 | } |
||
| 53 | } |
||
| 54 | } |
||
| 55 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: