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

Symfony 4.4 compatibility #42

Merged
merged 3 commits into from
May 25, 2021
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
30 changes: 10 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,22 @@ jobs:
php-version: '${{ matrix.php-versions }}'
extensions: mbstring,intl,mongodb
tools: composer:v2
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update ${{ matrix.composer.flags }}
- name: PHPUnit
run: composer test

static-analysis:
name: Static analysis
name: Static analysis (PHP ${{ matrix.php-versions }}) (${{ matrix.composer.name }} dependencies)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4', '8.0']
composer:
- {name: "lowest", flags: " --prefer-dist --prefer-lowest"}
- {name: "stable", flags: " --prefer-dist --prefer-stable"}
steps:
- name: Checkout
uses: actions/checkout@v1
Expand All @@ -47,17 +46,8 @@ jobs:
php-version: '8.0'
extensions: mbstring,intl,mongodb
tools: composer:v2
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist
run: composer update ${{ matrix.composer.flags }}
- name: PHPStan
run: composer phpstan

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"require-dev": {
"symfony/var-dumper": "^4.0||^5.0",
"phpunit/phpunit": "^9.1",
"phpunit/phpunit": "^9.5",
"phpspec/prophecy": "^1.11",
"phpspec/prophecy-phpunit": "^2.0",
"friendsofphp/php-cs-fixer": "^2.16",
Expand Down
2 changes: 1 addition & 1 deletion src/Http/KernelHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(HttpKernelInterface $kernel)
}

/**
* {@inheritDoc}
* {@inheritdoc}
*/
public function handle(Request $request): \Iterator
{
Expand Down
2 changes: 1 addition & 1 deletion src/Http/MiddlewareStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct(SplStack $middlewares, RequestHandlerInterface $hand
$this->iterators = new SplStack();
}

public function handle(Request $request, int $type = self::MASTER_REQUEST, bool $catch = true): Response
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
if ($this->middlewares->isEmpty()) {
$gen = $this->handler->handle($request);
Expand Down
16 changes: 7 additions & 9 deletions src/Integration/PHP/NativeSessionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,20 @@ private function addSessionCookie(Response $response, string $sessionId): void
return;
}

$cookie = Cookie::create($sessionName)
->withValue($sessionId)
->withPath($params['path'])
->withDomain($params['domain'])
->withSecure($params['secure'])
->withHttpOnly($params['httponly'])
;
$expire = 0;

if ($params['lifetime'] > 0) {
$cookie = $cookie->withExpires(time() + $params['lifetime']);
$expire = time() + $params['lifetime'];
}

$sameSite = null;

if ($params['samesite']) {
$cookie = $cookie->withSameSite($params['samesite']);
$sameSite = $params['samesite'];
}

$cookie = Cookie::create($sessionName, $sessionId, $expire, $params['path'], $params['domain'], $params['secure'], $params['httponly'], false, $sameSite);

$response->headers->setCookie($cookie);
}
}
2 changes: 1 addition & 1 deletion tests/Integration/Doctrine/DoctrineORMMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function setUp(): void

$this->request = Request::create('https://example.org');
$this->handler = new class() implements HttpKernelInterface {
public function handle(Request $request, int $type = self::MASTER_REQUEST, bool $catch = true)
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
return new Response();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/PHP/NativeSessionMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function __construct(\Closure $handler)
$this->handler = $handler;
}

public function handle(Request $request, int $type = self::MASTER_REQUEST, bool $catch = true)
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
return ($this->handler)($request);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Sentry/SentryMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(SentryMiddlewareTest $test)
$this->test = $test;
}

public function handle(Request $request, int $type = self::MASTER_REQUEST, bool $catch = true)
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
return ($this->test->onRequest)($request);
}
Expand Down