summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin V / vvval <[email protected]>2020-05-13 10:19:21 +0300
committerValentin V / vvval <[email protected]>2020-05-13 10:19:21 +0300
commitd0910d5ba44f60eda655d87fd4587164b31a5927 (patch)
treec86f57bc057bdcc75f0f8d0561ce9b4bd895b9ad
parent8fd8356ef1cb9b7602e511cf0d59964cdbbe5dbe (diff)
WIP: fix phpstan based on new goridge interface
-rw-r--r--.github/workflows/ci-build.yml4
-rw-r--r--composer.json2
-rw-r--r--src/Worker.php11
3 files changed, 6 insertions, 11 deletions
diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml
index 57edc624..c85aa6c9 100644
--- a/.github/workflows/ci-build.yml
+++ b/.github/workflows/ci-build.yml
@@ -57,8 +57,8 @@ jobs:
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-suggest # --prefer-source
-# - name: Analyze PHP sources
-# run: composer analyze
+ - name: Analyze PHP sources
+ run: composer analyze
- name: Install Go dependencies
run: go mod download
diff --git a/composer.json b/composer.json
index c4fa8609..c2599c64 100644
--- a/composer.json
+++ b/composer.json
@@ -17,7 +17,7 @@
"php": "^7.2",
"ext-json": "*",
"ext-curl": "*",
- "spiral/goridge": "^2.4",
+ "spiral/goridge": "dev-add_phpstan",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"symfony/console": "^2.5.0 || ^3.0.0 || ^4.0.0 || ^5.0.0",
diff --git a/src/Worker.php b/src/Worker.php
index 2da16e86..d509562e 100644
--- a/src/Worker.php
+++ b/src/Worker.php
@@ -11,8 +11,7 @@ namespace Spiral\RoadRunner;
use Spiral\Goridge\Exceptions\GoridgeException;
use Spiral\Goridge\RelayInterface as Relay;
-use Spiral\Goridge\SocketRelay;
-use Spiral\Goridge\StreamRelay;
+use Spiral\Goridge\SendPackageRelayInterface;
use Spiral\RoadRunner\Exception\RoadRunnerException;
/**
@@ -30,19 +29,15 @@ class Worker
// Send as response context to request worker termination
public const STOP = '{"stop":true}';
- /** @var Relay|StreamRelay|SocketRelay */
+ /** @var Relay */
private $relay;
- /** @var bool */
- private $optimizedRelay;
-
/**
* @param Relay $relay
*/
public function __construct(Relay $relay)
{
$this->relay = $relay;
- $this->optimizedRelay = method_exists($relay, 'sendPackage');
}
/**
@@ -89,7 +84,7 @@ class Worker
*/
public function send(string $payload = null, string $header = null): void
{
- if (!$this->optimizedRelay) {
+ if (!$this->relay instanceof SendPackageRelayInterface) {
if ($header === null) {
$this->relay->send('', Relay::PAYLOAD_CONTROL | Relay::PAYLOAD_NONE);
} else {