| Total Complexity | 5 |
| Total Lines | 73 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class SendMail extends AbstractJob |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var string Queue to use |
||
| 14 | */ |
||
| 15 | public $queue = 'mail'; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string Queue connection to use |
||
| 19 | */ |
||
| 20 | public $connection = 'database'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var string Email address of recipient |
||
| 24 | */ |
||
| 25 | public $to; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var string Email address of users to CC |
||
| 29 | */ |
||
| 30 | public $cc; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var Mailable The mailable to send to the recipient |
||
| 34 | */ |
||
| 35 | public $mailable; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Create a new job instance. |
||
| 39 | * |
||
| 40 | * @param string $to |
||
| 41 | * @param Mailable $mailable |
||
| 42 | * @param array|null $cc |
||
| 43 | */ |
||
| 44 | public function __construct(string $to, Mailable $mailable, array $cc = null) |
||
| 45 | { |
||
| 46 | $this->to = $to; |
||
| 47 | $this->mailable = $mailable; |
||
| 48 | $this->cc = $cc; |
||
|
|
|||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Execute the job. |
||
| 53 | * |
||
| 54 | * @return void |
||
| 55 | */ |
||
| 56 | public function handle() |
||
| 60 | } |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Send a Mailable to an email recipient with optional CC recipients |
||
| 65 | * |
||
| 66 | * @return bool |
||
| 67 | */ |
||
| 68 | private function send() |
||
| 83 | } |
||
| 84 | } |
||
| 85 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.