Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock file maintenance #76

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -38,16 +38,16 @@
"laminas/laminas-stdlib": "^3.18"
},
"require-dev": {
"laminas/laminas-cache": "^3.10.1",
"laminas/laminas-cache": "^3.12.0",
"laminas/laminas-cache-storage-adapter-memory": "^2.3",
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-db": "^2.18.0",
"laminas/laminas-http": "^2.18",
"laminas/laminas-validator": "^2.30.1",
"mongodb/mongodb": "~1.16.0",
"phpunit/phpunit": "^9.6.13",
"laminas/laminas-http": "^2.19",
"laminas/laminas-validator": "^2.46.0",
"mongodb/mongodb": "~1.16.1",
"phpunit/phpunit": "^9.6.15",
"psalm/plugin-phpunit": "^0.18.4",
"vimeo/psalm": "^5.15"
"vimeo/psalm": "^5.18"
},
"suggest": {
"laminas/laminas-cache": "Laminas\\Cache component",
299 changes: 163 additions & 136 deletions composer.lock

Large diffs are not rendered by default.

354 changes: 154 additions & 200 deletions psalm-baseline.xml

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/AbstractContainer.php
Original file line number Diff line number Diff line change
@@ -392,16 +392,16 @@ protected function expireByHops(Storage $storage, $name, $key)
/**
* Store a value within the container
*
* @param string $key
* @param string $offset
* @param mixed $value
* @return void
*/
public function offsetSet($key, $value)
public function offsetSet($offset, $value)
{
$this->expireKeys($key);
$storage = $this->verifyNamespace();
$name = $this->getName();
$storage[$name][$key] = $value;
$this->expireKeys($offset);
$storage = $this->verifyNamespace();
$name = $this->getName();
$storage[$name][$offset] = $value;
}

/**
6 changes: 3 additions & 3 deletions src/SaveHandler/Cache.php
Original file line number Diff line number Diff line change
@@ -45,15 +45,15 @@ public function __construct(CacheStorage $cacheStorage)
/**
* Open Session
*
* @param string $savePath
* @param string $path
* @param string $name
* @return bool
*/
#[ReturnTypeWillChange]
public function open($savePath, $name)
public function open($path, $name)
{
// @todo figure out if we want to use these
$this->sessionSavePath = $savePath;
$this->sessionSavePath = $path;
$this->sessionName = $name;

return true;
6 changes: 3 additions & 3 deletions src/SaveHandler/DbTableGateway.php
Original file line number Diff line number Diff line change
@@ -55,14 +55,14 @@ public function __construct(
/**
* Open Session
*
* @param string $savePath
* @param string $path
* @param string $name
* @return bool
*/
#[ReturnTypeWillChange]
public function open($savePath, $name)
public function open($path, $name)
{
$this->sessionSavePath = $savePath;
$this->sessionSavePath = $path;
$this->sessionName = $name;
$this->lifetime = ini_get('session.gc_maxlifetime');

4 changes: 2 additions & 2 deletions src/SaveHandler/MongoDB.php
Original file line number Diff line number Diff line change
@@ -71,12 +71,12 @@ public function __construct(protected $mongoClient, MongoDBOptions $options)
/**
* Open session
*
* @param string $savePath
* @param string $path
* @param string $name
* @return bool
*/
#[ReturnTypeWillChange]
public function open($savePath, $name)
public function open($path, $name)
{
// Note: session save path is not used
$this->sessionName = $name;
8 changes: 4 additions & 4 deletions src/Storage/AbstractSessionArrayStorage.php
Original file line number Diff line number Diff line change
@@ -150,9 +150,9 @@ public function offsetGet(mixed $key)
* @return void
*/
#[ReturnTypeWillChange]
public function offsetSet(mixed $key, mixed $value)
public function offsetSet(mixed $offset, mixed $value)
{
$_SESSION[$key] = $value;
$_SESSION[$offset] = $value;
}

/**
@@ -161,9 +161,9 @@ public function offsetSet(mixed $key, mixed $value)
* @return void
*/
#[ReturnTypeWillChange]
public function offsetUnset(mixed $key)
public function offsetUnset(mixed $offset)
{
unset($_SESSION[$key]);
unset($_SESSION[$offset]);
}

/**
19 changes: 7 additions & 12 deletions src/Storage/ArrayStorage.php
Original file line number Diff line number Diff line change
@@ -85,31 +85,26 @@ public function getRequestAccessTime()
* If the object is marked as isImmutable, or the object or key is marked as
* locked, raises an exception.
*
* @param string $key
* @param mixed $value
* @param array-key $offset
* @param mixed $value
* @return void
*/

/**
* @param mixed $key
* @param mixed $value
* @throws Exception\RuntimeException
*/
#[ReturnTypeWillChange]
public function offsetSet($key, $value)
public function offsetSet($offset, $value)
{
if ($this->isImmutable()) {
throw new Exception\RuntimeException(
sprintf('Cannot set key "%s" as storage is marked isImmutable', $key)
sprintf('Cannot set key "%s" as storage is marked isImmutable', $offset)
);
}
if ($this->isLocked($key)) {
if ($this->isLocked($offset)) {
throw new Exception\RuntimeException(
sprintf('Cannot set key "%s" due to locking', $key)
sprintf('Cannot set key "%s" due to locking', $offset)
);
}

parent::offsetSet($key, $value);
parent::offsetSet($offset, $value);
}

/**
4 changes: 3 additions & 1 deletion test/SessionManagerTest.php
Original file line number Diff line number Diff line change
@@ -621,6 +621,7 @@ public function testRememberMeShouldSendNewSessionCookieWithUpdatedTimestamp():

self::assertTrue($found, 'No session cookie found: ' . var_export($headers, true));

self::assertIsString($cookie);
$ts = $this->getTimestampFromCookie($cookie);
if (! $ts) {
self::fail('Cookie did not contain expiry? ' . var_export($headers, true));
@@ -629,7 +630,7 @@ public function testRememberMeShouldSendNewSessionCookieWithUpdatedTimestamp():
self::assertGreaterThan(
$_SERVER['REQUEST_TIME'],
$ts->getTimestamp(),
'Session cookie: ' . var_export($headers, 1)
'Session cookie: ' . var_export($headers, true)
);
}

@@ -663,6 +664,7 @@ public function testRememberMeShouldSetTimestampBasedOnConfigurationByDefault():
}

self::assertTrue($found, 'No session cookie found: ' . var_export($headers, true));
self::assertIsString($cookie);

$ts = $this->getTimestampFromCookie($cookie);
if (! $ts) {
7 changes: 2 additions & 5 deletions test/TestAsset/TestSaveHandler.php
Original file line number Diff line number Diff line change
@@ -12,13 +12,10 @@
*/
class TestSaveHandler implements SaveHandler
{
/**
* @param string $savePath
* @param string $name
*/
#[ReturnTypeWillChange]
public function open($savePath, $name): void
public function open(string $path, string $name): bool
{
return true;
}

public function close(): bool
7 changes: 1 addition & 6 deletions test/TestAsset/TestSaveHandlerWithValidator.php
Original file line number Diff line number Diff line change
@@ -12,12 +12,7 @@
*/
class TestSaveHandlerWithValidator implements SaveHandler
{
/**
* @param string $savePath
* @param string $name
* @return string
*/
public function open($savePath, $name): bool
public function open(string $path, string $name): bool
{
return true;
}