Last active
February 11, 2024 02:01
-
-
Save EXayer/2864d54a77abe047a4225059e54925c2 to your computer and use it in GitHub Desktop.
PHP Storm - wrong quick fix hint '$relationModels[Deal::class]->items[$parseResultDto->key] ?? null' is always 'null'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Domain\Entities\LootList; | |
use App\Domain\Entities\LootList\Models\LootList; | |
use Illuminate\Database\Eloquent\Model; | |
use ItemSchema\Parser\DataTransferObjects\LootListParseResultDto; | |
class LootListToItemSyncService | |
{ | |
protected function findOwnerModel(object $parseResultDto, array $relationModels): ?Model | |
{ | |
/** @var LootListParseResultDto $parseResultDto */ | |
// '$relationModels[LootList::class]->items[$parseResultDto->key] ?? null' is always 'null' | |
return $relationModels[LootList::class]->items[$parseResultDto->key] ?? null; | |
} | |
protected function findOwnerModel2(object $parseResultDto, array $relationModels): ?Model | |
{ | |
/** @var LootListParseResultDto $parseResultDto */ | |
return $relationModels[LootList::class]->items[$parseResultDto->key] ? new LootList() : null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment