Skip to content

Commit

Permalink
Fix missing data do warning
Browse files Browse the repository at this point in the history
  • Loading branch information
bckp committed Mar 28, 2024
1 parent 73720c5 commit f094ef1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Consumer/ConsumerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ private function create(string $name): Consumer
$prefetchSize = null;
$prefetchCount = null;

if ($consumerData['qos']['prefetchSize'] !== null) {
if (($consumerData['qos']['prefetchSize'] ?? null) !== null) {
$prefetchSize = $consumerData['qos']['prefetchSize'];

Check failure on line 61 in src/Consumer/ConsumerFactory.php

View workflow job for this annotation

GitHub Actions / Psalm

PossiblyUndefinedArrayOffset

src/Consumer/ConsumerFactory.php:61:20: PossiblyUndefinedArrayOffset: Possibly undefined array key $consumerData['qos'] on array{callback: callable, qos?: ArrayAccess|array{prefetchSize: mixed, ...<array-key, mixed>}|mixed, ...<string, mixed>} (see https://psalm.dev/167)

Check failure on line 61 in src/Consumer/ConsumerFactory.php

View workflow job for this annotation

GitHub Actions / Psalm

PossiblyNullReference

src/Consumer/ConsumerFactory.php:61:20: PossiblyNullReference: Cannot call method offsetGet on possibly null value (see https://psalm.dev/083)

Check failure on line 61 in src/Consumer/ConsumerFactory.php

View workflow job for this annotation

GitHub Actions / Psalm

PossiblyNullArrayAccess

src/Consumer/ConsumerFactory.php:61:20: PossiblyNullArrayAccess: Cannot access array value on possibly null variable $consumerData['qos'] of type ArrayAccess|array{prefetchSize: mixed, ...<array-key, mixed>}|mixed|null (see https://psalm.dev/079)
}

if ($consumerData['qos']['prefetchCount'] !== null) {
if (($consumerData['qos']['prefetchCount'] ?? null) !== null) {

Check failure on line 64 in src/Consumer/ConsumerFactory.php

View workflow job for this annotation

GitHub Actions / Psalm

PossiblyUndefinedArrayOffset

src/Consumer/ConsumerFactory.php:64:8: PossiblyUndefinedArrayOffset: Possibly undefined array key $consumerData['qos'] on array{callback: callable, qos?: ArrayAccess|array{prefetchSize: mixed, ...<array-key, mixed>}|mixed, ...<string, mixed>} (see https://psalm.dev/167)

Check failure on line 64 in src/Consumer/ConsumerFactory.php

View workflow job for this annotation

GitHub Actions / Psalm

PossiblyNullReference

src/Consumer/ConsumerFactory.php:64:8: PossiblyNullReference: Cannot call method offsetGet on possibly null value (see https://psalm.dev/083)

Check failure on line 64 in src/Consumer/ConsumerFactory.php

View workflow job for this annotation

GitHub Actions / Psalm

PossiblyNullArrayAccess

src/Consumer/ConsumerFactory.php:64:8: PossiblyNullArrayAccess: Cannot access array value on possibly null variable $consumerData['qos'] of type ArrayAccess|array{prefetchSize: mixed, ...<array-key, mixed>}|mixed|null (see https://psalm.dev/079)
$prefetchCount = $consumerData['qos']['prefetchCount'];

Check failure on line 65 in src/Consumer/ConsumerFactory.php

View workflow job for this annotation

GitHub Actions / Psalm

PossiblyUndefinedArrayOffset

src/Consumer/ConsumerFactory.php:65:21: PossiblyUndefinedArrayOffset: Possibly undefined array key $consumerData['qos'] on array{callback: callable, qos?: ArrayAccess|array{prefetchSize: mixed, ...<array-key, mixed>}|mixed, ...<string, mixed>} (see https://psalm.dev/167)

Check failure on line 65 in src/Consumer/ConsumerFactory.php

View workflow job for this annotation

GitHub Actions / Psalm

PossiblyNullReference

src/Consumer/ConsumerFactory.php:65:21: PossiblyNullReference: Cannot call method offsetGet on possibly null value (see https://psalm.dev/083)

Check failure on line 65 in src/Consumer/ConsumerFactory.php

View workflow job for this annotation

GitHub Actions / Psalm

PossiblyNullArrayAccess

src/Consumer/ConsumerFactory.php:65:21: PossiblyNullArrayAccess: Cannot access array value on possibly null variable $consumerData['qos'] of type ArrayAccess|array{prefetchSize: mixed, ...<array-key, mixed>}|mixed|null (see https://psalm.dev/079)
}

Expand Down

0 comments on commit f094ef1

Please sign in to comment.