for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Mailer Queue Component (http://mateuszsitek.com/projects/mailer-component-queue)
*
* @copyright Copyright (c) 2017 DIGITAL WOLVES LTD (http://digitalwolves.ltd) All rights reserved.
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
*/
namespace Aist\Mailer\Component\Queue\Job;
use Psr\Log\LoggerInterface;
use SlmQueue\Job\AbstractJob;
use Zend\Mail\Transport\TransportInterface;
* Class SendJob
class SendJob extends AbstractJob
{
* @var TransportInterface
private $mailer;
* @var LoggerInterface
private $logger;
* SendJob constructor.
* @param TransportInterface $mailer
* @param LoggerInterface $logger
public function __construct(TransportInterface $mailer, LoggerInterface $logger)
$this->mailer = $mailer;
$this->logger = $logger;
}
/** @inheritdoc */
public function execute()
$payload = $this->getContent();
try {
$this->mailer->send($payload['message']);
$payload['message']
string
object<Zend\Mail\Message>
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:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$this->logger->info(
self::class,
[
'email' => $payload['email'],
'subject' => $payload['subject'],
]
);
echo 'Subject <info>' .
$payload['subject'] .
'</info> email <info>' .
$payload['email'] .
'</info>' .
PHP_EOL;
} catch (\RuntimeException $e) {
$this->logger->error(
'error' => $e->getMessage(),
echo '<error>' . $e->getMessage() . '</error> Subject <info>' .
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: