summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-10-12 12:40:25 +0300
committerWolfy-J <[email protected]>2019-10-12 12:40:25 +0300
commit622fb02507ca41b700d4d54f93f9bfa54020d933 (patch)
tree955bd429bea778252403ab7a4cb16fd06e6c631c /src
parent5d4a699daa0a3696a5bac04cf5568310ff2b7a5c (diff)
- polishing health service tests
- adding auto-CS tools
Diffstat (limited to 'src')
-rw-r--r--src/Diactoros/ServerRequestFactory.php1
-rw-r--r--src/Diactoros/StreamFactory.php1
-rw-r--r--src/Diactoros/UploadedFileFactory.php1
-rw-r--r--src/Exception/MetricException.php1
-rw-r--r--src/Exception/RoadRunnerException.php1
-rw-r--r--src/Exceptions/RoadRunnerException.php1
-rw-r--r--src/HttpClient.php6
-rw-r--r--src/Metrics.php9
-rw-r--r--src/MetricsInterface.php1
-rw-r--r--src/PSR7Client.php3
-rw-r--r--src/Worker.php11
11 files changed, 24 insertions, 12 deletions
diff --git a/src/Diactoros/ServerRequestFactory.php b/src/Diactoros/ServerRequestFactory.php
index d4ec92b9..3fcf8e29 100644
--- a/src/Diactoros/ServerRequestFactory.php
+++ b/src/Diactoros/ServerRequestFactory.php
@@ -1,4 +1,5 @@
<?php
+
/**
* High-performance PHP process supervisor and load balancer written in Go
*
diff --git a/src/Diactoros/StreamFactory.php b/src/Diactoros/StreamFactory.php
index 1a7f975e..da0d52ec 100644
--- a/src/Diactoros/StreamFactory.php
+++ b/src/Diactoros/StreamFactory.php
@@ -1,4 +1,5 @@
<?php
+
/**
* High-performance PHP process supervisor and load balancer written in Go
*
diff --git a/src/Diactoros/UploadedFileFactory.php b/src/Diactoros/UploadedFileFactory.php
index 36a0554e..4f09fb23 100644
--- a/src/Diactoros/UploadedFileFactory.php
+++ b/src/Diactoros/UploadedFileFactory.php
@@ -1,4 +1,5 @@
<?php
+
/**
* High-performance PHP process supervisor and load balancer written in Go
*
diff --git a/src/Exception/MetricException.php b/src/Exception/MetricException.php
index 6f2e7fde..d5b738b8 100644
--- a/src/Exception/MetricException.php
+++ b/src/Exception/MetricException.php
@@ -1,4 +1,5 @@
<?php
+
/**
* Spiral Framework.
*
diff --git a/src/Exception/RoadRunnerException.php b/src/Exception/RoadRunnerException.php
index 0f8d5def..f83c3dd4 100644
--- a/src/Exception/RoadRunnerException.php
+++ b/src/Exception/RoadRunnerException.php
@@ -1,4 +1,5 @@
<?php
+
/**
* High-performance PHP process supervisor and load balancer written in Go
*
diff --git a/src/Exceptions/RoadRunnerException.php b/src/Exceptions/RoadRunnerException.php
index b044a16e..43967893 100644
--- a/src/Exceptions/RoadRunnerException.php
+++ b/src/Exceptions/RoadRunnerException.php
@@ -1,4 +1,5 @@
<?php
+
/**
* Spiral Framework.
*
diff --git a/src/HttpClient.php b/src/HttpClient.php
index d2862ad8..6308eabc 100644
--- a/src/HttpClient.php
+++ b/src/HttpClient.php
@@ -1,4 +1,5 @@
<?php
+
/**
* High-performance PHP process supervisor and load balancer written in Go
*
@@ -30,7 +31,8 @@ final class HttpClient
}
/**
- * @return array|null Request information as ['ctx'=>[], 'body'=>string] or null if termination request or invalid context.
+ * @return array|null Request information as ['ctx'=>[], 'body'=>string]
+ * or null if termination request or invalid context.
*/
public function acceptRequest()
{
@@ -58,7 +60,7 @@ final class HttpClient
* key MUST be a header name, and each value MUST be an array of strings
* for that header.
*/
- public function respond(int $status, string $body, array $headers = [])
+ public function respond(int $status, string $body, array $headers = []): void
{
if (empty($headers)) {
// this is required to represent empty header set as map and not as array
diff --git a/src/Metrics.php b/src/Metrics.php
index d204a585..6fe4c4f5 100644
--- a/src/Metrics.php
+++ b/src/Metrics.php
@@ -1,4 +1,5 @@
<?php
+
/**
* Spiral Framework.
*
@@ -38,7 +39,7 @@ final class Metrics implements MetricsInterface
*
* @throws MetricException
*/
- public function add(string $name, float $value, array $labels = [])
+ public function add(string $name, float $value, array $labels = []): void
{
try {
$this->rpc->call('metrics.Add', compact('name', 'value', 'labels'));
@@ -56,7 +57,7 @@ final class Metrics implements MetricsInterface
*
* @throws MetricException
*/
- public function sub(string $name, float $value, array $labels = [])
+ public function sub(string $name, float $value, array $labels = []): void
{
try {
$this->rpc->call('metrics.Sub', compact('name', 'value', 'labels'));
@@ -74,7 +75,7 @@ final class Metrics implements MetricsInterface
*
* @throws MetricException
*/
- public function observe(string $name, float $value, array $labels = [])
+ public function observe(string $name, float $value, array $labels = []): void
{
try {
$this->rpc->call('metrics.Observe', compact('name', 'value', 'labels'));
@@ -92,7 +93,7 @@ final class Metrics implements MetricsInterface
*
* @throws MetricException
*/
- public function set(string $name, float $value, array $labels = [])
+ public function set(string $name, float $value, array $labels = []): void
{
try {
$this->rpc->call('metrics.Set', compact('name', 'value', 'labels'));
diff --git a/src/MetricsInterface.php b/src/MetricsInterface.php
index a809536c..e0e2260a 100644
--- a/src/MetricsInterface.php
+++ b/src/MetricsInterface.php
@@ -1,4 +1,5 @@
<?php
+
/**
* Spiral Framework.
*
diff --git a/src/PSR7Client.php b/src/PSR7Client.php
index 4efb3f04..4250e6b9 100644
--- a/src/PSR7Client.php
+++ b/src/PSR7Client.php
@@ -1,4 +1,5 @@
<?php
+
/**
* High-performance PHP process supervisor and load balancer written in Go
*
@@ -113,7 +114,7 @@ class PSR7Client
*
* @param ResponseInterface $response
*/
- public function respond(ResponseInterface $response)
+ public function respond(ResponseInterface $response): void
{
$this->httpClient->respond(
$response->getStatusCode(),
diff --git a/src/Worker.php b/src/Worker.php
index 2659af5c..87dcc9ce 100644
--- a/src/Worker.php
+++ b/src/Worker.php
@@ -1,4 +1,5 @@
<?php
+
/**
* High-performance PHP process supervisor and load balancer written in Go
*
@@ -25,7 +26,7 @@ use Spiral\RoadRunner\Exception\RoadRunnerException;
class Worker
{
// Send as response context to request worker termination
- const STOP = '{"stop":true}';
+ public const STOP = '{"stop":true}';
/** @var Relay */
private $relay;
@@ -80,7 +81,7 @@ class Worker
* @param string|null $payload
* @param string|null $header
*/
- public function send(string $payload = null, string $header = null)
+ public function send(string $payload = null, string $header = null): void
{
if (is_null($header)) {
$this->relay->send($header, Relay::PAYLOAD_CONTROL | Relay::PAYLOAD_NONE);
@@ -101,7 +102,7 @@ class Worker
*
* @param string $message
*/
- public function error(string $message)
+ public function error(string $message): void
{
$this->relay->send(
$message,
@@ -118,7 +119,7 @@ class Worker
*
* @throws GoridgeException
*/
- public function stop()
+ public function stop(): void
{
$this->send(null, self::STOP);
}
@@ -143,7 +144,7 @@ class Worker
$p = json_decode($body, true);
if ($p === false) {
- throw new RoadRunnerException("invalid task context, JSON payload is expected");
+ throw new RoadRunnerException('invalid task context, JSON payload is expected');
}
// PID negotiation (socket connections only)