diff --git a/resources/functionMap.php b/resources/functionMap.php index 8e291259e0a..402720ffee8 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -8635,7 +8635,7 @@ 'Redis::sDiff' => ['__benevolent|false>', 'key'=>'string', '...other_keys='=>'string'], 'Redis::sDiffStore' => ['__benevolent', 'dst'=>'string', 'key'=>'string', '...other_keys='=>'string'], 'Redis::select' => ['__benevolent', 'db'=>'int'], -'Redis::set' => ['__benevolent', 'key'=>'string', 'value'=>'mixed', 'options='=>'array'], +'Redis::set' => ['__benevolent', 'key'=>'string', 'value'=>'mixed', 'options='=>'array|int|null'], 'Redis::setBit' => ['__benevolent', 'key'=>'string', 'idx'=>'int', 'value'=>'bool'], 'Redis::setex' => ['__benevolent', 'key'=>'string', 'expire'=>'int', 'value'=>'mixed'], 'Redis::setnx' => ['__benevolent', 'key'=>'string', 'value'=>'mixed'], diff --git a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php index e03a97fc739..67834e4c54f 100644 --- a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php @@ -4586,4 +4586,12 @@ public function testClassConstantWildcardArguments(): void ]); } + public function testBug15393(): void + { + $this->checkThisOnly = false; + $this->checkNullables = true; + $this->checkUnionTypes = true; + $this->analyse([__DIR__ . '/data/bug-15393.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Methods/data/bug-15393.php b/tests/PHPStan/Rules/Methods/data/bug-15393.php new file mode 100644 index 00000000000..a4b74fb0ba5 --- /dev/null +++ b/tests/PHPStan/Rules/Methods/data/bug-15393.php @@ -0,0 +1,11 @@ +set('key', 'value'); + $redis->set('key', 'value', 3600); + $redis->set('key', 'value', ['nx', 'ex' => 3600]); + $redis->set('key', 'value', null); +}