From fdcb88e73cb532cd980d1f66e6bdccd4c0e9b3c4 Mon Sep 17 00:00:00 2001 From: Lisachenko Alexander Date: Tue, 12 Jan 2021 16:15:44 +0600 Subject: [PATCH 1/3] Clean extra @author annotation from source files --- src/FCGI.php | 2 -- src/FCGI/FrameParser.php | 2 -- src/FCGI/Record.php | 2 -- src/FCGI/Record/AbortRequest.php | 2 -- src/FCGI/Record/BeginRequest.php | 2 -- src/FCGI/Record/Data.php | 2 -- src/FCGI/Record/EndRequest.php | 2 -- src/FCGI/Record/GetValues.php | 2 -- src/FCGI/Record/GetValuesResult.php | 2 -- src/FCGI/Record/Params.php | 2 -- src/FCGI/Record/Stderr.php | 2 -- src/FCGI/Record/Stdin.php | 2 -- src/FCGI/Record/Stdout.php | 2 -- src/FCGI/Record/UnknownType.php | 2 -- tests/FCGI/FrameParserTest.php | 3 --- tests/FCGI/Record/AbortRequestTest.php | 3 --- tests/FCGI/Record/BeginRequestTest.php | 3 --- tests/FCGI/Record/DataTest.php | 3 --- tests/FCGI/Record/EndRequestTest.php | 3 --- tests/FCGI/Record/GetValuesResultTest.php | 3 --- tests/FCGI/Record/GetValuesTest.php | 3 --- tests/FCGI/Record/ParamsTest.php | 3 --- tests/FCGI/Record/StderrTest.php | 3 --- tests/FCGI/Record/StdinTest.php | 3 --- tests/FCGI/Record/StdoutTest.php | 3 --- tests/FCGI/Record/UnknownTypeTest.php | 3 --- tests/FCGI/RecordTest.php | 3 --- 27 files changed, 67 deletions(-) diff --git a/src/FCGI.php b/src/FCGI.php index 4de8b10..59b8845 100644 --- a/src/FCGI.php +++ b/src/FCGI.php @@ -13,8 +13,6 @@ /** * FCGI constants. - * - * @author Alexander.Lisachenko */ class FCGI { diff --git a/src/FCGI/FrameParser.php b/src/FCGI/FrameParser.php index 17b0570..f7f15c2 100644 --- a/src/FCGI/FrameParser.php +++ b/src/FCGI/FrameParser.php @@ -15,8 +15,6 @@ /** * Utility class to simplify parsing of FCGI protocol data. - * - * @author Alexander.Lisachenko */ class FrameParser { diff --git a/src/FCGI/Record.php b/src/FCGI/Record.php index fe4f1be..16ca285 100644 --- a/src/FCGI/Record.php +++ b/src/FCGI/Record.php @@ -16,8 +16,6 @@ /** * FCGI record. - * - * @author Alexander.Lisachenko */ class Record { diff --git a/src/FCGI/Record/AbortRequest.php b/src/FCGI/Record/AbortRequest.php index aaa9599..4e35320 100644 --- a/src/FCGI/Record/AbortRequest.php +++ b/src/FCGI/Record/AbortRequest.php @@ -16,8 +16,6 @@ /** * The Web server sends a FCGI_ABORT_REQUEST record to abort a request - * - * @author Alexander.Lisachenko */ class AbortRequest extends Record { diff --git a/src/FCGI/Record/BeginRequest.php b/src/FCGI/Record/BeginRequest.php index 6457e91..8211dc9 100644 --- a/src/FCGI/Record/BeginRequest.php +++ b/src/FCGI/Record/BeginRequest.php @@ -16,8 +16,6 @@ /** * The Web server sends a FCGI_BEGIN_REQUEST record to start a request. - * - * @author Alexander.Lisachenko */ class BeginRequest extends Record { diff --git a/src/FCGI/Record/Data.php b/src/FCGI/Record/Data.php index 077d599..cf251e0 100644 --- a/src/FCGI/Record/Data.php +++ b/src/FCGI/Record/Data.php @@ -18,8 +18,6 @@ * Data binary stream * * FCGI_DATA is a second stream record type used to send additional data to the application. - * - * @author Alexander.Lisachenko */ class Data extends Record { diff --git a/src/FCGI/Record/EndRequest.php b/src/FCGI/Record/EndRequest.php index a94438f..1396a8d 100644 --- a/src/FCGI/Record/EndRequest.php +++ b/src/FCGI/Record/EndRequest.php @@ -17,8 +17,6 @@ /** * The application sends a FCGI_END_REQUEST record to terminate a request, either because the application * has processed the request or because the application has rejected the request. - * - * @author Alexander.Lisachenko */ class EndRequest extends Record { diff --git a/src/FCGI/Record/GetValues.php b/src/FCGI/Record/GetValues.php index c16e9a3..0a24a83 100644 --- a/src/FCGI/Record/GetValues.php +++ b/src/FCGI/Record/GetValues.php @@ -32,8 +32,6 @@ * FCGI_MAX_REQS: The maximum number of concurrent requests this application will accept, e.g. "1" or "50". * FCGI_MPXS_CONNS: "0" if this application does not multiplex connections (i.e. handle concurrent requests * over each connection), "1" otherwise. - * - * @author Alexander.Lisachenko */ class GetValues extends Params { diff --git a/src/FCGI/Record/GetValuesResult.php b/src/FCGI/Record/GetValuesResult.php index df044c4..68196f7 100644 --- a/src/FCGI/Record/GetValuesResult.php +++ b/src/FCGI/Record/GetValuesResult.php @@ -32,8 +32,6 @@ * FCGI_MAX_REQS: The maximum number of concurrent requests this application will accept, e.g. "1" or "50". * FCGI_MPXS_CONNS: "0" if this application does not multiplex connections (i.e. handle concurrent requests * over each connection), "1" otherwise. - * - * @author Alexander.Lisachenko */ class GetValuesResult extends Params { diff --git a/src/FCGI/Record/Params.php b/src/FCGI/Record/Params.php index e430362..b15a32e 100644 --- a/src/FCGI/Record/Params.php +++ b/src/FCGI/Record/Params.php @@ -16,8 +16,6 @@ /** * Params request record - * - * @author Alexander.Lisachenko */ class Params extends Record { diff --git a/src/FCGI/Record/Stderr.php b/src/FCGI/Record/Stderr.php index c49a658..f170405 100644 --- a/src/FCGI/Record/Stderr.php +++ b/src/FCGI/Record/Stderr.php @@ -18,8 +18,6 @@ * Stderr binary stream * * FCGI_STDERR is a stream record for sending arbitrary data from the application to the Web server - * - * @author Alexander.Lisachenko */ class Stderr extends Record { diff --git a/src/FCGI/Record/Stdin.php b/src/FCGI/Record/Stdin.php index cbdd9c9..9524a59 100644 --- a/src/FCGI/Record/Stdin.php +++ b/src/FCGI/Record/Stdin.php @@ -18,8 +18,6 @@ * Stdin binary stream * * FCGI_STDIN is a stream record type used in sending arbitrary data from the Web server to the application - * - * @author Alexander.Lisachenko */ class Stdin extends Record { diff --git a/src/FCGI/Record/Stdout.php b/src/FCGI/Record/Stdout.php index ebcd6b2..d627aef 100644 --- a/src/FCGI/Record/Stdout.php +++ b/src/FCGI/Record/Stdout.php @@ -18,8 +18,6 @@ * Stdout binary stream * * FCGI_STDOUT is a stream record for sending arbitrary data from the application to the Web server - * - * @author Alexander.Lisachenko */ class Stdout extends Record { diff --git a/src/FCGI/Record/UnknownType.php b/src/FCGI/Record/UnknownType.php index 5557d4e..7e9267e 100644 --- a/src/FCGI/Record/UnknownType.php +++ b/src/FCGI/Record/UnknownType.php @@ -21,8 +21,6 @@ * To provide for this evolution, the protocol includes the FCGI_UNKNOWN_TYPE management record. * When an application receives a management record whose type T it does not understand, the application responds * with {FCGI_UNKNOWN_TYPE, 0, {T}}. - * - * @author Alexander.Lisachenko */ class UnknownType extends Record { diff --git a/tests/FCGI/FrameParserTest.php b/tests/FCGI/FrameParserTest.php index 6eb15e1..654ebf1 100644 --- a/tests/FCGI/FrameParserTest.php +++ b/tests/FCGI/FrameParserTest.php @@ -15,9 +15,6 @@ use Lisachenko\Protocol\FCGI\Record\BeginRequest; use Lisachenko\Protocol\FCGI\Record\Params; -/** - * @author Alexander.Lisachenko - */ class FrameParserTest extends TestCase { public function testHasFrame(): void diff --git a/tests/FCGI/Record/AbortRequestTest.php b/tests/FCGI/Record/AbortRequestTest.php index 9b5e5c6..d408ea5 100644 --- a/tests/FCGI/Record/AbortRequestTest.php +++ b/tests/FCGI/Record/AbortRequestTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class AbortRequestTest extends TestCase { protected static string $rawMessage = '0102000100000000'; diff --git a/tests/FCGI/Record/BeginRequestTest.php b/tests/FCGI/Record/BeginRequestTest.php index a468e4a..c7bf003 100644 --- a/tests/FCGI/Record/BeginRequestTest.php +++ b/tests/FCGI/Record/BeginRequestTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class BeginRequestTest extends TestCase { protected static string $rawMessage = '01010000000800000001010000000000'; diff --git a/tests/FCGI/Record/DataTest.php b/tests/FCGI/Record/DataTest.php index d3f6913..fc6a6e5 100644 --- a/tests/FCGI/Record/DataTest.php +++ b/tests/FCGI/Record/DataTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class DataTest extends TestCase { protected static string $rawMessage = '01080000000404007465737400000000'; diff --git a/tests/FCGI/Record/EndRequestTest.php b/tests/FCGI/Record/EndRequestTest.php index f0b8a33..ceddf6f 100644 --- a/tests/FCGI/Record/EndRequestTest.php +++ b/tests/FCGI/Record/EndRequestTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class EndRequestTest extends TestCase { protected static string $rawMessage = '01030000000800000000006400000000'; diff --git a/tests/FCGI/Record/GetValuesResultTest.php b/tests/FCGI/Record/GetValuesResultTest.php index eac888c..7680fae 100644 --- a/tests/FCGI/Record/GetValuesResultTest.php +++ b/tests/FCGI/Record/GetValuesResultTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class GetValuesResultTest extends TestCase { protected static string $rawMessage = '010a0000001206000f01464347495f4d5058535f434f4e4e5331000000000000'; diff --git a/tests/FCGI/Record/GetValuesTest.php b/tests/FCGI/Record/GetValuesTest.php index b58be0b..5f02be6 100644 --- a/tests/FCGI/Record/GetValuesTest.php +++ b/tests/FCGI/Record/GetValuesTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class GetValuesTest extends TestCase { protected static string $rawMessage = '01090000001107000f00464347495f4d5058535f434f4e4e5300000000000000'; diff --git a/tests/FCGI/Record/ParamsTest.php b/tests/FCGI/Record/ParamsTest.php index 4b271ef..c000c94 100644 --- a/tests/FCGI/Record/ParamsTest.php +++ b/tests/FCGI/Record/ParamsTest.php @@ -14,9 +14,6 @@ use Lisachenko\Protocol\FCGI; use PHPUnit\Framework\TestCase; -/** - * @author Alexander.Lisachenko - */ class ParamsTest extends TestCase { protected static string $rawMessage =' diff --git a/tests/FCGI/Record/StderrTest.php b/tests/FCGI/Record/StderrTest.php index 5ff9ba5..d9df31d 100644 --- a/tests/FCGI/Record/StderrTest.php +++ b/tests/FCGI/Record/StderrTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class StderrTest extends TestCase { protected static string $rawMessage = '01070000000404007465737400000000'; diff --git a/tests/FCGI/Record/StdinTest.php b/tests/FCGI/Record/StdinTest.php index cd23812..0b906e6 100644 --- a/tests/FCGI/Record/StdinTest.php +++ b/tests/FCGI/Record/StdinTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class StdinTest extends TestCase { protected static string $rawMessage = '01050000000404007465737400000000'; diff --git a/tests/FCGI/Record/StdoutTest.php b/tests/FCGI/Record/StdoutTest.php index c899acf..91de8f2 100644 --- a/tests/FCGI/Record/StdoutTest.php +++ b/tests/FCGI/Record/StdoutTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class StdoutTest extends TestCase { protected static string $rawMessage = '01060000000404007465737400000000'; diff --git a/tests/FCGI/Record/UnknownTypeTest.php b/tests/FCGI/Record/UnknownTypeTest.php index a8bba3d..8564e0d 100644 --- a/tests/FCGI/Record/UnknownTypeTest.php +++ b/tests/FCGI/Record/UnknownTypeTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class UnknownTypeTest extends TestCase { protected static string $rawMessage = '010b0000000800002a57544621000000'; diff --git a/tests/FCGI/RecordTest.php b/tests/FCGI/RecordTest.php index 7284a06..48ae5bd 100644 --- a/tests/FCGI/RecordTest.php +++ b/tests/FCGI/RecordTest.php @@ -14,9 +14,6 @@ use PHPUnit\Framework\TestCase; use Lisachenko\Protocol\FCGI; -/** - * @author Alexander.Lisachenko - */ class RecordTest extends TestCase { // from the wireshark captured traffic From f8ebe58d69535366499395d6c7c45a12dc86bb79 Mon Sep 17 00:00:00 2001 From: Lisachenko Alexander Date: Tue, 12 Jan 2021 16:33:03 +0600 Subject: [PATCH 2/3] Make constructor argument required for records --- src/FCGI/Record/AbortRequest.php | 2 +- src/FCGI/Record/Data.php | 2 +- src/FCGI/Record/GetValues.php | 2 +- src/FCGI/Record/GetValuesResult.php | 2 +- src/FCGI/Record/Params.php | 2 +- src/FCGI/Record/Stderr.php | 2 +- src/FCGI/Record/Stdin.php | 2 +- src/FCGI/Record/Stdout.php | 2 +- src/FCGI/Record/UnknownType.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/FCGI/Record/AbortRequest.php b/src/FCGI/Record/AbortRequest.php index 4e35320..e4a3f82 100644 --- a/src/FCGI/Record/AbortRequest.php +++ b/src/FCGI/Record/AbortRequest.php @@ -19,7 +19,7 @@ */ class AbortRequest extends Record { - public function __construct(int $requestId = 0) + public function __construct(int $requestId) { $this->type = FCGI::ABORT_REQUEST; $this->setRequestId($requestId); diff --git a/src/FCGI/Record/Data.php b/src/FCGI/Record/Data.php index cf251e0..ef1d530 100644 --- a/src/FCGI/Record/Data.php +++ b/src/FCGI/Record/Data.php @@ -21,7 +21,7 @@ */ class Data extends Record { - public function __construct(string $contentData = '') + public function __construct(string $contentData) { $this->type = FCGI::DATA; $this->setContentData($contentData); diff --git a/src/FCGI/Record/GetValues.php b/src/FCGI/Record/GetValues.php index 0a24a83..84119a6 100644 --- a/src/FCGI/Record/GetValues.php +++ b/src/FCGI/Record/GetValues.php @@ -42,7 +42,7 @@ class GetValues extends Params * * @phpstan-param list $keys */ - public function __construct(array $keys = []) + public function __construct(array $keys) { parent::__construct(array_fill_keys($keys, '')); $this->type = FCGI::GET_VALUES; diff --git a/src/FCGI/Record/GetValuesResult.php b/src/FCGI/Record/GetValuesResult.php index 68196f7..259f3a5 100644 --- a/src/FCGI/Record/GetValuesResult.php +++ b/src/FCGI/Record/GetValuesResult.php @@ -40,7 +40,7 @@ class GetValuesResult extends Params * * @phpstan-param array $values */ - public function __construct(array $values = []) + public function __construct(array $values) { parent::__construct($values); $this->type = FCGI::GET_VALUES_RESULT; diff --git a/src/FCGI/Record/Params.php b/src/FCGI/Record/Params.php index b15a32e..40fe6ec 100644 --- a/src/FCGI/Record/Params.php +++ b/src/FCGI/Record/Params.php @@ -32,7 +32,7 @@ class Params extends Record * * @phpstan-param array $values */ - public function __construct(array $values = []) + public function __construct(array $values) { $this->type = FCGI::PARAMS; $this->values = $values; diff --git a/src/FCGI/Record/Stderr.php b/src/FCGI/Record/Stderr.php index f170405..022823d 100644 --- a/src/FCGI/Record/Stderr.php +++ b/src/FCGI/Record/Stderr.php @@ -21,7 +21,7 @@ */ class Stderr extends Record { - public function __construct(string $contentData = '') + public function __construct(string $contentData) { $this->type = FCGI::STDERR; $this->setContentData($contentData); diff --git a/src/FCGI/Record/Stdin.php b/src/FCGI/Record/Stdin.php index 9524a59..39469b1 100644 --- a/src/FCGI/Record/Stdin.php +++ b/src/FCGI/Record/Stdin.php @@ -21,7 +21,7 @@ */ class Stdin extends Record { - public function __construct(string $contentData = '') + public function __construct(string $contentData) { $this->type = FCGI::STDIN; $this->setContentData($contentData); diff --git a/src/FCGI/Record/Stdout.php b/src/FCGI/Record/Stdout.php index d627aef..b80e243 100644 --- a/src/FCGI/Record/Stdout.php +++ b/src/FCGI/Record/Stdout.php @@ -21,7 +21,7 @@ */ class Stdout extends Record { - public function __construct(string $contentData = '') + public function __construct(string $contentData) { $this->type = FCGI::STDOUT; $this->setContentData($contentData); diff --git a/src/FCGI/Record/UnknownType.php b/src/FCGI/Record/UnknownType.php index 7e9267e..8635c9d 100644 --- a/src/FCGI/Record/UnknownType.php +++ b/src/FCGI/Record/UnknownType.php @@ -34,7 +34,7 @@ class UnknownType extends Record */ protected string $reserved1; - public function __construct(int $type = 0, string $reserved = '') + public function __construct(int $type, string $reserved = '') { $this->type = FCGI::UNKNOWN_TYPE; $this->type1 = $type; From 22a18a79db39209d1c5e8ad4a1f63a9f94dfce51 Mon Sep 17 00:00:00 2001 From: Lisachenko Alexander Date: Tue, 12 Jan 2021 16:34:05 +0600 Subject: [PATCH 3/3] Add PhpStorm meta file to have better completion in IDE --- .phpstorm.meta.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .phpstorm.meta.php diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php new file mode 100644 index 0000000..39d33e1 --- /dev/null +++ b/.phpstorm.meta.php @@ -0,0 +1,56 @@ + + * This source file is subject to the license that is bundled + * with this source code in the file LICENSE. + */ + +declare(strict_types=1); + +namespace PHPSTORM_META; + +expectedArguments( + \Lisachenko\Protocol\FCGI\Record\BeginRequest::__construct(), + 0, + \Lisachenko\Protocol\FCGI::RESPONDER, + \Lisachenko\Protocol\FCGI::AUTHORIZER, + \Lisachenko\Protocol\FCGI::FILTER, +); + +expectedArguments( + \Lisachenko\Protocol\FCGI\Record\BeginRequest::__construct(), + 1, + \Lisachenko\Protocol\FCGI::KEEP_CONN, +); + +expectedArguments( + \Lisachenko\Protocol\FCGI\Record\EndRequest::__construct(), + 0, + \Lisachenko\Protocol\FCGI::KEEP_CONN, + \Lisachenko\Protocol\FCGI::REQUEST_COMPLETE, + \Lisachenko\Protocol\FCGI::CANT_MPX_CONN, + \Lisachenko\Protocol\FCGI::OVERLOADED, + \Lisachenko\Protocol\FCGI::UNKNOWN_ROLE +); + +expectedReturnValues( + \Lisachenko\Protocol\FCGI\Record::getVersion(), + \Lisachenko\Protocol\FCGI::VERSION_1 +); + +expectedReturnValues( + \Lisachenko\Protocol\FCGI\Record::getType(), + \Lisachenko\Protocol\FCGI::BEGIN_REQUEST, + \Lisachenko\Protocol\FCGI::ABORT_REQUEST, + \Lisachenko\Protocol\FCGI::END_REQUEST, + \Lisachenko\Protocol\FCGI::PARAMS, + \Lisachenko\Protocol\FCGI::STDIN, + \Lisachenko\Protocol\FCGI::STDOUT, + \Lisachenko\Protocol\FCGI::STDERR, + \Lisachenko\Protocol\FCGI::DATA, + \Lisachenko\Protocol\FCGI::GET_VALUES, + \Lisachenko\Protocol\FCGI::GET_VALUES_RESULT, + \Lisachenko\Protocol\FCGI::UNKNOWN_TYPE, +);