Skip to content

Commit

Permalink
Re-support Symfony 4 and 5 (#99)
Browse files Browse the repository at this point in the history
* Test Symfony 4,5,6
* Use signature for both new and old versions
  • Loading branch information
barryvdh authored Jan 18, 2022
1 parent 1faf1a9 commit bda36eb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,23 @@ jobs:

strategy:
matrix:
php: [8.0, 8.1]
php: [7.1, 7.2, 7.3, 7.4, 8.0, 8.1]
symfony: [4.x, 5.x, 6.x]
dependency-version: [prefer-lowest, prefer-stable]
os: [ubuntu-latest]

name: PHP${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}
exclude:
- symfony: 5.x
php: 7.1
- symfony: 6.x
php: 7.1
- symfony: 6.x
php: 7.2
- symfony: 6.x
php: 7.3
- symfony: 6.x
php: 7.4

name: PHP${{ matrix.php }} Symfony${{ matrix.symfony }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
Expand All @@ -28,7 +40,8 @@ jobs:

- name: Install dependencies
run: |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
composer require "symfony/http-foundation:${{ matrix.symfony }}" "symfony/http-kernel:${{ matrix.symfony }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest --with-all-dependencies
- name: Execute Unit Tests
run: vendor/bin/phpunit
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
}
],
"require": {
"php": "^8.0",
"symfony/http-foundation": "^6",
"symfony/http-kernel": "^6"
"php": "^7.1.3|^8.0",
"symfony/http-foundation": "^4|^5|^6",
"symfony/http-kernel": "^4|^5|^6"
},
"require-dev": {
"phpunit/phpunit": "^9",
"phpunit/phpunit": "^7|^9",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion src/Cors.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(HttpKernelInterface $app, array $options = [])
$this->cors = new CorsService(array_merge($this->defaultOptions, $options));
}

public function handle(Request $request, int $type = HttpKernelInterface::MAIN_REQUEST, bool $catch = true): Response
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true): Response
{
if ($this->cors->isPreflightRequest($request)) {
$response = $this->cors->handlePreflightRequest($request);
Expand Down
2 changes: 1 addition & 1 deletion tests/MockApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct(array $responseHeaders)
$this->responseHeaders = $responseHeaders;
}

public function handle(Request $request, int $type = HttpKernelInterface::MAIN_REQUEST, bool $catch = true): Response
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true): Response
{
$response = new Response();

Expand Down

0 comments on commit bda36eb

Please sign in to comment.