Skip to content

Conversation

SQKo
Copy link
Collaborator

@SQKo SQKo commented Dec 3, 2023

A void/null cache class for PSR-16/SimpleCache implementation

might want to have its own repo

@SQKo SQKo force-pushed the psr16-void-cache branch from 12f4f1b to 17f924d Compare December 3, 2023 13:09
Comment on lines +38 to +44
$result = [];

foreach ($keys as $key) {
$result[$key] = $default;
}

return $result;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$result = [];
foreach ($keys as $key) {
$result[$key] = $default;
}
return $result;
return array_fill_keys($keys, $default);

Though not sure if it accepts iterable, so maybe this instead?

Suggested change
$result = [];
foreach ($keys as $key) {
$result[$key] = $default;
}
return $result;
return array_fill_keys(iterator_to_array($keys), $default);

Copy link
Collaborator Author

@SQKo SQKo May 8, 2024

Choose a reason for hiding this comment

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

I thought of this before, but i changed my mind

Now i forgot why i changed my mind, it was probably something with the object's getIterator() implementation and the use of Generator, but not sure which

@valzargaming valzargaming added the stale Information contained within may be old or outdated. label May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Information contained within may be old or outdated.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants