diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 76e1142..b01043c 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -4,7 +4,7 @@ updates:
package-ecosystem: composer
directory: "/"
schedule:
- interval: weekly
+ interval: monthly
versioning-strategy: auto
groups:
dev-dependencies:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 49207ef..fa00711 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
- php: [8.0, 8.1, 8.2, 8.3]
+ php: [8.1, 8.2, 8.3]
steps:
- name: Checkout code
diff --git a/composer.json b/composer.json
index 36e0f57..ce86167 100644
--- a/composer.json
+++ b/composer.json
@@ -18,20 +18,19 @@
],
"homepage": "https://codeception.com/",
"require": {
- "php": "^8.0",
+ "php": "^8.1",
"ext-json": "*",
"codeception/codeception": "*@dev",
"codeception/lib-innerbrowser": "*@dev",
"guzzlehttp/guzzle": "^7.4",
- "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0"
+ "symfony/browser-kit": "^5.4 | ^6.0 | ^7.0"
},
"require-dev": {
"ext-curl": "*",
"squizlabs/php_codesniffer": "^3.10",
"phpstan/phpstan": "^1.10",
- "rector/rector": "^1.0",
"aws/aws-sdk-php": "^3.199",
- "codeception/module-rest": "^2.0 || *@dev"
+ "codeception/module-rest": "^2.0 | *@dev"
},
"conflict": {
"codeception/codeception": "<5.0",
diff --git a/phpcs.xml b/phpcs.xml
index e192479..089067e 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -11,12 +11,10 @@
-
error
-
-
+
diff --git a/phpstan.neon b/phpstan.neon
index c3c051e..dec5108 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,5 +1,4 @@
parameters:
paths:
- ./src
- # The level 9 is the highest level (with check for mixed type)
- level: 6
\ No newline at end of file
+ level: 5
\ No newline at end of file
diff --git a/rector.php b/rector.php
deleted file mode 100644
index 64176b3..0000000
--- a/rector.php
+++ /dev/null
@@ -1,47 +0,0 @@
-withPaths([
- __DIR__.'/src',
- ])
- // uncomment to reach your current PHP version
- ->withPhpSets()
- ->withRules([
- AddVoidReturnTypeWhereNoReturnRector::class,
- ChangeConstantVisibilityRector::class,
- RenameForeachValueVariableToMatchExprVariableRector::class,
- ReturnTypeFromReturnNewRector::class,
- CountArrayToEmptyArrayComparisonRector::class,
- StrictArraySearchRector::class,
- SymplifyQuoteEscapeRector::class,
- DeclareStrictTypesRector::class,
- ])
- ->withSets([
- PHPUnitSetList::PHPUNIT_110,
- ])
- ->withPhpSets()
- ->withPHPStanConfigs(['phpstan.neon'])
- ->withPreparedSets(
- deadCode: true,
- codeQuality: true,
- codingStyle: true,
- typeDeclarations: true,
- privatization: true,
- naming: true,
- instanceOf: true,
- earlyReturn: true,
- strictBooleans: true
- );
diff --git a/src/Codeception/Lib/Connector/Guzzle.php b/src/Codeception/Lib/Connector/Guzzle.php
index 696f637..55594bd 100644
--- a/src/Codeception/Lib/Connector/Guzzle.php
+++ b/src/Codeception/Lib/Connector/Guzzle.php
@@ -136,7 +136,7 @@ protected function createResponse(Psr7Response $psr7Response): BrowserKitRespons
$matches
);
- if (($matchesMeta === 0 || $matchesMeta === false) && isset($headers['Refresh'])) {
+ if (!$matchesMeta && isset($headers['Refresh'])) {
// match by header
preg_match(
'#^\s*(\d*)\s*;\s*url=(.*)#i',
@@ -181,7 +181,7 @@ protected function getAbsoluteUri(string $uri): string
return Uri::mergeUrls((string)$baseUri, $uri);
}
- protected function doRequest(object $request): BrowserKitResponse
+ protected function doRequest(object $request)
{
/** @var BrowserKitRequest $request **/
$guzzleRequest = new Psr7Request(
@@ -208,12 +208,12 @@ protected function doRequest(object $request): BrowserKitResponse
} else {
$response = $this->client->send($guzzleRequest, $options);
}
- } catch (RequestException $requestException) {
- if (!$requestException->hasResponse()) {
- throw $requestException;
+ } catch (RequestException $exception) {
+ if (!$exception->hasResponse()) {
+ throw $exception;
}
- $response = $requestException->getResponse();
+ $response = $exception->getResponse();
}
// @phpstan-ignore-next-line
@@ -223,10 +223,10 @@ protected function doRequest(object $request): BrowserKitResponse
/**
* @return array
*/
- protected function extractHeaders(BrowserKitRequest $browserKitRequest): array
+ protected function extractHeaders(BrowserKitRequest $request): array
{
$headers = [];
- $server = $browserKitRequest->getServer();
+ $server = $request->getServer();
$contentHeaders = ['Content-Length' => true, 'Content-Md5' => true, 'Content-Type' => true];
foreach ($server as $header => $val) {
@@ -310,7 +310,7 @@ protected function mapFiles(array $requestFiles, ?string $arrayName = ''): array
{
$files = [];
foreach ($requestFiles as $name => $info) {
- if ($arrayName !== null && $arrayName !== '' && $arrayName !== '0') {
+ if (!empty($arrayName)) {
$name = $arrayName . '[' . $name . ']';
}
diff --git a/src/Codeception/Module/PhpBrowser.php b/src/Codeception/Module/PhpBrowser.php
index 139bc75..5049f5c 100644
--- a/src/Codeception/Module/PhpBrowser.php
+++ b/src/Codeception/Module/PhpBrowser.php
@@ -121,16 +121,19 @@ class PhpBrowser extends InnerBrowser implements Remote, MultiSession
'connect_timeout'
];
+ /**
+ * @var Guzzle
+ */
public ?AbstractBrowser $client = null;
public ?GuzzleClient $guzzle = null;
- public function _initialize(): void
+ public function _initialize()
{
$this->_initializeSession();
}
- public function _before(TestInterface $test): void
+ public function _before(TestInterface $test)
{
if (!$this->client instanceof AbstractBrowser) {
$this->client = new Guzzle();
@@ -139,7 +142,7 @@ public function _before(TestInterface $test): void
$this->_prepareSession();
}
- public function _getUrl(): string
+ public function _getUrl()
{
return $this->config['url'];
}
@@ -185,7 +188,7 @@ public function amOnSubdomain(string $subdomain): void
$this->_reconfigure($config);
}
- protected function onReconfigure(): void
+ protected function onReconfigure()
{
$this->_prepareSession();
}
@@ -249,16 +252,14 @@ public function _prepareSession(): void
$defaults['handler'] = $handlerStack;
$this->guzzle = new GuzzleClient($defaults);
- if ($this->client instanceof Guzzle) {
- $this->client->setRefreshMaxInterval($this->config['refresh_max_interval']);
- $this->client->setClient($this->guzzle);
- }
+ $this->client->setRefreshMaxInterval($this->config['refresh_max_interval']);
+ $this->client->setClient($this->guzzle);
}
/**
* @return array
*/
- public function _backupSession(): array
+ public function _backupSession()
{
return [
'client' => $this->client,