1 | <?php |
||
23 | trait QueueTrait |
||
24 | { |
||
25 | /** |
||
26 | * Insert update issue to message queue. |
||
27 | * |
||
28 | * @param Issue $issue |
||
29 | * |
||
30 | * @return void |
||
31 | */ |
||
32 | 5 | public function queueUpdate(Issue $issue) |
|
33 | { |
||
34 | // Number of changed attributes |
||
35 | 5 | $countChanges = count($issue->getDirty()); |
|
36 | |||
37 | // Whether or not the assignee has changed |
||
38 | 5 | $noMessageForMe = false; |
|
39 | |||
40 | // is Closed? |
||
41 | 5 | if (!$issue->isOpen()) { |
|
42 | 4 | return (new Queue())->queue(Queue::CLOSE_ISSUE, $issue, auth()->user()); |
|
|
|||
43 | } |
||
44 | |||
45 | // is Reopened? |
||
46 | 2 | if ((int) $issue->getOriginal('status') === Issue::STATUS_CLOSED) { |
|
47 | 1 | return (new Queue())->queue(Queue::REOPEN_ISSUE, $issue, auth()->user()); |
|
48 | } |
||
49 | |||
50 | // If the assignee has changed and it is not the logged in user who made the action |
||
51 | 1 | if ($issue->assigned_to !== $issue->getOriginal('assigned_to', $issue->assigned_to) |
|
52 | 1 | && auth()->user()->id !== $issue->assigned_to |
|
53 | ) { |
||
54 | (new Queue())->queue(Queue::ASSIGN_ISSUE, $issue, auth()->user()); |
||
55 | $noMessageForMe = $issue->assigned_to; |
||
56 | } |
||
57 | |||
58 | // If the update was just for assigning user, then skip update issue |
||
59 | 1 | if (!($countChanges === 1 && $noMessageForMe !== false)) { |
|
60 | 1 | return (new Queue())->queue(Queue::UPDATE_ISSUE, $issue, auth()->user()); |
|
61 | } |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * Insert add issue to message queue. |
||
66 | * |
||
67 | * @param Issue $issue |
||
68 | * |
||
69 | * @return void |
||
70 | */ |
||
71 | 28 | public function queueAdd(Issue $issue) |
|
75 | |||
76 | /** |
||
77 | * Insert assign issue to message queue. |
||
78 | * |
||
79 | * @param Issue $issue |
||
80 | * |
||
81 | * @return void |
||
82 | */ |
||
83 | 2 | public function queueAssign(Issue $issue) |
|
90 | |||
91 | /** |
||
92 | * Insert issue tag changes to message queue. |
||
93 | * |
||
94 | * @param Issue $issue |
||
95 | * @param array $addedTags |
||
96 | * @param array $removedTags |
||
97 | * |
||
98 | * @return mixed |
||
99 | */ |
||
100 | 2 | public function queueChangeTags(Issue $issue, array $addedTags, array $removedTags) |
|
107 | } |
||
108 |
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: