Skip to content

Commit

Permalink
Null coalesce not necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Jan 7, 2024
1 parent 20cf3fc commit bb8674c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PriorityQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ public function extract(int $priority = \PHP_INT_MAX): int|string|null
*/
public function peekData(): int|string|null
{
return ($this->data[0] ?? null)?->key ?? null;
return ($this->data[0] ?? null)?->key;
}

/**
* Returns the priority at top of the heap or null if empty. Time complexity: O(1).
*/
public function peekPriority(): ?int
{
return ($this->data[0] ?? null)?->priority ?? null;
return ($this->data[0] ?? null)?->priority;
}

public function isEmpty(): bool
Expand Down

0 comments on commit bb8674c

Please sign in to comment.