| 1 | <?php |
||
| 21 | class Connection extends AbstractConnection |
||
| 22 | {
|
||
| 23 | /** |
||
| 24 | * @var Stream |
||
| 25 | */ |
||
| 26 | private $stream; |
||
| 27 | |||
| 28 | public function __construct(PromiseInterface $clientPromise, MessageProcessor $messageProcessor) |
||
| 38 | |||
| 39 | private function onConnection(Stream $stream) |
||
| 45 | |||
| 46 | protected function processHandshake(string $data) |
||
| 50 | |||
| 51 | protected function processMessage(string $data) |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @param \Exception|string $error |
||
| 58 | */ |
||
| 59 | private function onError($error) |
||
| 63 | } |
||
| 64 |
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: