Skip to content

Commit 5718d44

Browse files
authored
[12.x] Fix remaining PHP 8.5 null index array deprecations (#57308)
* Fix remaining null index array * update phpdoc types
1 parent d7f1bd9 commit 5718d44

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/Illuminate/Broadcasting/BroadcastEvent.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,27 +141,27 @@ protected function formatProperty($value)
141141
* Get the channels for the given connection.
142142
*
143143
* @param array $channels
144-
* @param string $connection
144+
* @param string|null $connection
145145
* @return array
146146
*/
147147
protected function getConnectionChannels($channels, $connection)
148148
{
149-
return is_array($channels[$connection] ?? null)
150-
? $channels[$connection]
149+
return is_array($channels[$connection ?? ''] ?? null)
150+
? $channels[$connection ?? '']
151151
: $channels;
152152
}
153153

154154
/**
155155
* Get the payload for the given connection.
156156
*
157157
* @param array $payload
158-
* @param string $connection
158+
* @param string|null $connection
159159
* @return array
160160
*/
161161
protected function getConnectionPayload($payload, $connection)
162162
{
163-
$connectionPayload = is_array($payload[$connection] ?? null)
164-
? $payload[$connection]
163+
$connectionPayload = is_array($payload[$connection ?? ''] ?? null)
164+
? $payload[$connection ?? '']
165165
: $payload;
166166

167167
if (isset($payload['socket'])) {

src/Illuminate/Database/Eloquent/Relations/BelongsTo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ public function match(array $models, EloquentCollection $results, $relation)
168168
foreach ($models as $model) {
169169
$attribute = $this->getDictionaryKey($this->getForeignKeyFrom($model));
170170

171-
if (isset($dictionary[$attribute])) {
172-
$model->setRelation($relation, $dictionary[$attribute]);
171+
if (isset($dictionary[$attribute ?? ''])) {
172+
$model->setRelation($relation, $dictionary[$attribute ?? '']);
173173
}
174174
}
175175

src/Illuminate/Queue/Worker.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Worker
3232
/**
3333
* The name of the worker.
3434
*
35-
* @var string
35+
* @var string|null
3636
*/
3737
protected $name;
3838

@@ -363,8 +363,8 @@ protected function getNextJob($connection, $queue)
363363
$this->raiseBeforeJobPopEvent($connection->getConnectionName());
364364

365365
try {
366-
if (isset(static::$popCallbacks[$this->name])) {
367-
if (! is_null($job = (static::$popCallbacks[$this->name])($popJobCallback, $queue))) {
366+
if (isset(static::$popCallbacks[$this->name ?? ''])) {
367+
if (! is_null($job = (static::$popCallbacks[$this->name ?? ''])($popJobCallback, $queue))) {
368368
$this->raiseAfterJobPopEvent($connection->getConnectionName(), $job);
369369
}
370370

0 commit comments

Comments
 (0)