Skip to content

Commit 230b28d

Browse files
committed
Add support for PHP 8.4
1 parent a284bad commit 230b28d

File tree

4 files changed

+62
-45
lines changed

4 files changed

+62
-45
lines changed

.github/workflows/build.yml

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,57 @@ name: build
33
on: [ push, pull_request ]
44

55
jobs:
6-
run:
7-
runs-on: ${{ matrix.operating-system }}
8-
strategy:
9-
matrix:
10-
operating-system: [ ubuntu-latest ]
11-
php-versions: [ '8.1', '8.2' ]
12-
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
13-
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v1
17-
18-
- name: Setup PHP
19-
uses: shivammathur/setup-php@v2
20-
with:
21-
php-version: ${{ matrix.php-versions }}
22-
extensions: mbstring, intl, zip
23-
coverage: none
24-
25-
- name: Check PHP Version
26-
run: php -v
27-
28-
- name: Check Composer Version
29-
run: composer -V
30-
31-
- name: Check PHP Extensions
32-
run: php -m
33-
34-
- name: Validate composer.json and composer.lock
35-
run: composer validate
36-
37-
- name: Install dependencies
38-
run: composer install --prefer-dist --no-progress --no-suggest
39-
40-
- name: Run test suite
41-
run: composer test:all
6+
run:
7+
runs-on: ${{ matrix.operating-system }}
8+
strategy:
9+
matrix:
10+
operating-system: [ ubuntu-latest ]
11+
php-versions: [ '8.1', '8.2', '8.3', '8.4' ]
12+
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v1
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: ${{ matrix.php-versions }}
22+
extensions: mbstring, intl, zip
23+
coverage: none
24+
25+
- name: Check PHP Version
26+
run: php -v
27+
28+
- name: Check Composer Version
29+
run: composer -V
30+
31+
- name: Check PHP Extensions
32+
run: php -m
33+
34+
- name: Validate composer.json and composer.lock
35+
run: composer validate
36+
37+
- name: Install dependencies
38+
run: composer install --prefer-dist --no-progress --no-suggest
39+
40+
- name: Run PHP CodeSniffer
41+
run: composer sniffer:check
42+
43+
- name: Run PHPStan
44+
run: composer stan
45+
46+
- name: Run tests
47+
if: ${{ matrix.php-versions != '8.4' }}
48+
run: composer test
49+
50+
- name: Run tests with coverage
51+
if: ${{ matrix.php-versions == '8.4' }}
52+
run: composer test:coverage
53+
54+
- name: Upload coverage
55+
if: ${{ matrix.php-versions == '8.4' }}
56+
uses: coverallsapp/github-action@v2
57+
with:
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
59+
file: build/coverage/clover.xml

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ A URL base path detector for Slim 4.
55
[![Latest Version on Packagist](https://img.shields.io/github/release/selective-php/basepath.svg)](https://packagist.org/packages/selective/basepath)
66
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
77
[![Build Status](https://github.com/selective-php/basepath/workflows/build/badge.svg)](https://github.com/selective-php/basepath/actions)
8-
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/selective-php/basepath.svg)](https://scrutinizer-ci.com/g/selective-php/basepath/code-structure)
98
[![Quality Score](https://img.shields.io/scrutinizer/quality/g/selective-php/basepath.svg)](https://scrutinizer-ci.com/g/selective-php/basepath/?branch=master)
109
[![Total Downloads](https://img.shields.io/packagist/dt/selective/basepath.svg)](https://packagist.org/packages/selective/basepath/stats)
1110

12-
1311
## Features
1412

1513
* Support for Apache and the PHP built-in webserver
@@ -24,7 +22,7 @@ A URL base path detector for Slim 4.
2422

2523
## Requirements
2624

27-
* PHP 7.2+ or 8.1+
25+
* PHP 8.2+
2826

2927
## Installation
3028

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
],
1111
"homepage": "https://github.com/selective-php/basepath",
1212
"require": {
13-
"php": "^8.1",
13+
"php": "8.1.* || 8.2.* || 8.3.* || 8.4.*",
1414
"psr/http-server-middleware": "^1"
1515
},
1616
"require-dev": {
1717
"friendsofphp/php-cs-fixer": "^3",
18-
"phpstan/phpstan": "^1",
18+
"phpstan/phpstan": "^1 || ^2",
1919
"phpunit/phpunit": "^10",
2020
"slim/psr7": "^1",
2121
"slim/slim": "^4",

src/BasePathMiddleware.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Selective\BasePath;
44

5+
use Psr\Container\ContainerInterface;
56
use Psr\Http\Message\ResponseInterface;
67
use Psr\Http\Message\ServerRequestInterface;
78
use Psr\Http\Server\MiddlewareInterface;
@@ -14,19 +15,19 @@
1415
final class BasePathMiddleware implements MiddlewareInterface
1516
{
1617
/**
17-
* @var App The slim app
18+
* @var App<ContainerInterface> The slim app
1819
*/
19-
private $app;
20+
private App $app;
2021

2122
/**
2223
* @var string|null
2324
*/
24-
private $phpSapi;
25+
private ?string $phpSapi;
2526

2627
/**
2728
* The constructor.
2829
*
29-
* @param App $app The slim app
30+
* @param App<ContainerInterface> $app The slim app
3031
* @param string|null $phpSapi The PHP_SAPI value
3132
*/
3233
public function __construct(App $app, ?string $phpSapi = null)

0 commit comments

Comments
 (0)