fix(controller): default $socketIds in whisper() to silence PHP 8.x deprecation
Optional parameter $payload (and $event) declared before required parameter $socketIds is implicitly treated as required by PHP 8.4+, emitting a deprecation on every class load: PHP Deprecated: Optional parameter $payload declared before required parameter $socketIds is implicitly treated as a required parameter Made $socketIds optional (= []) — empty matches no connections via array_flip lookup, so callers that intentionally omit it get a no-op which preserves the practical contract (you can't whisper to nobody). All four parameters are now optional. No call-site changes needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f030ff1fbf
commit
f40d183271
|
|
@ -473,9 +473,14 @@ class Controller
|
|||
final public function whisper(
|
||||
array|string|null $payload = null,
|
||||
?string $event = null,
|
||||
array $socketIds,
|
||||
array $socketIds = [],
|
||||
?string $channel = null
|
||||
) {
|
||||
// PHP 8.x deprecates "optional before required" in parameter
|
||||
// lists, so $socketIds is now defaulted. Empty $socketIds is a
|
||||
// no-op (the array_flip-based lookup below matches no
|
||||
// connections), preserving the existing behavior for callers
|
||||
// that intentionally omit it.
|
||||
if (is_string($payload)) {
|
||||
$payload = [
|
||||
'message' => $payload,
|
||||
|
|
|
|||
Loading…
Reference in New Issue