Skip to content

Commit 724f495

Browse files
feat(*): Handle PHP 8.5
1 parent ba6f9cd commit 724f495

11 files changed

Lines changed: 16 additions & 40 deletions

File tree

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
27+
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
2828

2929
name: Coding standards
3030
runs-on: ubuntu-latest
31-
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
3231
env:
3332
EXTENSION_PATH: "my-code/crowdsec-bouncer-lib"
3433

@@ -86,7 +85,6 @@ jobs:
8685
run: ddev phpmd ./${{env.EXTENSION_PATH}}/tools/coding-standards phpmd/rulesets.xml ../../src
8786

8887
- name: Run PSALM
89-
if: contains(fromJson('["7.4","8.0","8.1","8.2","8.3"]'),matrix.php-version)
9088
run: ddev psalm ./${{env.EXTENSION_PATH}}/tools/coding-standards ./${{env.EXTENSION_PATH}}/tools/coding-standards/psalm
9189

9290
- name: Prepare for Code Coverage

.github/workflows/keepalive.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/test-suite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
24+
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
2525

2626
name: Test suite
2727
runs-on: ubuntu-latest

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
],
4242
"require": {
4343
"php": ">=7.2.5",
44-
"crowdsec/remediation-engine": "^4.2.0",
45-
"crowdsec/lapi-client": "^3.6.0",
46-
"crowdsec/common": "^3.0.0",
44+
"crowdsec/remediation-engine": "^4.3.2",
45+
"crowdsec/lapi-client": "^3.7.1",
46+
"crowdsec/common": "^3.0.1",
4747
"symfony/config": "^4.4.27 || ^5.2 || ^6.0 || ^7.2",
4848
"monolog/monolog": "^1.17 || ^2.1 || ^3.8",
4949
"psr/log": "^1.0 || ^2.0 || ^3.0",
5050
"twig/twig": "^3.4.2",
51-
"gregwar/captcha": "^1.2.1",
51+
"gregwar/captcha": "^1.3.0",
5252
"mlocati/ip-lib": "^1.18",
5353
"ext-json": "*",
5454
"ext-gd": "*"

src/AbstractBouncer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
*
3434
* @copyright Copyright (c) 2021+ CrowdSec
3535
* @license MIT License
36+
* @psalm-api
3637
*/
3738
abstract class AbstractBouncer
3839
{

src/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Configuration extends AbstractConfiguration
4646
/**
4747
* @throws \InvalidArgumentException
4848
*/
49+
#[\Override]
4950
public function getConfigTreeBuilder(): TreeBuilder
5051
{
5152
$treeBuilder = new TreeBuilder('config');

src/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private function getMultipartRawBody(
140140

141141
foreach ($filesData as $fileKey => $fileArray) {
142142
$fileNames = is_array($fileArray['name']) ? $fileArray['name'] : [$fileArray['name']];
143-
foreach ($fileNames as $index => $fileName) {
143+
foreach ($fileNames as $index => $_fileName) {
144144
$remainingSize = $threshold - $currentSize;
145145
$fileData =
146146
$this->appendFileData($fileArray, $index, $fileKey, $boundary, $remainingSize, $currentSize);

tests/Integration/AbstractBouncerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use CrowdSec\Common\Client\RequestHandler\Curl;
88
use CrowdSec\Common\Client\RequestHandler\FileGetContents;
9-
use CrowdSec\Common\Logger\ConsoleLog;
109
use CrowdSec\Common\Logger\FileLog;
1110
use CrowdSec\LapiClient\Bouncer as BouncerClient;
1211
use CrowdSec\RemediationEngine\CacheStorage\AbstractCache;

tests/PHPUnitUtil.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ public static function callMethod($obj, $name, array $args)
2222
{
2323
$class = new \ReflectionClass($obj);
2424
$method = $class->getMethod($name);
25-
$method->setAccessible(true);
25+
// setAccessible() is only needed for PHP < 8.1 and deprecated in PHP 8.5
26+
if (PHP_VERSION_ID < 80100) {
27+
$method->setAccessible(true);
28+
}
2629

2730
return $method->invokeArgs($obj, $args);
2831
}

tools/coding-standards/composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
"friendsofphp/php-cs-fixer": "^v3.8.0",
55
"phpstan/phpstan": "^1.8.0",
66
"phpmd/phpmd": "^2.12.0",
7-
"squizlabs/php_codesniffer": "3.7.1",
8-
"vimeo/psalm": "^4.24.0 || ^5.26.0",
9-
"nikic/php-parser": "^4.18",
7+
"squizlabs/php_codesniffer": "3.7.1 || ^4.0.1",
8+
"vimeo/psalm": "^4.24.0 || ^5.26 || ^6.13.1",
109
"phpunit/phpunit": "^9.3",
1110
"phpunit/php-code-coverage": "^9.2.15",
1211
"mikey179/vfsstream": "^1.6.11",

0 commit comments

Comments
 (0)