Skip to content

Commit ae37364

Browse files
committed
Фиксы
1 parent a92da0d commit ae37364

10 files changed

+39
-50
lines changed

src/Services/PSR/PSR7/Message.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function __construct(
7575
/**
7676
* @inheritDoc
7777
*/
78-
public function getProtocolVersion()
78+
public function getProtocolVersion() : string
7979
{
8080
if (!empty($this->httpVersion)) {
8181
return $this->httpVersion;
@@ -88,15 +88,15 @@ public function getProtocolVersion()
8888
/**
8989
* @inheritDoc
9090
*/
91-
public function withProtocolVersion($version)
91+
public function withProtocolVersion($version) : MessageInterface
9292
{
9393
return new static($this->request, $version, $this->body, $this->attributes);
9494
}
9595

9696
/**
9797
* @inheritDoc
9898
*/
99-
public function getHeaders()
99+
public function getHeaders() : array
100100
{
101101
$headers = $this->request->getHeaders()->toArray();
102102
foreach ($headers as &$value) {
@@ -110,23 +110,23 @@ public function getHeaders()
110110
/**
111111
* @inheritDoc
112112
*/
113-
public function hasHeader($name)
113+
public function hasHeader($name) : bool
114114
{
115115
return !empty($this->getHeader($name));
116116
}
117117

118118
/**
119119
* @inheritDoc
120120
*/
121-
public function getHeader($name)
121+
public function getHeader($name) : array
122122
{
123123
return (array)($this->request->getHeader($name) ?? []);
124124
}
125125

126126
/**
127127
* @inheritDoc
128128
*/
129-
public function getHeaderLine($name)
129+
public function getHeaderLine($name) : string
130130
{
131131
$value = $this->getHeader($name);
132132
if (count($value) === 0) {
@@ -139,7 +139,7 @@ public function getHeaderLine($name)
139139
/**
140140
* @inheritDoc
141141
*/
142-
public function withHeader($name, $value)
142+
public function withHeader($name, $value) : MessageInterface
143143
{
144144
$newRequest = $this->getClonedRequest();
145145
$newRequest->getHeaders()->add($name, $value);
@@ -150,7 +150,7 @@ public function withHeader($name, $value)
150150
/**
151151
* @inheritDoc
152152
*/
153-
public function withAddedHeader($name, $value)
153+
public function withAddedHeader($name, $value) : MessageInterface
154154
{
155155
if ($this->hasHeader($name)) {
156156
return $this;
@@ -165,7 +165,7 @@ public function withAddedHeader($name, $value)
165165
/**
166166
* @inheritDoc
167167
*/
168-
public function withoutHeader($name)
168+
public function withoutHeader($name) : MessageInterface
169169
{
170170
if (!$this->hasHeader($name)) {
171171
return $this;
@@ -180,7 +180,7 @@ public function withoutHeader($name)
180180
/**
181181
* @inheritDoc
182182
*/
183-
public function getBody()
183+
public function getBody() : StreamInterface
184184
{
185185
if (!$this->body) {
186186
$this->body = Utils::streamFor('');
@@ -192,7 +192,7 @@ public function getBody()
192192
/**
193193
* @inheritDoc
194194
*/
195-
public function withBody(StreamInterface $body)
195+
public function withBody(StreamInterface $body) : MessageInterface
196196
{
197197
if ($body === $this->body) {
198198
return $this;

src/Services/PSR/PSR7/PsrRequest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ class PsrRequest extends Message implements RequestInterface
1414
/**
1515
* @inheritDoc
1616
*/
17-
public function getRequestTarget()
17+
public function getRequestTarget() : string
1818
{
1919
return (string)$this->request->getRequestUri();
2020
}
2121

2222
/**
2323
* @inheritDoc
2424
*/
25-
public function withRequestTarget($requestTarget)
25+
public function withRequestTarget($requestTarget) : RequestInterface
2626
{
2727
$newRequest = $this->getClonedRequest();
2828
$newRequest->getServer()->set('REQUEST_URI', $requestTarget);
@@ -33,15 +33,15 @@ public function withRequestTarget($requestTarget)
3333
/**
3434
* @inheritDoc
3535
*/
36-
public function getMethod()
36+
public function getMethod() : string
3737
{
3838
return $this->request->getRequestMethod();
3939
}
4040

4141
/**
4242
* @inheritDoc
4343
*/
44-
public function withMethod($method)
44+
public function withMethod($method) : RequestInterface
4545
{
4646
$newRequest = $this->getClonedRequest();
4747
$newRequest->getServer()->set('REQUEST_METHOD', $method);
@@ -52,15 +52,15 @@ public function withMethod($method)
5252
/**
5353
* @inheritDoc
5454
*/
55-
public function getUri()
55+
public function getUri() : UriInterface
5656
{
5757
return $this->uri;
5858
}
5959

6060
/**
6161
* @inheritDoc
6262
*/
63-
public function withUri(UriInterface $uri, $preserveHost = false)
63+
public function withUri(UriInterface $uri, $preserveHost = false) : RequestInterface
6464
{
6565
$newRequest = $this->getClonedRequest();
6666
$newRequest->getServer()->set('REQUEST_URI', $uri);

src/Services/PSR/PSR7/PsrResponse.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Bitrix\Main\ArgumentTypeException;
66
use Bitrix\Main\HttpResponse;
77
use GuzzleHttp\Psr7\Utils;
8+
use Psr\Http\Message\MessageInterface;
89
use Psr\Http\Message\ResponseInterface;
910
use Psr\Http\Message\StreamInterface;
1011
use Serializable;
@@ -51,47 +52,47 @@ public function __construct(HttpResponse $response, ?string $httpVersion = null,
5152
/**
5253
* @inheritDoc
5354
*/
54-
public function getProtocolVersion()
55+
public function getProtocolVersion() : string
5556
{
5657
return $this->httpVersion;
5758
}
5859

5960
/**
6061
* @inheritDoc
6162
*/
62-
public function withProtocolVersion($version)
63+
public function withProtocolVersion($version) : MessageInterface
6364
{
6465
return new static($this->response, $version, $this->body);
6566
}
6667

6768
/**
6869
* @inheritDoc
6970
*/
70-
public function getHeaders()
71+
public function getHeaders() : array
7172
{
7273
return $this->response->getHeaders()->toArray();
7374
}
7475

7576
/**
7677
* @inheritDoc
7778
*/
78-
public function hasHeader($name)
79+
public function hasHeader($name) : bool
7980
{
8081
return !empty($this->getHeader($name));
8182
}
8283

8384
/**
8485
* @inheritDoc
8586
*/
86-
public function getHeader($name)
87+
public function getHeader($name) : array
8788
{
8889
return $this->response->getHeaders()->get($name, true);
8990
}
9091

9192
/**
9293
* @inheritDoc
9394
*/
94-
public function getHeaderLine($name)
95+
public function getHeaderLine($name) : string
9596
{
9697
$value = $this->getHeader($name);
9798
if (empty($value)) {
@@ -104,7 +105,7 @@ public function getHeaderLine($name)
104105
/**
105106
* @inheritDoc
106107
*/
107-
public function withHeader($name, $value)
108+
public function withHeader($name, $value) : MessageInterface
108109
{
109110
$newResponse = clone $this->response;
110111
$newResponse->getHeaders()->set($name, $value);
@@ -115,7 +116,7 @@ public function withHeader($name, $value)
115116
/**
116117
* @inheritDoc
117118
*/
118-
public function withAddedHeader($name, $value)
119+
public function withAddedHeader($name, $value) : MessageInterface
119120
{
120121
if ($this->hasHeader($name)) {
121122
return $this;
@@ -127,7 +128,7 @@ public function withAddedHeader($name, $value)
127128
/**
128129
* @inheritDoc
129130
*/
130-
public function withoutHeader($name)
131+
public function withoutHeader($name) : MessageInterface
131132
{
132133
if (!$this->hasHeader($name)) {
133134
return $this;
@@ -141,7 +142,7 @@ public function withoutHeader($name)
141142
/**
142143
* @inheritDoc
143144
*/
144-
public function getBody()
145+
public function getBody() : StreamInterface
145146
{
146147
if (!$this->body) {
147148
$this->body = Utils::streamFor($this->response->getContent());
@@ -154,7 +155,7 @@ public function getBody()
154155
* @inheritDoc
155156
* @throws ArgumentTypeException
156157
*/
157-
public function withBody(StreamInterface $body)
158+
public function withBody(StreamInterface $body) : MessageInterface
158159
{
159160
$newResponse = clone $this->response;
160161
$newResponse->setContent($body);
@@ -166,7 +167,7 @@ public function withBody(StreamInterface $body)
166167
/**
167168
* @inheritDoc
168169
*/
169-
public function getStatusCode()
170+
public function getStatusCode() : int
170171
{
171172
preg_match('/(\d+)\s+.*/', $this->response->getStatus(), $match);
172173
return (int)($match[1] ?? 200);
@@ -175,7 +176,7 @@ public function getStatusCode()
175176
/**
176177
* @inheritDoc
177178
*/
178-
public function withStatus($code, $reasonPhrase = '')
179+
public function withStatus($code, $reasonPhrase = '') : ResponseInterface
179180
{
180181
$newResponse = clone $this->response;
181182
$newResponse->getHeaders()->set('Status', implode(' ', [$code, $reasonPhrase]));
@@ -186,7 +187,7 @@ public function withStatus($code, $reasonPhrase = '')
186187
/**
187188
* @inheritDoc
188189
*/
189-
public function getReasonPhrase()
190+
public function getReasonPhrase() : string
190191
{
191192
preg_match('/\d+\s+(.*)/', $this->response->getStatus(), $match);
192193
return $match[1] ?? '';

src/Services/PSR/PSR7/ServerPsrRequest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getCookieParams(): array
3030
/**
3131
* @inheritDoc
3232
*/
33-
public function withCookieParams(array $cookies)
33+
public function withCookieParams(array $cookies) : ServerRequestInterface
3434
{
3535
$newRequest = $this->getClonedRequest();
3636
$newRequest->getCookieList()->setValues($cookies);
@@ -60,7 +60,7 @@ public function withQueryParams(array $query): ServerPsrRequest
6060
/**
6161
* @inheritDoc
6262
*/
63-
public function getUploadedFiles()
63+
public function getUploadedFiles() : array
6464
{
6565
return array_map(function (array $file) {
6666
if (is_array($file['tmp_name'])) {
@@ -90,7 +90,7 @@ public function getUploadedFiles()
9090
/**
9191
* @inheritDoc
9292
*/
93-
public function withUploadedFiles(array $uploadedFiles)
93+
public function withUploadedFiles(array $uploadedFiles) : ServerRequestInterface
9494
{
9595
$newRequest = $this->getClonedRequest();
9696
$newRequest->getFileList()->setValues($uploadedFiles);
@@ -109,7 +109,7 @@ public function getParsedBody()
109109
/**
110110
* @inheritDoc
111111
*/
112-
public function withParsedBody($data)
112+
public function withParsedBody($data) : ServerRequestInterface
113113
{
114114
$newRequest = $this->getClonedRequest();
115115
$newRequest->getPostList()->setValues($data);

tests/Cases/CompilerPass/ContainerAwareCompilerPassTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ public function testProcessOrdinaryService(): void
8383

8484
/**
8585
* Мок обработчика.
86-
*
87-
* @return mixed
8886
*/
8987
private function getStubService()
9088
{
@@ -95,8 +93,6 @@ private function getStubService()
9593

9694
/**
9795
* Мок обработчика.
98-
*
99-
* @return mixed
10096
*/
10197
private function getStubServiceNoContainerAware()
10298
{

tests/Cases/CompilerPass/MakePrivateServicePublicTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ public function testProcessNotInPublicableList(): void
118118

119119
/**
120120
* Мок сервиса.
121-
*
122-
* @return mixed
123121
*/
124122
private function getStubService()
125123
{

tests/Cases/CompilerPass/TwigExtensionTaggedServicesPassTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ public function testProcessWithoutTaggedService(): void
7676

7777
/**
7878
* Мок обработчика.
79-
*
80-
* @return mixed
8179
*/
8280
private function getStubService()
8381
{

tests/Cases/CompilerPass/ValidateServiceDefinitionsTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ public function dataProviderKnownServices() : array
124124

125125
/**
126126
* Мок обработчика.
127-
*
128-
* @return mixed
129127
*/
130128
private function getStubService()
131129
{

tests/Cases/ErrorScreenTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public function testDie() : void
4646

4747
/**
4848
* Мок CMain.
49-
*
50-
* @return mixed
5149
*/
5250
private function getMockCmain()
5351
{

tests/Cases/PhpLoaderSettingsBitrixTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PhpLoaderSettingsBitrixTest extends BitrixableTestCase
3131
/**
3232
* @var AppKernel
3333
*/
34-
private $kernel;
34+
protected static $kernel;
3535

3636
/**
3737
* @var string $pathYamlConfig Путь к конфигу.
@@ -58,8 +58,8 @@ protected function setUp(): void
5858

5959
$this->dummyContainer = $this->container->container();
6060

61-
$this->kernel = $this->dummyContainer->get('kernel');
62-
$locator = new FileLocator($this->kernel);
61+
$this::{$kernel} = $this->dummyContainer->get('kernel');
62+
$locator = new FileLocator($this::{$kernel});
6363

6464
$this->obTestObject = new PhpLoaderSettingsBitrix(
6565
$this->dummyContainer,

0 commit comments

Comments
 (0)