Skip to content

Instantly share code, notes, and snippets.

@EXayer
Last active February 11, 2024 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EXayer/2864d54a77abe047a4225059e54925c2 to your computer and use it in GitHub Desktop.
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'
<?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