Skip to content

Commit

Permalink
Merge pull request #22 from samsonasik/bump-php82
Browse files Browse the repository at this point in the history
Bump to PHP 8.2 and PHP 8.4 support
  • Loading branch information
samsonasik authored Dec 29, 2024
2 parents 4ab20c4 + d210ae7 commit 8e3c30c
Show file tree
Hide file tree
Showing 12 changed files with 200 additions and 108 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
/CONTRIBUTING.md export-ignore
/phpcs.xml export-ignore
/kahlan-config.php export-ignore
/rector.php export-ignore
/rector.php export-ignore
/phpstan-baseline.neon export-ignore
5 changes: 3 additions & 2 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['8.2', '8.3', '8.4']
steps:
- name: Setup PHP Action
uses: shivammathur/setup-php@v2
Expand All @@ -30,11 +30,12 @@ jobs:
run: "composer cs-check"
- name: "Code analyze"
run: |
bin/phpstan analyse src/ --level=8 -c phpstan.neon
bin/phpstan analyse src/ --level=max -c phpstan.neon
bin/rector process --dry-run
- name: "Run test suite"
run: "mkdir -p build/logs && bin/kahlan --coverage=4 --reporter=verbose --clover=build/logs/clover.xml"
- name: Upload coverage to Codecov
if: github.event.pull_request.head.repo.full_name == 'samsonasik/ForceHttpsModule'
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@
}
],
"require": {
"php": "^7.4|^8.0",
"webmozart/assert": "^1.9"
"php": "^8.2",
"webmozart/assert": "^1.11"
},
"conflict": {
"mezzio/mezzio": "<3.0",
"laminas/laminas-mvc": "<3.0"
},
"require-dev": {
"kahlan/kahlan": "^5.2",
"laminas/laminas-coding-standard": "^2.0",
"laminas/laminas-mvc": "^3.0",
"mezzio/mezzio": "^3.0",
"php-coveralls/php-coveralls": "^2.1",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-webmozart-assert": "^1.0",
"kahlan/kahlan": "^6.0",
"laminas/laminas-coding-standard": "^2.5",
"laminas/laminas-mvc": "^3.8",
"mezzio/mezzio": "^3.20.1",
"php-coveralls/php-coveralls": "^2.7",
"phpstan/phpstan": "^2.0.4",
"phpstan/phpstan-webmozart-assert": "^2.0",
"rector/rector": "dev-main"
},
"config": {
Expand Down
103 changes: 103 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
parameters:
ignoreErrors:
-
message: '#^Cannot access offset ''enable'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 2
path: src/Listener/ForceHttps.php

-
message: '#^Cannot access offset ''value'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 2
path: src/Listener/ForceHttps.php

-
message: '#^Method ForceHttpsModule\\Listener\\ForceHttps\:\:isGoingToBeForcedToHttps\(\) should return bool but returns mixed\.$#'
identifier: return.type
count: 1
path: src/Listener/ForceHttps.php

-
message: '#^Parameter \#2 \$haystack of function in_array expects array, mixed given\.$#'
identifier: argument.type
count: 2
path: src/Listener/ForceHttps.php

-
message: '#^Parameter \#2 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#'
identifier: argument.type
count: 1
path: src/Listener/ForceHttps.php

-
message: '#^Property ForceHttpsModule\\Listener\\ForceHttps\:\:\$needsWwwPrefix \(bool\) does not accept mixed\.$#'
identifier: assign.propertyType
count: 1
path: src/Listener/ForceHttps.php

-
message: '#^Cannot access offset ''force\-https\-module'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: src/Listener/ForceHttpsFactory.php

-
message: '#^Parameter \#1 \$config of class ForceHttpsModule\\Listener\\ForceHttps constructor expects array\<mixed\>, mixed given\.$#'
identifier: argument.type
count: 1
path: src/Listener/ForceHttpsFactory.php

-
message: '#^Cannot access offset ''enable'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 2
path: src/Middleware/ForceHttps.php

-
message: '#^Cannot access offset ''value'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 2
path: src/Middleware/ForceHttps.php

-
message: '#^Method ForceHttpsModule\\Middleware\\ForceHttps\:\:isGoingToBeForcedToHttps\(\) should return bool but returns mixed\.$#'
identifier: return.type
count: 1
path: src/Middleware/ForceHttps.php

-
message: '#^Parameter \#2 \$haystack of function in_array expects array, mixed given\.$#'
identifier: argument.type
count: 2
path: src/Middleware/ForceHttps.php

-
message: '#^Parameter \#2 \$value of method Psr\\Http\\Message\\MessageInterface\:\:withHeader\(\) expects array\<string\>\|string, mixed given\.$#'
identifier: argument.type
count: 1
path: src/Middleware/ForceHttps.php

-
message: '#^Property ForceHttpsModule\\Middleware\\ForceHttps\:\:\$needsWwwPrefix \(bool\) does not accept mixed\.$#'
identifier: assign.propertyType
count: 1
path: src/Middleware/ForceHttps.php

-
message: '#^Cannot access offset ''force\-https\-module'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: src/Middleware/ForceHttpsFactory.php

-
message: '#^Parameter \#1 \$config of class ForceHttpsModule\\Middleware\\ForceHttps constructor expects array\<mixed\>, mixed given\.$#'
identifier: argument.type
count: 1
path: src/Middleware/ForceHttpsFactory.php

-
message: '#^Method ForceHttpsModule\\Module\:\:getConfig\(\) should return array\<mixed\> but returns mixed\.$#'
identifier: return.type
count: 1
path: src/Module.php
5 changes: 1 addition & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
includes:
- vendor/phpstan/phpstan-webmozart-assert/extension.neon

parameters:
checkMissingIterableValueType: false

- phpstan-baseline.neon
37 changes: 10 additions & 27 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,20 @@

declare(strict_types=1);

use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Php81\Rector\Array_\FirstClassCallableRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_74,
SetList::CODE_QUALITY,
SetList::NAMING,
SetList::TYPE_DECLARATION,
SetList::CODING_STYLE,
]);

$rectorConfig->paths([
return RectorConfig::configure()
->withPhpSets(php82: true)
->withPreparedSets(deadCode: true, codeQuality: true, naming: true, typeDeclarations: true, codingStyle: true)
->withImportNames(removeUnusedImports: true)
->withPaths([
__DIR__ . '/config',
__DIR__ . '/src',
__DIR__ . '/spec',
__DIR__ . '/rector.php'
])
->withRootFiles()
->withSkip([
FirstClassCallableRector::class,
]);
$rectorConfig->importNames();
$rectorConfig->skip([
CallableThisArrayToAnonymousFunctionRector::class,
StaticArrowFunctionRector::class => [
__DIR__ . '/spec',
],
StaticClosureRector::class => [
__DIR__ . '/spec',
],
]);
};
1 change: 0 additions & 1 deletion spec/Listener/ForceHttpsSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Kahlan\Plugin\Double;
use Kahlan\Plugin\Quit;
use Kahlan\QuitException;
use Laminas\Console\Console;
use Laminas\EventManager\EventManagerInterface;
use Laminas\Http\PhpEnvironment\Request;
use Laminas\Http\PhpEnvironment\Response;
Expand Down
Loading

0 comments on commit 8e3c30c

Please sign in to comment.