forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbug-12748.php
54 lines (42 loc) · 908 Bytes
/
bug-12748.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php declare(strict_types = 1); // lint >= 8.0
namespace Bug12748;
use SessionHandlerInterface;
class HelloWorld
{
public function getHandler(): SessionHandlerInterface
{
return new SessHandler;
}
}
class SessHandler implements SessionHandlerInterface
{
public function close(): bool
{
return true;
}
public function destroy(string $id): bool
{
return true;
}
public function gc(int $max_lifetime): int|false
{
return false;
}
public function open(string $path, string $name): bool
{
return true;
}
public function read(string $id): string|false
{
return false;
}
public function write(string $id, string $data): bool
{
return true;
}
}
$sessionHandler = (new HelloWorld)->getHandler();
$session = $sessionHandler->read('123');
if ($session === false) {
return null;
}