Skip to content

Commit

Permalink
Bump minimal PHP version to 8.2, add support for Symfony 7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-galkin-sos committed Apr 24, 2024
1 parent 81864c3 commit 61bc3ed
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 32 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ on:
jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"

strategy:
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
dependencies:
- "highest"
include:
- dependencies: "lowest"
php-version: "8.0"
php-version: "8.2"

steps:
- name: "Checkout"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.phpunit.result.cache
phpunit.xml
reports
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@
}
},
"require": {
"php": "^8.0 || ^8.1 || ^8.2",
"php": "^8.2",
"ratchet/rfc6455": "^0.3.1",
"react/socket": "^1.13.0",
"react/event-loop": "^1.4.0",
"guzzlehttp/psr7": "^2.5.0",
"symfony/http-foundation": "^5.4.24 || ^6.0",
"symfony/routing": "^5.4.22 || ^6.0"
"react/socket": "^1.15.0",
"react/event-loop": "^1.5.0",
"guzzlehttp/psr7": "^2.6.0",
"symfony/http-foundation": "^6.4 || ^7.0",
"symfony/routing": "^6.4 || ^7.0"
},
"config": {
"platform": {
"php": "8.0.0"
"php": "8.2.0"
}
},
"require-dev": {
"phpunit/phpunit": "^9.6.9",
"squizlabs/php_codesniffer": "^3.7"
"phpunit/phpunit": "^9.6",
"squizlabs/php_codesniffer": "^3.9"
},
"scripts": {
"test": "phpunit",
Expand Down
19 changes: 6 additions & 13 deletions src/Ratchet/Session/Storage/Proxy/VirtualProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@

class VirtualProxy extends SessionHandlerProxy
{
/**
* @var string
*/
protected $_sessionId;

/**
* @var string
*/
protected $_sessionName;
protected string $_sessionId;
protected string|false $_sessionName;

/**
* {@inheritdoc}
Expand All @@ -30,23 +23,23 @@ public function __construct(\SessionHandlerInterface $handler)
/**
* {@inheritdoc}
*/
public function getId()
public function getId(): string
{
return $this->_sessionId;
}

/**
* {@inheritdoc}
*/
public function setId($id)
public function setId($id): void
{
$this->_sessionId = $id;
}

/**
* {@inheritdoc}
*/
public function getName()
public function getName(): string
{
return $this->_sessionName;
}
Expand All @@ -55,7 +48,7 @@ public function getName()
* DO NOT CALL THIS METHOD
* @internal
*/
public function setName($name)
public function setName($name): void
{
throw new \RuntimeException("Can not change session name in VirtualProxy");
}
Expand Down
14 changes: 8 additions & 6 deletions src/Ratchet/Session/Storage/VirtualSessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Ratchet\Session\Storage;

use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
use Ratchet\Session\Storage\Proxy\VirtualProxy;
use Ratchet\Session\Serialize\HandlerInterface;
use Ratchet\Session\Storage\Proxy\VirtualProxy;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;

class VirtualSessionStorage extends NativeSessionStorage
{
Expand All @@ -17,6 +17,7 @@ class VirtualSessionStorage extends NativeSessionStorage
* @param \SessionHandlerInterface $handler
* @param string $sessionId The ID of the session to retrieve
* @param \Ratchet\Session\Serialize\HandlerInterface $serializer
* @noinspection PhpMissingParentConstructorInspection
*/
public function __construct(\SessionHandlerInterface $handler, $sessionId, HandlerInterface $serializer)
{
Expand All @@ -29,7 +30,7 @@ public function __construct(\SessionHandlerInterface $handler, $sessionId, Handl
/**
* {@inheritdoc}
*/
public function start()
public function start(): bool
{
if ($this->started && !$this->closed) {
return true;
Expand All @@ -56,15 +57,16 @@ public function start()
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null)
public function regenerate($destroy = false, $lifetime = null): bool
{
return true;
// .. ?
}

/**
* {@inheritdoc}
*/
public function save()
public function save(): void
{
// get the data from the bags?
// serialize the data
Expand All @@ -81,7 +83,7 @@ public function save()
/**
* {@inheritdoc}
*/
public function setSaveHandler($saveHandler = null)
public function setSaveHandler($saveHandler = null): void
{
if (!($saveHandler instanceof \SessionHandlerInterface)) {
throw new \InvalidArgumentException('Handler must be instance of SessionHandlerInterface');
Expand Down

0 comments on commit 61bc3ed

Please sign in to comment.