Skip to content

Commit

Permalink
fix: return type compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
papac committed Dec 14, 2024
1 parent 0d232ad commit 489ea4a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
10 changes: 4 additions & 6 deletions src/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,14 @@ public function route(array $definition): void
*
* @param string $path
* @param callable|string|array $cb
* @return Router
* @return Route
* @throws
*/
public function any(string $path, callable|string|array $cb): Router
public function any(string $path, callable|string|array $cb): Route
{
foreach (['options', 'patch', 'post', 'delete', 'put', 'get'] as $method) {
$this->$method($path, $cb);
}
$methods = array_map('strtoupper', ['options', 'patch', 'post', 'delete', 'put', 'get']);

return $this;
return $this->pushHttpVerb($methods, $path, $cb);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Session/Driver/DatabaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ public function destroy(string $session_id): bool
* Garbage collector for cleans old sessions
*
* @param int $max_lifetime
* @return bool
* @return int|false
*/
public function gc(int $max_lifetime): bool
public function gc(int $max_lifetime): int|false
{
$this->sessions()
->where('time', '<', $this->createTimestamp())
->delete();

return true;
return 1;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Session/Driver/FilesystemDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ public function destroy(string $session_id): bool
* Garbage collector
*
* @param int $maxlifetime
* @return bool
* @return int|false
*/
public function gc(int $maxlifetime): bool
public function gc(int $maxlifetime): int|false
{
foreach (glob($this->save_path . "/*") as $file) {
if (filemtime($file) + $maxlifetime < $this->createTimestamp() && file_exists($file)) {
@unlink($file);
}
}

return true;
return 1;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Session/SessionConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class SessionConfiguration extends Configuration
public function create(Loader $config): void
{
$this->container->bind('session', function () use ($config) {
$session = Session::configure($config['session']);
$session = Session::configure((array) $config['session']);

Tokenize::makeCsrfToken($config['session.lifetime']);
Tokenize::makeCsrfToken((int) $config['session.lifetime']);

// Reboot the old request values
Session::getInstance()->add('__bow.old', []);
Expand Down

0 comments on commit 489ea4a

Please sign in to comment.