Skip to content

Commit 28b9978

Browse files
committed
Reset array keys after filtering
1 parent 9a6f8f5 commit 28b9978

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/Client/BlobBuildAPIClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function getAuthenticatedUser(): User
105105

106106
/**
107107
* Search for projects by name
108-
* @param string $query
108+
* @param string $query The search query (max length: 100 characters)
109109
* @return ProjectListItem[]
110110
* @throws ApiException
111111
*/

src/Client/User.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function getData(): UserModel
3030
*/
3131
public function getProjects(): array
3232
{
33-
return array_filter($this->client->listProjects(), function (ProjectListItem $project): bool {
33+
return array_values(array_filter($this->client->listProjects(), function (ProjectListItem $project): bool {
3434
return $project->getData()->getOwner() === $this->data->getName();
35-
});
35+
}));
3636
}
3737
}

tests/Unit/UserTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Aternos\BlobBuild\Test\Unit;
44

5-
use Aternos\BlobBuild\Client\Project;
5+
6+
use Aternos\BlobBuild\Client\ProjectListItem;
67

78
class UserTest extends UnitTestCase
89
{
@@ -21,7 +22,7 @@ public function testGetAuthenticatedUser(): void
2122
$projects = $user->getProjects();
2223
$this->assertCount(1, $projects);
2324
$project = $projects[0];
24-
$this->assertInstanceOf(Project::class, $project);
25+
$this->assertInstanceOf(ProjectListItem::class, $project);
2526
$this->assertSoundMuffler($project->getData());
2627
}
2728
}

0 commit comments

Comments
 (0)