Skip to content

Commit 14915c0

Browse files
authored
Add support for php8.4 and other improvements (#32)
* php8.4 support among other improvements * cleanup * update github workflow * update workflow
1 parent 749a305 commit 14915c0

18 files changed

+149
-48
lines changed

.gitattributes

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
* text=auto eol=lf
22

3-
/tests export-ignore
4-
.editorconfig export-ignore
5-
.gitattributes export-ignore
6-
.gitignore export-ignore
7-
.php_cs export-ignore
8-
.travis.yml export-ignore
9-
phpcs.xml.dist export-ignore
10-
phpunit.xml.dist export-ignore
3+
/tests export-ignore
4+
.editorconfig export-ignore
5+
.gitattributes export-ignore
6+
.gitignore export-ignore
7+
.php-cs-fixer.php export-ignore
8+
phpcs.xml.dist export-ignore
9+
phpunit.xml.dist export-ignore
10+
.phpstan.neon export-ignore

.github/workflows/main.yaml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: "testing"
22

33
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
88

99
jobs:
1010
qa:
@@ -20,16 +20,16 @@ jobs:
2020

2121
- name: Cache Composer packages
2222
id: composer-cache
23-
uses: actions/cache@v3
23+
uses: actions/cache@v4
2424
with:
25-
path: vendor
26-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
27-
restore-keys: |
28-
${{ runner.os }}-php-
25+
path: vendor
26+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
27+
restore-keys: |
28+
${{ runner.os }}-php-
2929
3030
- name: Install dependencies
3131
if: steps.composer-cache.outputs.cache-hit != 'true'
32-
run: composer install --prefer-dist --no-progress --no-suggest
32+
run: composer install --prefer-dist --no-progress
3333

3434
- name: Coding Standard
3535
run: composer run-script cs
@@ -40,11 +40,11 @@ jobs:
4040

4141
strategy:
4242
matrix:
43-
php:
44-
- 8.1
45-
- 8.2
46-
- 8.3
47-
- 8.4
43+
php:
44+
- 8.1
45+
- 8.2
46+
- 8.3
47+
- 8.4
4848

4949
steps:
5050
- name: Checkout
@@ -63,10 +63,7 @@ jobs:
6363
restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-
6464

6565
- name: Install dependencies
66-
run: composer install --prefer-dist --no-progress --no-suggest
66+
run: composer install --prefer-dist --no-progress
6767

6868
- name: Tests
6969
run: composer test
70-
71-
- name: Tests coverage
72-
run: composer coverage

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ vendor
22
composer.lock
33
coverage
44
*.cache
5+
.idea
6+
kit

.phpstan-baseline.neon

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
identifier: "new.static"
5+
-
6+
message: "#^Negated boolean expression is always false\\.$#"
7+
count: 1
8+
path: src/Factory.php
9+
10+
-
11+
message: "#^Method Middlewares\\\\Utils\\\\FactoryDiscovery\\:\\:getFactory\\(\\) has no return type specified\\.$#"
12+
count: 1
13+
path: src/FactoryDiscovery.php
14+
15+
-
16+
message: "#^Parameter \\#1 \\$class of function class_exists expects string, array\\<string, class\\-string\\>\\|string given\\.$#"
17+
count: 1
18+
path: src/FactoryDiscovery.php
19+
20+
-
21+
message: "#^Property Middlewares\\\\Utils\\\\FactoryDiscovery\\:\\:\\$factory has no type specified\\.$#"
22+
count: 1
23+
path: src/FactoryDiscovery.php
24+
25+
-
26+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
27+
count: 1
28+
path: src/HttpErrorException.php
29+
30+
-
31+
message: "#^Method Middlewares\\\\Utils\\\\RequestHandlerContainer\\:\\:resolve\\(\\) has no return type specified\\.$#"
32+
count: 1
33+
path: src/RequestHandlerContainer.php

.phpstan.neon

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
parameters:
2+
treatPhpDocTypesAsCertain: false
3+
reportUnmatchedIgnoredErrors: false
4+
inferPrivatePropertyTypeFromConstructor: true
5+
level: 8
6+
paths:
7+
- src
8+
- tests
9+
10+
includes:
11+
- .phpstan-baseline.neon

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2019
3+
Copyright (c) 2019-2025
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
"require": {
1919
"php": ">=8.1",
2020
"psr/http-message": "^1.0 || ^2.0",
21-
"psr/http-server-middleware": "^1.0",
21+
"psr/http-server-middleware": "^1",
2222
"psr/container": "^1.0 || ^2.0",
2323
"psr/http-factory": "^1.0"
2424
},
2525
"require-dev": {
26-
"phpunit/phpunit": "^10.5",
27-
"phpstan/phpstan": "^1.10",
28-
"laminas/laminas-diactoros": "^3.3",
29-
"friendsofphp/php-cs-fixer": "^3.41",
30-
"oscarotero/php-cs-fixer-config": "^2.0",
31-
"squizlabs/php_codesniffer": "^3.8",
26+
"phpunit/phpunit": "^10",
27+
"phpstan/phpstan": "^2",
28+
"laminas/laminas-diactoros": "^3",
29+
"friendsofphp/php-cs-fixer": "^3",
30+
"oscarotero/php-cs-fixer-config": "^2",
31+
"squizlabs/php_codesniffer": "^3",
3232
"slim/psr7": "^1.6",
3333
"guzzlehttp/psr7": "^2.6",
3434
"sunrise/http-message": "^3.0",
@@ -52,4 +52,4 @@
5252
"coverage": "phpunit --coverage-text",
5353
"coverage-html": "phpunit --coverage-html=coverage"
5454
}
55-
}
55+
}

phpcs.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Middlewares coding standard">
3+
<description>Middlewares coding standard</description>
4+
5+
<!-- display progress -->
6+
<arg value="p"/>
7+
<arg name="report" value="full"/>
8+
<arg name="colors"/>
9+
10+
<!-- coding standard -->
11+
<rule ref="PSR2"/>
12+
13+
<!-- Paths to check -->
14+
<file>src</file>
15+
<file>tests</file>
16+
</ruleset>

phpunit.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" beStrictAboutOutputDuringTests="true" colors="true" failOnWarning="true" cacheDirectory=".phpunit.cache">
3+
<coverage/>
4+
<testsuites>
5+
<testsuite name="Skeleton test suite">
6+
<directory>tests</directory>
7+
</testsuite>
8+
</testsuites>
9+
<source>
10+
<include>
11+
<directory>./src</directory>
12+
</include>
13+
<exclude>
14+
<directory>./tests</directory>
15+
<directory>./vendor</directory>
16+
</exclude>
17+
</source>
18+
</phpunit>

src/CallableHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public function __invoke(): ResponseInterface
5858

5959
/**
6060
* Execute the callable.
61+
*
62+
* @param array<int,ServerRequestInterface|RequestHandlerInterface> $arguments
6163
*/
6264
private function execute(array $arguments = []): ResponseInterface
6365
{

0 commit comments

Comments
 (0)