Skip to content

Commit

Permalink
More optimization by Tigrov
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Sep 26, 2023
1 parent eb55644 commit 00395e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/AssignmentsStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ public function get(string $itemName, string $userId): ?Assignment
{
/** @psalm-var RawAssignment|null $row */
$row = (new Query($this->database))
->select(['createdAt'])

Check warning on line 103 in src/AssignmentsStorage.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ public function get(string $itemName, string $userId) : ?Assignment { /** @psalm-var RawAssignment|null $row */ - $row = (new Query($this->database))->select(['createdAt'])->from($this->tableName)->where(['itemName' => $itemName, 'userId' => $userId])->one(); + $row = (new Query($this->database))->select([])->from($this->tableName)->where(['itemName' => $itemName, 'userId' => $userId])->one(); return $row === null ? null : new Assignment($userId, $itemName, (int) $row['createdAt']); } public function exists(string $itemName, string $userId) : bool

Check warning on line 103 in src/AssignmentsStorage.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ public function get(string $itemName, string $userId) : ?Assignment { /** @psalm-var RawAssignment|null $row */ - $row = (new Query($this->database))->select(['createdAt'])->from($this->tableName)->where(['itemName' => $itemName, 'userId' => $userId])->one(); + $row = (new Query($this->database))->select([])->from($this->tableName)->where(['itemName' => $itemName, 'userId' => $userId])->one(); return $row === null ? null : new Assignment($userId, $itemName, (int) $row['createdAt']); } public function exists(string $itemName, string $userId) : bool
->from($this->tableName)
->where(['itemName' => $itemName, 'userId' => $userId])

Check warning on line 105 in src/AssignmentsStorage.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ public function get(string $itemName, string $userId) : ?Assignment { /** @psalm-var RawAssignment|null $row */ - $row = (new Query($this->database))->select(['createdAt'])->from($this->tableName)->where(['itemName' => $itemName, 'userId' => $userId])->one(); + $row = (new Query($this->database))->select(['createdAt'])->from($this->tableName)->where(['userId' => $userId])->one(); return $row === null ? null : new Assignment($userId, $itemName, (int) $row['createdAt']); } public function exists(string $itemName, string $userId) : bool

Check warning on line 105 in src/AssignmentsStorage.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ public function get(string $itemName, string $userId) : ?Assignment { /** @psalm-var RawAssignment|null $row */ - $row = (new Query($this->database))->select(['createdAt'])->from($this->tableName)->where(['itemName' => $itemName, 'userId' => $userId])->one(); + $row = (new Query($this->database))->select(['createdAt'])->from($this->tableName)->where(['userId' => $userId])->one(); return $row === null ? null : new Assignment($userId, $itemName, (int) $row['createdAt']); } public function exists(string $itemName, string $userId) : bool
->one();

return $row === null ? null : new Assignment($row['userId'], $row['itemName'], (int) $row['createdAt']);
return $row === null ? null : new Assignment($userId, $itemName, (int) $row['createdAt']);
}

public function exists(string $itemName, string $userId): bool
Expand Down

0 comments on commit 00395e6

Please sign in to comment.