Skip to content

Commit e5de7b0

Browse files
committed
Fixes
1 parent e03e2d9 commit e5de7b0

File tree

8 files changed

+27
-80
lines changed

8 files changed

+27
-80
lines changed

Diff for: .github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ updates:
44
package-ecosystem: composer
55
directory: "/"
66
schedule:
7-
interval: weekly
7+
interval: monthly
88
versioning-strategy: auto
99
groups:
1010
dev-dependencies:

Diff for: .github/workflows/main.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
strategy:
1010
matrix:
11-
php: [8.0, 8.1, 8.2, 8.3]
11+
php: [8.1, 8.2, 8.3]
1212

1313
steps:
1414
- name: Checkout code
@@ -32,9 +32,6 @@ jobs:
3232
- name: Execute PHP Stan
3333
run: vendor/bin/phpstan
3434

35-
- name: Execute Rector
36-
run: vendor/bin/rector --dry-run
37-
3835
- name: Run test suite
3936
run: |
4037
php -S 127.0.0.1:8000 -t tests/data/app >/dev/null 2>&1 &

Diff for: composer.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,19 @@
1818
],
1919
"homepage": "https://codeception.com/",
2020
"require": {
21-
"php": "^8.0",
21+
"php": "^8.1",
2222
"ext-json": "*",
2323
"codeception/codeception": "*@dev",
2424
"codeception/lib-innerbrowser": "*@dev",
2525
"guzzlehttp/guzzle": "^7.4",
26-
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0"
26+
"symfony/browser-kit": "^5.4 | ^6.0 | ^7.0"
2727
},
2828
"require-dev": {
2929
"ext-curl": "*",
3030
"squizlabs/php_codesniffer": "^3.10",
3131
"phpstan/phpstan": "^1.10",
32-
"rector/rector": "^1.0",
3332
"aws/aws-sdk-php": "^3.199",
34-
"codeception/module-rest": "^2.0 || *@dev"
33+
"codeception/module-rest": "^2.0 | *@dev"
3534
},
3635
"conflict": {
3736
"codeception/codeception": "<5.0",

Diff for: phpcs.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
33
<description>The coding standard.</description>
44

5-
<config name="testVersion" value="8.0-"/>
5+
<config name="testVersion" value="8.1-"/>
66

77
<file>src</file>
88

@@ -11,12 +11,10 @@
1111
<arg name="parallel" value="5"/>
1212
<arg value="np"/>
1313

14-
<!-- Don't hide tokenizer exceptions -->
1514
<rule ref="Internal.Tokenizer.Exception">
1615
<type>error</type>
1716
</rule>
18-
19-
<!-- Include the whole PSR12 standard -->
17+
2018
<rule ref="PSR12"/>
2119

2220
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">

Diff for: phpstan.neon

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
parameters:
22
paths:
33
- ./src
4-
# The level 9 is the highest level (with check for mixed type)
5-
level: 6
4+
level: 5

Diff for: rector.php

-47
This file was deleted.

Diff for: src/Codeception/Lib/Connector/Guzzle.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected function createResponse(Psr7Response $psr7Response): BrowserKitRespons
136136
$matches
137137
);
138138

139-
if (($matchesMeta === 0 || $matchesMeta === false) && isset($headers['Refresh'])) {
139+
if (!$matchesMeta && isset($headers['Refresh'])) {
140140
// match by header
141141
preg_match(
142142
'#^\s*(\d*)\s*;\s*url=(.*)#i',
@@ -181,7 +181,7 @@ protected function getAbsoluteUri(string $uri): string
181181
return Uri::mergeUrls((string)$baseUri, $uri);
182182
}
183183

184-
protected function doRequest(object $request): BrowserKitResponse
184+
protected function doRequest(object $request)
185185
{
186186
/** @var BrowserKitRequest $request **/
187187
$guzzleRequest = new Psr7Request(
@@ -208,12 +208,12 @@ protected function doRequest(object $request): BrowserKitResponse
208208
} else {
209209
$response = $this->client->send($guzzleRequest, $options);
210210
}
211-
} catch (RequestException $requestException) {
212-
if (!$requestException->hasResponse()) {
213-
throw $requestException;
211+
} catch (RequestException $exception) {
212+
if (!$exception->hasResponse()) {
213+
throw $exception;
214214
}
215215

216-
$response = $requestException->getResponse();
216+
$response = $exception->getResponse();
217217
}
218218

219219
// @phpstan-ignore-next-line
@@ -223,10 +223,10 @@ protected function doRequest(object $request): BrowserKitResponse
223223
/**
224224
* @return array<string, mixed>
225225
*/
226-
protected function extractHeaders(BrowserKitRequest $browserKitRequest): array
226+
protected function extractHeaders(BrowserKitRequest $request): array
227227
{
228228
$headers = [];
229-
$server = $browserKitRequest->getServer();
229+
$server = $request->getServer();
230230

231231
$contentHeaders = ['Content-Length' => true, 'Content-Md5' => true, 'Content-Type' => true];
232232
foreach ($server as $header => $val) {
@@ -310,7 +310,7 @@ protected function mapFiles(array $requestFiles, ?string $arrayName = ''): array
310310
{
311311
$files = [];
312312
foreach ($requestFiles as $name => $info) {
313-
if ($arrayName !== null && $arrayName !== '' && $arrayName !== '0') {
313+
if (!empty($arrayName)) {
314314
$name = $arrayName . '[' . $name . ']';
315315
}
316316

Diff for: src/Codeception/Module/PhpBrowser.php

+10-9
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,19 @@ class PhpBrowser extends InnerBrowser implements Remote, MultiSession
121121
'connect_timeout'
122122
];
123123

124+
/**
125+
* @var Guzzle
126+
*/
124127
public ?AbstractBrowser $client = null;
125128

126129
public ?GuzzleClient $guzzle = null;
127130

128-
public function _initialize(): void
131+
public function _initialize()
129132
{
130133
$this->_initializeSession();
131134
}
132135

133-
public function _before(TestInterface $test): void
136+
public function _before(TestInterface $test)
134137
{
135138
if (!$this->client instanceof AbstractBrowser) {
136139
$this->client = new Guzzle();
@@ -139,7 +142,7 @@ public function _before(TestInterface $test): void
139142
$this->_prepareSession();
140143
}
141144

142-
public function _getUrl(): string
145+
public function _getUrl()
143146
{
144147
return $this->config['url'];
145148
}
@@ -185,7 +188,7 @@ public function amOnSubdomain(string $subdomain): void
185188
$this->_reconfigure($config);
186189
}
187190

188-
protected function onReconfigure(): void
191+
protected function onReconfigure()
189192
{
190193
$this->_prepareSession();
191194
}
@@ -249,16 +252,14 @@ public function _prepareSession(): void
249252
$defaults['handler'] = $handlerStack;
250253
$this->guzzle = new GuzzleClient($defaults);
251254

252-
if ($this->client instanceof Guzzle) {
253-
$this->client->setRefreshMaxInterval($this->config['refresh_max_interval']);
254-
$this->client->setClient($this->guzzle);
255-
}
255+
$this->client->setRefreshMaxInterval($this->config['refresh_max_interval']);
256+
$this->client->setClient($this->guzzle);
256257
}
257258

258259
/**
259260
* @return array<string, mixed>
260261
*/
261-
public function _backupSession(): array
262+
public function _backupSession()
262263
{
263264
return [
264265
'client' => $this->client,

0 commit comments

Comments
 (0)