From 8b0c8216981f537f201d1f96faa5e98b2ed98123 Mon Sep 17 00:00:00 2001 From: Philipp Kolmann Date: Fri, 5 Jul 2024 11:56:37 +0200 Subject: [PATCH] Fix StyleCI issues --- src/Api/Groups.php | 3 ++- src/Api/Projects.php | 1 + src/Api/Registry.php | 11 ++++++++--- tests/Api/ProjectsTest.php | 4 ++-- tests/Api/RegistryTest.php | 5 ++--- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 67975eb0..90f387eb 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -1033,10 +1033,11 @@ public function search($id, array $parameters = []) } /** - * Get a list of registry repositories in a group + * Get a list of registry repositories in a group. * @see https://docs.gitlab.com/ee/api/container_registry.html#within-a-group * * @param $id: The ID of a group + * * @return mixed */ public function registryRepositories(int $id) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 1178a93e..ae40a6fa 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1838,6 +1838,7 @@ public function search($id, array $parameters = []) * * @param int|string $project_id * @param array $parameters { + * * @var bool $tags If the parameter is included as true, each repository includes an array of "tags" in the response. * @var bool $tags_count If the parameter is included as true, each repository includes "tags_count" in the response. * } diff --git a/src/Api/Registry.php b/src/Api/Registry.php index 92c65be6..0ebaf47e 100644 --- a/src/Api/Registry.php +++ b/src/Api/Registry.php @@ -15,19 +15,20 @@ namespace Gitlab\Api; use Symfony\Component\OptionsResolver\Options; -use Symfony\Component\OptionsResolver\OptionsResolver; class Registry extends AbstractApi { /** * @see https://docs.gitlab.com/ee/api/container_registry.html#get-details-of-a-single-repository * - * @param int|string $repository_id The ID of the registry repository accessible by the authenticated user. + * @param int|string $repository_id The ID of the registry repository accessible by the authenticated user * @param array $parameters { + * * @var bool $tags * @var bool $tags_count * @var bool $size * } + * * @return mixed */ public function repositories($repository_id, array $parameters = []) @@ -55,6 +56,7 @@ public function repositories($repository_id, array $parameters = []) * * @param int|string $project_id * @param int $repository_id + * * @return mixed */ public function repositoryTags($project_id, int $repository_id) @@ -71,6 +73,7 @@ public function repositoryTags($project_id, int $repository_id) * @param int|string $project_id * @param int $repository_id * @param string $tag_name + * * @return mixed */ public function repositoryTag($project_id, int $repository_id, string $tag_name) @@ -90,6 +93,7 @@ public function repositoryTag($project_id, int $repository_id, string $tag_name) * @param int|string $project_id * @param int $repository_id * @param string $tag_name + * * @return mixed */ public function removeRepositoryTag($project_id, int $repository_id, string $tag_name) @@ -108,11 +112,13 @@ public function removeRepositoryTag($project_id, int $repository_id, string $tag * @param int|string $project_id * @param int $repository_id * @param array $parameters { + * * @var string $name_regex_delete * @var string $name_regex_keep * @var int $keep_n * @var string $older_than * } + * * @return mixed */ public function removeRepositoryTags($project_id, int $repository_id, array $parameters = []) @@ -127,7 +133,6 @@ public function removeRepositoryTags($project_id, int $repository_id, array $par $resolver->setDefined('older_than') ->setAllowedTypes('older_than', 'string'); - return $this->delete( $this->getProjectPath( $project_id, diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index c83c0eda..e66b6fca 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -3076,7 +3076,7 @@ public function shouldGetProjectRegistryRepositoriesTags(): void { $expectedArray = [ ['id' => 1, 'name' => 'A registry', 'tags' => ['1.0', '1.1'], 'tags_count' => 2], - ['id' => 2, 'name' => 'Another registry', 'tags' => ['2.0', '2.1'], 'tags_count' => 2] + ['id' => 2, 'name' => 'Another registry', 'tags' => ['2.0', '2.1'], 'tags_count' => 2], ]; $api = $this->getApiMock(); @@ -3084,7 +3084,7 @@ public function shouldGetProjectRegistryRepositoriesTags(): void ->method('get') ->with('projects/123/registry/repositories', [ 'tags' => true, - 'tags_count' => true + 'tags_count' => true, ]) ->will($this->returnValue($expectedArray)); diff --git a/tests/Api/RegistryTest.php b/tests/Api/RegistryTest.php index f6eb2cf2..70691126 100644 --- a/tests/Api/RegistryTest.php +++ b/tests/Api/RegistryTest.php @@ -60,8 +60,7 @@ public function shouldGetSingleRepositoryWithParams(): void */ public function shouldGetRepositoryTags(): void { - $expectedArray = [['name' => "A", 'path' => 'group/project:A'], ['name' => "B", 'path' => 'group/project:B']]; - + $expectedArray = [['name' => 'A', 'path' => 'group/project:A'], ['name' => 'B', 'path' => 'group/project:B']]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') @@ -77,7 +76,7 @@ public function shouldGetRepositoryTags(): void */ public function shouldGetRepositoryTag(): void { - $expectedArray = ['name' => "A", 'path' => 'group/project:A']; + $expectedArray = ['name' => 'A', 'path' => 'group/project:A']; $api = $this->getApiMock(); $api->expects($this->once())