Change lpush and rpush methods to accept single values#1669
Change lpush and rpush methods to accept single values#1669JoseGonzalez84 wants to merge 1 commit into
Conversation
PR for fix a couple of methods documentation.
|
@JoseGonzalez84 This is incorrect interpretation of Redis API. Both LPUSH and RPUSH accept enumeration of elements, for now it's defined as an array in our public API (which kind of suboptimal), but it shouldn't be a string. PHP enumeration is the closest semantically (e.g |
|
I have Predis version 2.4.0 (as seen in composer.lock). My PHP version is 8.4.17. If I pass an array ($data) as the second parameter of the This method only works if Example: the next code works public function addProcess(string $agentId, string $actionId, array $data): void
{
$this->connection->rpush($this->path.":".self::KEY_PROCESS.":$agentId:$actionId", json_encode($data));
}the next code throws an exception public function addProcess(string $agentId, string $actionId, array $data): void
{
$this->connection->rpush($this->path.":".self::KEY_PROCESS.":$agentId:$actionId", $data);
}This is a strange situation, because if you work with the documentation, the problem is guaranteed. The Redis documentation is irrelevant here; PHP is in charge. And it won't let me pass a string sequence. |
|
@JoseGonzalez84 Okay, I understand it. But it should go the other way around, the internal code should be fixed so it could work as specified in the public API |
You're right. I'll try to work on this to resolve it. |
Related with #1146
PR for fix a couple of methods documentation.