Skip to content

Commit 7cdf49f

Browse files
committed
Support PHP 7.4 too
1 parent a8db036 commit 7cdf49f

3 files changed

Lines changed: 44 additions & 10 deletions

File tree

.github/workflows/php.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
php-version:
13+
- "7.4"
1314
- "8.0"
1415
- "8.1"
1516
- "8.2"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^8.0"
14+
"php": "^7.4 || ^8.0"
1515
},
1616
"require-dev": {
1717
"php-parallel-lint/php-parallel-lint": "^1.3",

tests/TestSessionHandler.php

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,22 @@
33

44
namespace Spaze\PhpInfo;
55

6+
use ReturnTypeWillChange;
67
use SessionHandlerInterface;
78
use SessionIdInterface;
89

910
class TestSessionHandler implements SessionHandlerInterface, SessionIdInterface
1011
{
1112

12-
public function __construct(
13-
private string $sessionId,
14-
private array $data = [],
15-
) {
13+
private string $sessionId;
14+
15+
/** @var array<string, string> */
16+
private array $data = [];
17+
18+
19+
public function __construct(string $sessionId)
20+
{
21+
$this->sessionId = $sessionId;
1622
}
1723

1824

@@ -22,7 +28,13 @@ public function create_sid(): string
2228
}
2329

2430

25-
public function open(string $path, string $name): bool
31+
/**
32+
* @param string $path
33+
* @param string $name
34+
* @return true
35+
*/
36+
#[ReturnTypeWillChange]
37+
public function open($path, $name)
2638
{
2739
return true;
2840
}
@@ -34,25 +46,46 @@ public function close(): bool
3446
}
3547

3648

37-
public function destroy(string $id): bool
49+
/**
50+
* @param string $id
51+
* @return bool
52+
*/
53+
#[ReturnTypeWillChange]
54+
public function destroy($id)
3855
{
3956
return true;
4057
}
4158

4259

43-
public function gc(int $max_lifetime): int|false
60+
/**
61+
* @param int $max_lifetime
62+
* @return int
63+
*/
64+
#[ReturnTypeWillChange]
65+
public function gc($max_lifetime)
4466
{
4567
return 0;
4668
}
4769

4870

49-
public function read(string $id): string|false
71+
/**
72+
* @param string $id
73+
* @return string
74+
*/
75+
#[ReturnTypeWillChange]
76+
public function read($id)
5077
{
5178
return $this->data[$id] ?? '';
5279
}
5380

5481

55-
public function write(string $id, string $data): bool
82+
/**
83+
* @param string $id
84+
* @param string $data
85+
* @return bool
86+
*/
87+
#[ReturnTypeWillChange]
88+
public function write($id, $data)
5689
{
5790
$this->data[$id] = $data;
5891
return true;

0 commit comments

Comments
 (0)