diff --git a/src/Users/SqlUserService.php b/src/Users/SqlUserService.php index 2aef194..bfeeac3 100644 --- a/src/Users/SqlUserService.php +++ b/src/Users/SqlUserService.php @@ -161,7 +161,7 @@ public function getUserById(int $id): User $statement->execute(['id' => $id]); $row = $statement->fetch(PDO::FETCH_ASSOC); - if (empty($row)) { + if ($row === false || \count($row) === 0) { throw new UserNotFoundException("No user found with ID $id"); } diff --git a/tests/Integration/IntegrationTestCase.php b/tests/Integration/IntegrationTestCase.php index f82a329..7e8233e 100644 --- a/tests/Integration/IntegrationTestCase.php +++ b/tests/Integration/IntegrationTestCase.php @@ -21,7 +21,8 @@ protected function setUp(): void parent::setUp(); // Auto-call certain trait methods if the test case uses them - $traits = \class_uses($this) ?: []; + $traits = \class_uses($this); + $traits = $traits === false ? [] : $traits; if (isset($traits[MigratesDatabase::class])) { /** @psalm-suppress UndefinedMethod This method will exist because it uses the migration trait */