1 | <?php |
||
13 | final class OrganizerCreated extends OrganizerEvent |
||
14 | { |
||
15 | /** |
||
16 | * @var Title |
||
17 | */ |
||
18 | public $title; |
||
19 | |||
20 | /** |
||
21 | * @var Address[] |
||
22 | */ |
||
23 | public $addresses; |
||
24 | |||
25 | /** |
||
26 | * @var string[] |
||
27 | */ |
||
28 | public $phones; |
||
29 | |||
30 | /** |
||
31 | * @var string[] |
||
32 | */ |
||
33 | public $emails; |
||
34 | |||
35 | /** |
||
36 | * @var string[] |
||
37 | */ |
||
38 | public $urls; |
||
39 | |||
40 | /** |
||
41 | * @param string $id |
||
42 | * @param Title $title |
||
43 | * @param Address[] $addresses |
||
44 | * @param string[] $phones |
||
45 | * @param string[] $emails |
||
46 | * @param string[] $urls |
||
47 | */ |
||
48 | public function __construct(string $id, Title $title, array $addresses, array $phones, array $emails, array $urls) |
||
60 | |||
61 | private function guardAddressTypes(Address ...$addresses): void |
||
64 | |||
65 | public function getTitle(): Title |
||
69 | |||
70 | /** |
||
71 | * @return Address[] |
||
72 | */ |
||
73 | public function getAddresses(): array |
||
77 | |||
78 | /** |
||
79 | * @return string[] |
||
80 | */ |
||
81 | public function getPhones(): array |
||
85 | |||
86 | /** |
||
87 | * @return string[] |
||
88 | */ |
||
89 | public function getEmails(): array |
||
93 | |||
94 | /** |
||
95 | * @return string[] |
||
96 | */ |
||
97 | public function getUrls(): array |
||
101 | |||
102 | public function serialize(): array |
||
117 | |||
118 | public static function deserialize(array $data): OrganizerCreated |
||
129 | } |
||
130 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: