Update PHP dependencies (major version bumps)
This commit is contained in:
parent
6c4e92baf2
commit
b4402a5b59
|
@ -26,37 +26,38 @@
|
|||
"ext-pdo": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-xml": "*",
|
||||
"doctrine/dbal": "^3.2",
|
||||
"doctrine/dbal": "^3.5",
|
||||
"erusev/parsedown": "^1.7",
|
||||
"gettext/gettext": "^5.6",
|
||||
"gettext/translator": "^1.0",
|
||||
"guzzlehttp/guzzle": "^7.4",
|
||||
"illuminate/container": "^8.76",
|
||||
"illuminate/database": "^8.76",
|
||||
"illuminate/support": "^8.76",
|
||||
"gettext/gettext": "^5.7",
|
||||
"gettext/translator": "^1.1",
|
||||
"guzzlehttp/guzzle": "^7.5",
|
||||
"illuminate/container": "^9.43",
|
||||
"illuminate/database": "^9.43",
|
||||
"illuminate/support": "^9.43",
|
||||
"league/oauth2-client": "^2.6",
|
||||
"nikic/fast-route": "^1.3",
|
||||
"nyholm/psr7": "^1.4",
|
||||
"psr/container": "^1.1",
|
||||
"nyholm/psr7": "^1.5",
|
||||
"psr/container": "^2.0",
|
||||
"psr/http-server-middleware": "^1.0",
|
||||
"psr/log": "^1.1",
|
||||
"psr/log": "^3.0",
|
||||
"rcrowe/twigbridge": "^0.14.0",
|
||||
"respect/validation": "^1.1",
|
||||
"symfony/http-foundation": "^5.4",
|
||||
"symfony/mailer": "^5.4",
|
||||
"symfony/http-foundation": "^6.2",
|
||||
"symfony/mailer": "^6.2",
|
||||
"symfony/psr-http-message-bridge": "^2.1",
|
||||
"twig/twig": "^3.4",
|
||||
"vlucas/phpdotenv": "^5.4"
|
||||
"vlucas/phpdotenv": "^5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"dms/phpunit-arraysubset-asserts": "^0.3.1",
|
||||
"fakerphp/faker": "^1.17",
|
||||
"dms/phpunit-arraysubset-asserts": "^0.4",
|
||||
"fakerphp/faker": "^1.20",
|
||||
"fig/log-test": "^1.1",
|
||||
"filp/whoops": "^2.14",
|
||||
"phpstan/phpstan": "^1.9",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"slevomat/coding-standard": "^7.1",
|
||||
"squizlabs/php_codesniffer": "^3.6",
|
||||
"symfony/var-dumper": "^5.4"
|
||||
"slevomat/coding-standard": "^8.6",
|
||||
"squizlabs/php_codesniffer": "^3.7",
|
||||
"symfony/var-dumper": "^6.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,31 +6,23 @@ use SessionHandlerInterface;
|
|||
|
||||
abstract class AbstractHandler implements SessionHandlerInterface
|
||||
{
|
||||
/** @var string */
|
||||
protected $name;
|
||||
protected string $name;
|
||||
|
||||
/** @var string */
|
||||
protected $sessionPath;
|
||||
protected string $sessionPath;
|
||||
|
||||
/**
|
||||
* Bootstrap the session handler
|
||||
*
|
||||
* @param string $sessionPath
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function open($sessionPath, $name): bool
|
||||
public function open(string $path, string $name): bool
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->sessionPath = $sessionPath;
|
||||
$this->sessionPath = $path;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown the session handler
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function close(): bool
|
||||
{
|
||||
|
@ -39,38 +31,24 @@ abstract class AbstractHandler implements SessionHandlerInterface
|
|||
|
||||
/**
|
||||
* Remove old sessions
|
||||
*
|
||||
* @param int $maxLifetime
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function gc($maxLifetime)
|
||||
public function gc(int $max_lifetime): int|false
|
||||
{
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read session data
|
||||
*
|
||||
* @param string $id
|
||||
* @return string
|
||||
*/
|
||||
abstract public function read($id): string;
|
||||
abstract public function read(string $id): string;
|
||||
|
||||
/**
|
||||
* Write session data
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $data
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function write($id, $data): bool;
|
||||
abstract public function write(string $id, string $data): bool;
|
||||
|
||||
/**
|
||||
* Delete a session
|
||||
*
|
||||
* @param string $id
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function destroy($id): bool;
|
||||
abstract public function destroy(string $id): bool;
|
||||
}
|
||||
|
|
|
@ -7,12 +7,8 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
|
|||
|
||||
class DatabaseHandler extends AbstractHandler
|
||||
{
|
||||
/** @var Database */
|
||||
protected $database;
|
||||
protected Database $database;
|
||||
|
||||
/**
|
||||
* @param Database $database
|
||||
*/
|
||||
public function __construct(Database $database)
|
||||
{
|
||||
$this->database = $database;
|
||||
|
@ -21,7 +17,7 @@ class DatabaseHandler extends AbstractHandler
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function read($id): string
|
||||
public function read(string $id): string
|
||||
{
|
||||
$session = $this->getQuery()
|
||||
->where('id', '=', $id)
|
||||
|
@ -33,7 +29,7 @@ class DatabaseHandler extends AbstractHandler
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function write($id, $data): bool
|
||||
public function write(string $id, string $data): bool
|
||||
{
|
||||
$values = [
|
||||
'payload' => $data,
|
||||
|
@ -62,7 +58,7 @@ class DatabaseHandler extends AbstractHandler
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function destroy($id): bool
|
||||
public function destroy(string $id): bool
|
||||
{
|
||||
$this->getQuery()
|
||||
->where('id', '=', $id)
|
||||
|
@ -74,20 +70,15 @@ class DatabaseHandler extends AbstractHandler
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function gc($maxLifetime)
|
||||
public function gc(int $max_lifetime): int|false
|
||||
{
|
||||
$timestamp = $this->getCurrentTimestamp(-$maxLifetime);
|
||||
$timestamp = $this->getCurrentTimestamp(-$max_lifetime);
|
||||
|
||||
$this->getQuery()
|
||||
return $this->getQuery()
|
||||
->where('last_activity', '<', $timestamp)
|
||||
->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return QueryBuilder
|
||||
*/
|
||||
protected function getQuery(): QueryBuilder
|
||||
{
|
||||
return $this->database
|
||||
|
@ -97,9 +88,6 @@ class DatabaseHandler extends AbstractHandler
|
|||
|
||||
/**
|
||||
* Format the SQL timestamp
|
||||
*
|
||||
* @param int $diff
|
||||
* @return string
|
||||
*/
|
||||
protected function getCurrentTimestamp(int $diff = 0): string
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ use Engelsystem\Models\LogEntry;
|
|||
use Psr\Log\AbstractLogger;
|
||||
use Psr\Log\InvalidArgumentException;
|
||||
use Psr\Log\LogLevel;
|
||||
use Stringable;
|
||||
use Throwable;
|
||||
|
||||
class Logger extends AbstractLogger
|
||||
|
@ -35,13 +36,12 @@ class Logger extends AbstractLogger
|
|||
/**
|
||||
* Logs with an arbitrary level.
|
||||
*
|
||||
* @param mixed $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param mixed $level
|
||||
* @param string|Stringable $message
|
||||
* @param array $context
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function log($level, $message, array $context = []): void
|
||||
public function log($level, string|Stringable $message, array $context = []): void
|
||||
{
|
||||
if (!$this->checkLevel($level)) {
|
||||
throw new InvalidArgumentException('Unknown log level: ' . $level);
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Engelsystem\Logger;
|
|||
|
||||
use Engelsystem\Helpers\Authenticator;
|
||||
use Psr\Log\InvalidArgumentException;
|
||||
use Stringable;
|
||||
|
||||
class UserAwareLogger extends Logger
|
||||
{
|
||||
|
@ -13,13 +14,13 @@ class UserAwareLogger extends Logger
|
|||
/**
|
||||
* Logs with an arbitrary level and prepends the user
|
||||
*
|
||||
* @param mixed $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param mixed $level
|
||||
* @param string|Stringable $message
|
||||
* @param array $context
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function log($level, $message, array $context = []): void
|
||||
public function log($level, string|Stringable $message, array $context = []): void
|
||||
{
|
||||
if ($this->auth && ($user = $this->auth->user())) {
|
||||
$message = sprintf('%s (%u): %s', $user->name, $user->id, $message);
|
||||
|
|
|
@ -39,6 +39,6 @@ class AbstractHandlerTest extends TestCase
|
|||
$handler = new ArrayHandler();
|
||||
$return = $handler->gc(60 * 60 * 24);
|
||||
|
||||
$this->assertTrue($return);
|
||||
$this->assertEquals(0, $return);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class DatabaseHandlerTest extends TestCase
|
|||
|
||||
$handler = new DatabaseHandler($this->database);
|
||||
|
||||
$this->assertTrue($handler->gc(60 * 60));
|
||||
$this->assertEquals(1, $handler->gc(60 * 60));
|
||||
|
||||
$return = $this->database->select('SELECT * FROM sessions');
|
||||
$this->assertCount(1, $return);
|
||||
|
|
Loading…
Reference in New Issue