Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PHP 8.4 #3362

Merged
merged 11 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.4, 8.0, 8.1, 8.2, 8.3]
php: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4]
experimental: [false]
include:
- php: 8.2
Expand All @@ -27,7 +27,12 @@ jobs:
coverage: xdebug

- name: Install dependencies with Composer
uses: ramsey/composer-install@v3
if: matrix.php < '8.4'
run: composer update --prefer-dist --no-progress --no-interaction --ansi

- name: Install dependencies with Composer
if: matrix.php >= '8.4'
run: composer update --prefer-dist --no-progress --no-interaction --ansi --ignore-platform-reqs

- name: Coding standards
if: matrix.analysis
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

### Added

### Removed
- Add support for PHP 8.4

### Removed

## 4.14.0 - 2024-06-13

Expand Down
7 changes: 0 additions & 7 deletions Slim/Handlers/Strategies/RequestResponseNamedArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
*/
class RequestResponseNamedArgs implements InvocationStrategyInterface
{
public function __construct()
{
if (PHP_VERSION_ID < 80000) {
throw new RuntimeException('Named arguments are only available for PHP >= 8.0.0');
}
}

/**
* Invoke a route callable with request, response and all route parameters
* as individual arguments.
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"wiki": "https://github.com/slimphp/Slim/wiki"
},
"require": {
"php": "^7.4 || ^8.0",
"php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"ext-json": "*",
"nikic/fast-route": "^1.3",
"psr/container": "^1.0 || ^2.0",
Expand All @@ -69,7 +69,7 @@
"slim/http": "^1.3",
"slim/psr7": "^1.6",
"squizlabs/php_codesniffer": "^3.10",
"vimeo/psalm": "^5.24"
"vimeo/psalm": "^5.26.1"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 0 additions & 11 deletions tests/Handlers/Strategies/RequestResponseNamedArgsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use RuntimeException;
use Slim\Handlers\Strategies\RequestResponseNamedArgs;
use Slim\Tests\TestCase;

Expand All @@ -29,16 +28,6 @@ public function setUp(): void
$this->response = $this->createMock(ResponseInterface::class);
}

public function testCreatingRequestResponseNamedArgsThrowsRuntimeExceptionForPHPOlderThan80()
{
if (PHP_VERSION_ID >= self::PHP_8_0_VERSION_ID) {
$this->markTestSkipped('Test only valid for PHP versions older than 8.0');
}

$this->expectException(RuntimeException::class);
new RequestResponseNamedArgs();
}

public function testCallingWithEmptyArguments()
{
if (PHP_VERSION_ID < self::PHP_8_0_VERSION_ID) {
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

return connection_status();
},
'header' => function (string $string, bool $replace = true, int $statusCode = null): void {
'header' => function (string $string, bool $replace = true, ?int $statusCode = null): void {
HeaderStack::push(
[
'header' => $string,
Expand Down