Skip to content

Commit 8e3c30c

Browse files
authored
Merge pull request #22 from samsonasik/bump-php82
Bump to PHP 8.2 and PHP 8.4 support
2 parents 4ab20c4 + d210ae7 commit 8e3c30c

File tree

12 files changed

+200
-108
lines changed

12 files changed

+200
-108
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
/CONTRIBUTING.md export-ignore
77
/phpcs.xml export-ignore
88
/kahlan-config.php export-ignore
9-
/rector.php export-ignore
9+
/rector.php export-ignore
10+
/phpstan-baseline.neon export-ignore

.github/workflows/ci_build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php-versions: ['7.4', '8.0', '8.1']
16+
php-versions: ['8.2', '8.3', '8.4']
1717
steps:
1818
- name: Setup PHP Action
1919
uses: shivammathur/setup-php@v2
@@ -30,11 +30,12 @@ jobs:
3030
run: "composer cs-check"
3131
- name: "Code analyze"
3232
run: |
33-
bin/phpstan analyse src/ --level=8 -c phpstan.neon
33+
bin/phpstan analyse src/ --level=max -c phpstan.neon
3434
bin/rector process --dry-run
3535
- name: "Run test suite"
3636
run: "mkdir -p build/logs && bin/kahlan --coverage=4 --reporter=verbose --clover=build/logs/clover.xml"
3737
- name: Upload coverage to Codecov
38+
if: github.event.pull_request.head.repo.full_name == 'samsonasik/ForceHttpsModule'
3839
uses: codecov/codecov-action@v1
3940
with:
4041
token: ${{ secrets.CODECOV_TOKEN }}

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@
2424
}
2525
],
2626
"require": {
27-
"php": "^7.4|^8.0",
28-
"webmozart/assert": "^1.9"
27+
"php": "^8.2",
28+
"webmozart/assert": "^1.11"
2929
},
3030
"conflict": {
3131
"mezzio/mezzio": "<3.0",
3232
"laminas/laminas-mvc": "<3.0"
3333
},
3434
"require-dev": {
35-
"kahlan/kahlan": "^5.2",
36-
"laminas/laminas-coding-standard": "^2.0",
37-
"laminas/laminas-mvc": "^3.0",
38-
"mezzio/mezzio": "^3.0",
39-
"php-coveralls/php-coveralls": "^2.1",
40-
"phpstan/phpstan": "^1.1",
41-
"phpstan/phpstan-webmozart-assert": "^1.0",
35+
"kahlan/kahlan": "^6.0",
36+
"laminas/laminas-coding-standard": "^2.5",
37+
"laminas/laminas-mvc": "^3.8",
38+
"mezzio/mezzio": "^3.20.1",
39+
"php-coveralls/php-coveralls": "^2.7",
40+
"phpstan/phpstan": "^2.0.4",
41+
"phpstan/phpstan-webmozart-assert": "^2.0",
4242
"rector/rector": "dev-main"
4343
},
4444
"config": {

phpstan-baseline.neon

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Cannot access offset ''enable'' on mixed\.$#'
5+
identifier: offsetAccess.nonOffsetAccessible
6+
count: 2
7+
path: src/Listener/ForceHttps.php
8+
9+
-
10+
message: '#^Cannot access offset ''value'' on mixed\.$#'
11+
identifier: offsetAccess.nonOffsetAccessible
12+
count: 2
13+
path: src/Listener/ForceHttps.php
14+
15+
-
16+
message: '#^Method ForceHttpsModule\\Listener\\ForceHttps\:\:isGoingToBeForcedToHttps\(\) should return bool but returns mixed\.$#'
17+
identifier: return.type
18+
count: 1
19+
path: src/Listener/ForceHttps.php
20+
21+
-
22+
message: '#^Parameter \#2 \$haystack of function in_array expects array, mixed given\.$#'
23+
identifier: argument.type
24+
count: 2
25+
path: src/Listener/ForceHttps.php
26+
27+
-
28+
message: '#^Parameter \#2 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#'
29+
identifier: argument.type
30+
count: 1
31+
path: src/Listener/ForceHttps.php
32+
33+
-
34+
message: '#^Property ForceHttpsModule\\Listener\\ForceHttps\:\:\$needsWwwPrefix \(bool\) does not accept mixed\.$#'
35+
identifier: assign.propertyType
36+
count: 1
37+
path: src/Listener/ForceHttps.php
38+
39+
-
40+
message: '#^Cannot access offset ''force\-https\-module'' on mixed\.$#'
41+
identifier: offsetAccess.nonOffsetAccessible
42+
count: 1
43+
path: src/Listener/ForceHttpsFactory.php
44+
45+
-
46+
message: '#^Parameter \#1 \$config of class ForceHttpsModule\\Listener\\ForceHttps constructor expects array\<mixed\>, mixed given\.$#'
47+
identifier: argument.type
48+
count: 1
49+
path: src/Listener/ForceHttpsFactory.php
50+
51+
-
52+
message: '#^Cannot access offset ''enable'' on mixed\.$#'
53+
identifier: offsetAccess.nonOffsetAccessible
54+
count: 2
55+
path: src/Middleware/ForceHttps.php
56+
57+
-
58+
message: '#^Cannot access offset ''value'' on mixed\.$#'
59+
identifier: offsetAccess.nonOffsetAccessible
60+
count: 2
61+
path: src/Middleware/ForceHttps.php
62+
63+
-
64+
message: '#^Method ForceHttpsModule\\Middleware\\ForceHttps\:\:isGoingToBeForcedToHttps\(\) should return bool but returns mixed\.$#'
65+
identifier: return.type
66+
count: 1
67+
path: src/Middleware/ForceHttps.php
68+
69+
-
70+
message: '#^Parameter \#2 \$haystack of function in_array expects array, mixed given\.$#'
71+
identifier: argument.type
72+
count: 2
73+
path: src/Middleware/ForceHttps.php
74+
75+
-
76+
message: '#^Parameter \#2 \$value of method Psr\\Http\\Message\\MessageInterface\:\:withHeader\(\) expects array\<string\>\|string, mixed given\.$#'
77+
identifier: argument.type
78+
count: 1
79+
path: src/Middleware/ForceHttps.php
80+
81+
-
82+
message: '#^Property ForceHttpsModule\\Middleware\\ForceHttps\:\:\$needsWwwPrefix \(bool\) does not accept mixed\.$#'
83+
identifier: assign.propertyType
84+
count: 1
85+
path: src/Middleware/ForceHttps.php
86+
87+
-
88+
message: '#^Cannot access offset ''force\-https\-module'' on mixed\.$#'
89+
identifier: offsetAccess.nonOffsetAccessible
90+
count: 1
91+
path: src/Middleware/ForceHttpsFactory.php
92+
93+
-
94+
message: '#^Parameter \#1 \$config of class ForceHttpsModule\\Middleware\\ForceHttps constructor expects array\<mixed\>, mixed given\.$#'
95+
identifier: argument.type
96+
count: 1
97+
path: src/Middleware/ForceHttpsFactory.php
98+
99+
-
100+
message: '#^Method ForceHttpsModule\\Module\:\:getConfig\(\) should return array\<mixed\> but returns mixed\.$#'
101+
identifier: return.type
102+
count: 1
103+
path: src/Module.php

phpstan.neon

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
includes:
22
- vendor/phpstan/phpstan-webmozart-assert/extension.neon
3-
4-
parameters:
5-
checkMissingIterableValueType: false
6-
3+
- phpstan-baseline.neon

rector.php

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,20 @@
22

33
declare(strict_types=1);
44

5-
use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
6-
use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
7-
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
85
use Rector\Config\RectorConfig;
9-
use Rector\Set\ValueObject\LevelSetList;
10-
use Rector\Set\ValueObject\SetList;
6+
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
117

12-
return static function (RectorConfig $rectorConfig): void {
13-
$rectorConfig->sets([
14-
SetList::DEAD_CODE,
15-
LevelSetList::UP_TO_PHP_74,
16-
SetList::CODE_QUALITY,
17-
SetList::NAMING,
18-
SetList::TYPE_DECLARATION,
19-
SetList::CODING_STYLE,
20-
]);
21-
22-
$rectorConfig->paths([
8+
return RectorConfig::configure()
9+
->withPhpSets(php82: true)
10+
->withPreparedSets(deadCode: true, codeQuality: true, naming: true, typeDeclarations: true, codingStyle: true)
11+
->withImportNames(removeUnusedImports: true)
12+
->withPaths([
2313
__DIR__ . '/config',
2414
__DIR__ . '/src',
2515
__DIR__ . '/spec',
2616
__DIR__ . '/rector.php'
17+
])
18+
->withRootFiles()
19+
->withSkip([
20+
FirstClassCallableRector::class,
2721
]);
28-
$rectorConfig->importNames();
29-
$rectorConfig->skip([
30-
CallableThisArrayToAnonymousFunctionRector::class,
31-
StaticArrowFunctionRector::class => [
32-
__DIR__ . '/spec',
33-
],
34-
StaticClosureRector::class => [
35-
__DIR__ . '/spec',
36-
],
37-
]);
38-
};

spec/Listener/ForceHttpsSpec.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Kahlan\Plugin\Double;
77
use Kahlan\Plugin\Quit;
88
use Kahlan\QuitException;
9-
use Laminas\Console\Console;
109
use Laminas\EventManager\EventManagerInterface;
1110
use Laminas\Http\PhpEnvironment\Request;
1211
use Laminas\Http\PhpEnvironment\Response;

0 commit comments

Comments
 (0)