@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | private $cachedEndpoint = []; |
99 | 99 | |
100 | 100 | /** |
101 | - * @param string|resource $endpointOrResource |
|
101 | + * @param resource $endpointOrResource |
|
102 | 102 | * @param LoopInterface $loop |
103 | - * @param mixed[] $config |
|
103 | + * @param string[] $config |
|
104 | 104 | * @throws InstantiationException |
105 | 105 | */ |
106 | 106 | public function __construct($endpointOrResource, LoopInterface $loop, $config = []) |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | /** |
480 | 480 | * Configure config variable. |
481 | 481 | * |
482 | - * @param $configKey |
|
482 | + * @param string $configKey |
|
483 | 483 | */ |
484 | 484 | private function configureVariable($configKey) |
485 | 485 | { |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | if ($ex !== null) |
355 | 355 | { |
356 | 356 | $this->close(); |
357 | - $this->emit('error', [ $this, $ex ]); |
|
357 | + $this->emit('error', [$this, $ex]); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
@@ -373,8 +373,8 @@ discard block |
||
373 | 373 | |
374 | 374 | if ($data !== '' && $data !== false) |
375 | 375 | { |
376 | - $this->emit('data', [ $this, $data ]); |
|
377 | - $this->emit('end', [ $this ]); |
|
376 | + $this->emit('data', [$this, $data]); |
|
377 | + $this->emit('end', [$this]); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | if ($data === '' || $data === false || !is_resource($this->resource) || feof($this->resource)) |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | if ($ex !== null) |
391 | 391 | { |
392 | - $this->emit('error', [ $this, $ex ]); |
|
392 | + $this->emit('error', [$this, $ex]); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | if ($ex !== null) |
415 | 415 | { |
416 | - $this->emit('error', [ $this, $ex ]); |
|
416 | + $this->emit('error', [$this, $ex]); |
|
417 | 417 | } |
418 | 418 | } |
419 | 419 | |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | protected function getHandleReadFunction() |
444 | 444 | { |
445 | 445 | return $this->config['ssl'] === true && !$this->isEncrypted() |
446 | - ? [ $this, 'handleEncrypt' ] |
|
447 | - : [ $this, 'handleRead' ]; |
|
446 | + ? [$this, 'handleEncrypt'] |
|
447 | + : [$this, 'handleRead']; |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | /** |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | protected function getHandleWriteFunction() |
456 | 456 | { |
457 | 457 | return $this->config['ssl'] === true && !$this->isEncrypted() |
458 | - ? [ $this, 'handleEncrypt' ] |
|
459 | - : [ $this, 'handleWrite' ]; |
|
458 | + ? [$this, 'handleEncrypt'] |
|
459 | + : [$this, 'handleWrite']; |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | /** |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | */ |
494 | 494 | private function parseEndpoint($wantPeer = false) |
495 | 495 | { |
496 | - $wantIndex = (int)$wantPeer; |
|
496 | + $wantIndex = (int) $wantPeer; |
|
497 | 497 | |
498 | 498 | if (isset($this->cachedEndpoint[$wantIndex])) |
499 | 499 | { |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | $count = count($parts); |
524 | 524 | $port = $parts[$count - 1]; |
525 | 525 | unset($parts[$count - 1]); |
526 | - $endpoint = $transport.'[' . implode(':', $parts) . ']:' . $port; |
|
526 | + $endpoint = $transport . '[' . implode(':', $parts) . ']:' . $port; |
|
527 | 527 | } |
528 | 528 | else |
529 | 529 | { |
@@ -347,9 +347,11 @@ discard block |
||
347 | 347 | } |
348 | 348 | } |
349 | 349 | catch (Error $ex) |
350 | - {} |
|
350 | + { |
|
351 | +} |
|
351 | 352 | catch (Exception $ex) |
352 | - {} |
|
353 | + { |
|
354 | +} |
|
353 | 355 | |
354 | 356 | if ($ex !== null) |
355 | 357 | { |
@@ -383,9 +385,11 @@ discard block |
||
383 | 385 | } |
384 | 386 | } |
385 | 387 | catch (Error $ex) |
386 | - {} |
|
388 | + { |
|
389 | +} |
|
387 | 390 | catch (Exception $ex) |
388 | - {} |
|
391 | + { |
|
392 | +} |
|
389 | 393 | |
390 | 394 | if ($ex !== null) |
391 | 395 | { |
@@ -407,9 +411,11 @@ discard block |
||
407 | 411 | parent::handleWrite(); |
408 | 412 | } |
409 | 413 | catch (Error $ex) |
410 | - {} |
|
414 | + { |
|
415 | +} |
|
411 | 416 | catch (Exception $ex) |
412 | - {} |
|
417 | + { |
|
418 | +} |
|
413 | 419 | |
414 | 420 | if ($ex !== null) |
415 | 421 | { |
@@ -539,7 +539,7 @@ |
||
539 | 539 | /** |
540 | 540 | * Configure static key |
541 | 541 | * |
542 | - * @param $configKey |
|
542 | + * @param string $configKey |
|
543 | 543 | */ |
544 | 544 | private function configureVariable($configKey) |
545 | 545 | { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | { |
204 | 204 | $endpoint = explode('://', $this->getLocalEndpoint(), 2); |
205 | 205 | |
206 | - return isset($endpoint[0]) ? $endpoint[0]:''; |
|
206 | + return isset($endpoint[0]) ? $endpoint[0] : ''; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | |
300 | 300 | $this->started = false; |
301 | 301 | |
302 | - $this->emit('close', [ $this ]); |
|
302 | + $this->emit('close', [$this]); |
|
303 | 303 | $this->handleClose(); |
304 | - $this->emit('done', [ $this ]); |
|
304 | + $this->emit('done', [$this]); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | if (isset($this->loop)) |
335 | 335 | { |
336 | - $this->loop->addReadStream($this->socket, [ $this, 'handleConnect' ]); |
|
336 | + $this->loop->addReadStream($this->socket, [$this, 'handleConnect']); |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | |
461 | 461 | if ($socket === false) |
462 | 462 | { |
463 | - $this->emit('error', [ $this, new ReadException('Socket could not accept new connection.') ]); |
|
463 | + $this->emit('error', [$this, new ReadException('Socket could not accept new connection.')]); |
|
464 | 464 | return; |
465 | 465 | } |
466 | 466 | |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | 'ssl_method' => $this->config['ssl_method'], |
475 | 475 | ]); |
476 | 476 | |
477 | - $this->emit('connect', [ $this, $client ]); |
|
477 | + $this->emit('connect', [$this, $client]); |
|
478 | 478 | } |
479 | 479 | catch (Error $ex) |
480 | 480 | {} |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | if ($ex !== null) |
485 | 485 | { |
486 | 486 | $this->handleDisconnect($socket); |
487 | - $this->emit('error', [ $this, new ReadException('Socket could not wrap new connection!') ]); |
|
487 | + $this->emit('error', [$this, new ReadException('Socket could not wrap new connection!')]); |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $count = count($parts); |
573 | 573 | $port = $parts[$count - 1]; |
574 | 574 | unset($parts[$count - 1]); |
575 | - $endpoint = $transport.'[' . implode(':', $parts) . ']:' . $port; |
|
575 | + $endpoint = $transport . '[' . implode(':', $parts) . ']:' . $port; |
|
576 | 576 | } |
577 | 577 | else |
578 | 578 | { |
@@ -477,9 +477,11 @@ |
||
477 | 477 | $this->emit('connect', [ $this, $client ]); |
478 | 478 | } |
479 | 479 | catch (Error $ex) |
480 | - {} |
|
480 | + { |
|
481 | +} |
|
481 | 482 | catch (Exception $ex) |
482 | - {} |
|
483 | + { |
|
484 | +} |
|
483 | 485 | |
484 | 486 | if ($ex !== null) |
485 | 487 | { |