From 01652eb3e5e0531eb47eb95b4d95be265b2199c1 Mon Sep 17 00:00:00 2001 From: Ion Bazan Date: Wed, 8 Oct 2025 21:46:37 +0800 Subject: [PATCH 1/2] Fix remaining null index array --- src/Illuminate/Broadcasting/BroadcastEvent.php | 8 ++++---- src/Illuminate/Database/Eloquent/Relations/BelongsTo.php | 4 ++-- src/Illuminate/Queue/Worker.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Illuminate/Broadcasting/BroadcastEvent.php b/src/Illuminate/Broadcasting/BroadcastEvent.php index 77b864e0b6d9..b0bd31fe5ff9 100644 --- a/src/Illuminate/Broadcasting/BroadcastEvent.php +++ b/src/Illuminate/Broadcasting/BroadcastEvent.php @@ -146,8 +146,8 @@ protected function formatProperty($value) */ protected function getConnectionChannels($channels, $connection) { - return is_array($channels[$connection] ?? null) - ? $channels[$connection] + return is_array($channels[$connection ?? ''] ?? null) + ? $channels[$connection ?? ''] : $channels; } @@ -160,8 +160,8 @@ protected function getConnectionChannels($channels, $connection) */ protected function getConnectionPayload($payload, $connection) { - $connectionPayload = is_array($payload[$connection] ?? null) - ? $payload[$connection] + $connectionPayload = is_array($payload[$connection ?? ''] ?? null) + ? $payload[$connection ?? ''] : $payload; if (isset($payload['socket'])) { diff --git a/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php b/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php index 908dc1eef1d9..24c61f63c036 100755 --- a/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php @@ -168,8 +168,8 @@ public function match(array $models, EloquentCollection $results, $relation) foreach ($models as $model) { $attribute = $this->getDictionaryKey($this->getForeignKeyFrom($model)); - if (isset($dictionary[$attribute])) { - $model->setRelation($relation, $dictionary[$attribute]); + if (isset($dictionary[$attribute ?? ''])) { + $model->setRelation($relation, $dictionary[$attribute ?? '']); } } diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 875a9c7f409d..45f14ed976fc 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -363,8 +363,8 @@ protected function getNextJob($connection, $queue) $this->raiseBeforeJobPopEvent($connection->getConnectionName()); try { - if (isset(static::$popCallbacks[$this->name])) { - if (! is_null($job = (static::$popCallbacks[$this->name])($popJobCallback, $queue))) { + if (isset(static::$popCallbacks[$this->name ?? ''])) { + if (! is_null($job = (static::$popCallbacks[$this->name ?? ''])($popJobCallback, $queue))) { $this->raiseAfterJobPopEvent($connection->getConnectionName(), $job); } From 60b5fadba387f7198419b6fc7f82fe5677b806ab Mon Sep 17 00:00:00 2001 From: Ion Bazan Date: Wed, 8 Oct 2025 22:13:43 +0800 Subject: [PATCH 2/2] update phpdoc types --- src/Illuminate/Broadcasting/BroadcastEvent.php | 4 ++-- src/Illuminate/Queue/Worker.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Broadcasting/BroadcastEvent.php b/src/Illuminate/Broadcasting/BroadcastEvent.php index b0bd31fe5ff9..2ef568dc6bb0 100644 --- a/src/Illuminate/Broadcasting/BroadcastEvent.php +++ b/src/Illuminate/Broadcasting/BroadcastEvent.php @@ -141,7 +141,7 @@ protected function formatProperty($value) * Get the channels for the given connection. * * @param array $channels - * @param string $connection + * @param string|null $connection * @return array */ protected function getConnectionChannels($channels, $connection) @@ -155,7 +155,7 @@ protected function getConnectionChannels($channels, $connection) * Get the payload for the given connection. * * @param array $payload - * @param string $connection + * @param string|null $connection * @return array */ protected function getConnectionPayload($payload, $connection) diff --git a/src/Illuminate/Queue/Worker.php b/src/Illuminate/Queue/Worker.php index 45f14ed976fc..b89fddd044e5 100644 --- a/src/Illuminate/Queue/Worker.php +++ b/src/Illuminate/Queue/Worker.php @@ -32,7 +32,7 @@ class Worker /** * The name of the worker. * - * @var string + * @var string|null */ protected $name;