1 | <?php |
||
15 | class WordPoints_Hook_Fire { |
||
16 | |||
17 | /** |
||
18 | * The firer that is firing the hook. |
||
19 | * |
||
20 | * @since 1.0.0 |
||
21 | * |
||
22 | * @var WordPoints_Hook_FirerI |
||
23 | */ |
||
24 | public $firer; |
||
25 | |||
26 | /** |
||
27 | * The args for the event that is being fired. |
||
28 | * |
||
29 | * @since 1.0.0 |
||
30 | * |
||
31 | * @var WordPoints_Hook_Event_Args |
||
32 | */ |
||
33 | public $event_args; |
||
34 | |||
35 | /** |
||
36 | * The reaction that is being fired at. |
||
37 | * |
||
38 | * @since 1.0.0 |
||
39 | * |
||
40 | * @var WordPoints_Hook_ReactionI |
||
41 | */ |
||
42 | public $reaction; |
||
43 | |||
44 | /** |
||
45 | * The hit logger for this fire. |
||
46 | * |
||
47 | * @since 1.0.0 |
||
48 | * |
||
49 | * @var WordPoints_Hook_Hit_Logger |
||
50 | */ |
||
51 | public $hit_logger; |
||
52 | |||
53 | /** |
||
54 | * The ID of the hit (if this fire has hit). |
||
55 | * |
||
56 | * @since 1.0.0 |
||
57 | * |
||
58 | * @var int |
||
59 | */ |
||
60 | public $hit_id; |
||
61 | |||
62 | /** |
||
63 | * The hit this fire supersedes, if any. |
||
64 | * |
||
65 | * @since 1.0.0 |
||
66 | * |
||
67 | * @var object |
||
68 | */ |
||
69 | protected $supersedes; |
||
70 | |||
71 | /** |
||
72 | * @param WordPoints_Hook_Firer $firer The firer. |
||
73 | * @param WordPoints_Hook_Event_Args $event_args The event args. |
||
74 | * @param WordPoints_Hook_ReactionI $reaction The reaction. |
||
75 | * @param object $supersedes The hit superseded by this fire. |
||
76 | */ |
||
77 | public function __construct( |
||
90 | |||
91 | /** |
||
92 | * Make this fire a hit. |
||
93 | * |
||
94 | * @since 1.0.0 |
||
95 | * |
||
96 | * @return int|false The ID of the hit, or false if it failed to be logged. |
||
97 | */ |
||
98 | public function hit() { |
||
111 | |||
112 | /** |
||
113 | * Get the hit being superseded by this fire. |
||
114 | * |
||
115 | * The fire will only supersede the hit if it ends up being a hit as well. |
||
116 | * |
||
117 | * @since 1.0.0 |
||
118 | * |
||
119 | * @return object|false The hit being superseded by this fire, or false. |
||
120 | */ |
||
121 | public function get_superseded_hit() { |
||
155 | } |
||
156 | |||
158 |
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
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. 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.