Skip to content

Commit 1076a3c

Browse files
filiskooscarotero
authored andcommitted
php8.4 support among other improvements
1 parent 8b94acb commit 1076a3c

10 files changed

+94
-22
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

.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

.php-cs-fixer.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
return My\PhpCsFixerConfig::create()
4+
->setFinder(
5+
PhpCsFixer\Finder::create()
6+
->files()
7+
->name('*.php')
8+
->in(__DIR__.'/src')
9+
->in(__DIR__.'/tests')
10+
);

.phpstan.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parameters:
2+
level: 8
3+
paths:
4+
- src
5+
- tests

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: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
},
1919
"require": {
2020
"php": "^7.2 || ^8.0",
21-
"middlewares/utils": "^3.0 || ^4.0",
22-
"psr/http-server-middleware": "^1.0"
21+
"middlewares/utils": "^2 || ^3 || ^4",
22+
"psr/http-server-middleware": "^1"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^8|^9",
26-
"laminas/laminas-diactoros": "^2|^3",
27-
"friendsofphp/php-cs-fixer": "^2.0",
28-
"squizlabs/php_codesniffer": "^3.0",
29-
"oscarotero/php-cs-fixer-config": "^1.0",
30-
"phpstan/phpstan": "^0.12"
25+
"phpunit/phpunit": "^8 || ^9",
26+
"laminas/laminas-diactoros": "^2 || ^3",
27+
"friendsofphp/php-cs-fixer": "^3",
28+
"squizlabs/php_codesniffer": "^3",
29+
"oscarotero/php-cs-fixer-config": "^2",
30+
"phpstan/phpstan": "^1 || ^2"
3131
},
3232
"autoload": {
3333
"psr-4": {
@@ -47,4 +47,4 @@
4747
"coverage": "phpunit --coverage-text",
4848
"coverage-html": "phpunit --coverage-html=coverage"
4949
}
50-
}
50+
}

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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
backupGlobals="false"
6+
backupStaticAttributes="false"
7+
beStrictAboutOutputDuringTests="true"
8+
beStrictAboutTestsThatDoNotTestAnything="true"
9+
beStrictAboutTodoAnnotatedTests="true"
10+
colors="true"
11+
verbose="true"
12+
convertErrorsToExceptions="true"
13+
convertNoticesToExceptions="true"
14+
convertWarningsToExceptions="true"
15+
processIsolation="false"
16+
stopOnFailure="false"
17+
failOnWarning="true">
18+
<testsuites>
19+
<testsuite name="TrailingSlash test suite">
20+
<directory>tests</directory>
21+
</testsuite>
22+
</testsuites>
23+
24+
<filter>
25+
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
26+
<directory>./src</directory>
27+
<exclude>
28+
<directory>./tests</directory>
29+
<directory>./vendor</directory>
30+
</exclude>
31+
</whitelist>
32+
</filter>
33+
</phpunit>

src/TrailingSlash.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TrailingSlash implements MiddlewareInterface
1818
private $trailingSlash;
1919

2020
/**
21-
* @var ResponseFactoryInterface
21+
* @var ResponseFactoryInterface|null
2222
*/
2323
private $responseFactory;
2424

tests/TrailingSlashTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
class TrailingSlashTest extends TestCase
1212
{
13+
/**
14+
* @return array<string[]>
15+
*/
1316
public function removeProvider(): array
1417
{
1518
return [
@@ -23,7 +26,7 @@ public function removeProvider(): array
2326
/**
2427
* @dataProvider removeProvider
2528
*/
26-
public function testRemove(string $uri, string $result)
29+
public function testRemove(string $uri, string $result): void
2730
{
2831
$request = Factory::createServerRequest('GET', $uri);
2932

@@ -38,6 +41,9 @@ function ($request, $next) {
3841
$this->assertEquals($result, (string) $response->getBody());
3942
}
4043

44+
/**
45+
* @return array<string[]>
46+
*/
4147
public function addProvider(): array
4248
{
4349
return [
@@ -53,7 +59,7 @@ public function addProvider(): array
5359
/**
5460
* @dataProvider addProvider
5561
*/
56-
public function testAdd(string $uri, string $result)
62+
public function testAdd(string $uri, string $result): void
5763
{
5864
$request = Factory::createServerRequest('GET', $uri);
5965

@@ -68,7 +74,7 @@ function ($request, $next) {
6874
$this->assertEquals($result, (string) $response->getBody());
6975
}
7076

71-
public function testRedirect()
77+
public function testRedirect(): void
7278
{
7379
$request = Factory::createServerRequest('GET', '/foo/bar/');
7480

0 commit comments

Comments
 (0)