Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions .run/Services for Test.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Services for Test" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<deployment type="docker-compose.yml">
<settings>
<option name="sourceFilePath" value="docker-compose.yml" />
</settings>
</deployment>
<method v="2" />
</configuration>
</component>
11 changes: 6 additions & 5 deletions src/Psr16/RedisCacheEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,13 @@
#[\Override]
public function clear(): bool
{
$keys = $this->redis->keys('cache:*');
foreach ($keys as $key) {
if (preg_match('/^cache:(?<key>.*)/', $key, $matches)) {
$this->delete($matches['key']);
$iterator = null;
do {
$keys = $this->redis->scan($iterator, 'cache:*');

Check notice

Code scanning / Psalm

PossiblyNullReference Note

Cannot call method scan on possibly null value
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to create a variable iterator because it gets the references for the next part, if available.

The signature of scan method is:

scan(null|int|string $iterator, string|null $pattern = null, int $count = 0, string|null $type = null)

With is perfectly acceptable set null in $iterator.

foreach($keys as $key) {
$this->delete(substr($key, 6));
}
}
} while($iterator !== 0);
return true;
}

Expand Down
Loading