From 09543ad7ba608ec33d2adfbba2148120be59d579 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Tue, 26 Apr 2022 15:37:56 +0100 Subject: [PATCH 001/117] Bumped version --- src/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 872d8369..74e77920 100644 --- a/src/Client.php +++ b/src/Client.php @@ -91,7 +91,7 @@ class Client * * @var string */ - private const USER_AGENT = 'gitlab-php-api-client/11.8'; + private const USER_AGENT = 'gitlab-php-api-client/11.9'; /** * The HTTP client builder. From 3d27dbf0556056fac55ede0d90f3cdb299f4f650 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 6 Mar 2023 11:26:26 +0000 Subject: [PATCH 002/117] Bumped year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 8258d734..377b9fd7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ MIT License Copyright (c) 2012-2018 Matt Humphrey -Copyright (c) 2018-2022 Graham Campbell +Copyright (c) 2018-2023 Graham Campbell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 208c4a99a9a054cdfcd4de4f44e44c662e29c046 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 6 Mar 2023 11:27:27 +0000 Subject: [PATCH 003/117] Bumped versions --- .github/workflows/static.yml | 28 ++++++++++++++++------------ .github/workflows/tests.yml | 12 +++++++----- Makefile | 16 ++++++++-------- README.md | 8 +++++--- composer.json | 21 ++++++++++++++------- phpstan-baseline.neon | 7 ++++++- src/ResultPager.php | 2 +- vendor-bin/phpstan/composer.json | 8 ++++---- vendor-bin/psalm/composer.json | 4 ++-- 9 files changed, 63 insertions(+), 43 deletions(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index f54ccd03..42c11f17 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -7,28 +7,30 @@ on: jobs: phpstan: name: PHPStan - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' - tools: composer:2.1 + php-version: '8.1' + tools: composer:v2 coverage: none + env: + update: true - name: Install Dependencies - uses: nick-invision/retry@v1 + uses: nick-invision/retry@v2 with: timeout_minutes: 5 max_attempts: 5 command: composer update --no-interaction --no-progress - name: Install PHPStan - uses: nick-invision/retry@v1 + uses: nick-invision/retry@v2 with: timeout_minutes: 5 max_attempts: 5 @@ -39,28 +41,30 @@ jobs: psalm: name: Psalm - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' - tools: composer:2.1 + php-version: '8.1' + tools: composer:v2 coverage: none + env: + update: true - name: Install Dependencies - uses: nick-invision/retry@v1 + uses: nick-invision/retry@v2 with: timeout_minutes: 5 max_attempts: 5 command: composer update --no-interaction --no-progress - name: Install Psalm - uses: nick-invision/retry@v1 + uses: nick-invision/retry@v2 with: timeout_minutes: 5 max_attempts: 5 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3464fb5b..8250f3b5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ on: jobs: tests: name: PHP ${{ matrix.php }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: @@ -15,27 +15,29 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - tools: composer:2.1 + tools: composer:v2 coverage: none + env: + update: true - name: Setup Problem Matchers run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Install Dependencies - uses: nick-invision/retry@v1 + uses: nick-invision/retry@v2 with: timeout_minutes: 5 max_attempts: 5 command: composer update --no-interaction --no-progress - name: Install PHPUnit - uses: nick-invision/retry@v1 + uses: nick-invision/retry@v2 with: timeout_minutes: 5 max_attempts: 5 diff --git a/Makefile b/Makefile index 384c41c0..a451bbc1 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,24 @@ install: - @docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.0-base update - @docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.0-base bin all update + @docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.1-base update + @docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.1-base bin all update phpunit: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.0-cli + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.1-cli phpstan-analyze: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.0-cli analyze + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.1-cli analyze phpstan-baseline: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.0-cli analyze --generate-baseline + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.1-cli analyze --generate-baseline psalm-analyze: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.0-cli + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.1-cli psalm-baseline: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.0-cli --set-baseline=psalm-baseline.xml + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.1-cli --set-baseline=psalm-baseline.xml psalm-show-info: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.0-cli --show-info=true + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.1-cli --show-info=true test: phpunit phpstan-analyze psalm-analyze diff --git a/README.md b/README.md index 4a85aa4d..66ee3eba 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ This version supports [PHP](https://php.net) 7.4-8.1. To get started, simply req ### Standard Installation ```bash -$ composer require "m4tthumphrey/php-gitlab-api:^11.8" "guzzlehttp/guzzle:^7.4" "http-interop/http-factory-guzzle:^1.2" +$ composer require "m4tthumphrey/php-gitlab-api:^11.9" \ + "guzzlehttp/guzzle:^7.5" "http-interop/http-factory-guzzle:^1.2" ``` ### Framework Integration @@ -36,13 +37,14 @@ $ composer require "m4tthumphrey/php-gitlab-api:^11.8" "guzzlehttp/guzzle:^7.4" #### Laravel: ```bash -$ composer require "graham-campbell/gitlab:^6.1" +$ composer require "graham-campbell/gitlab:^7.0" ``` #### Symfony: ```bash -$ composer require "zeichen32/gitlabapibundle:^6.0" "symfony/http-client:^5.4" "nyholm/psr7:^1.4" +$ composer require "zeichen32/gitlabapibundle:^6.0" \ + "symfony/http-client:^5.4" "nyholm/psr7:^1.4" ``` We are decoupled from any HTTP messaging client by using [PSR-7](https://www.php-fig.org/psr/psr-7/), [PSR-17](https://www.php-fig.org/psr/psr-17/), [PSR-18](https://www.php-fig.org/psr/psr-18/), and [HTTPlug](https://httplug.io/). You can visit [HTTPlug for library users](https://docs.php-http.org/en/latest/httplug/users.html) to get more information about installing HTTPlug related packages. The framework integration [graham-campbell/gitlab](https://github.com/GrahamCampbell/Laravel-GitLab) is by [Graham Campbell](https://github.com/GrahamCampbell) and [zeichen32/gitlabapibundle](https://github.com/Zeichen32/GitLabApiBundle) is by [Jens Averkamp](https://github.com/Zeichen32). diff --git a/composer.json b/composer.json index a8f1dd16..d7497ce5 100644 --- a/composer.json +++ b/composer.json @@ -30,20 +30,20 @@ "ext-json": "*", "ext-xml": "*", "php-http/cache-plugin": "^1.7.5", - "php-http/client-common": "^2.5", - "php-http/discovery": "^1.14", - "php-http/httplug": "^2.2", + "php-http/client-common": "^2.6", + "php-http/discovery": "^1.15", + "php-http/httplug": "^2.3", "php-http/multipart-stream-builder": "^1.2", "psr/cache": "^1.0 || ^2.0 || ^3.0", "psr/http-client-implementation": "^1.0", "psr/http-factory-implementation": "^1.0", "psr/http-message": "^1.0", "symfony/options-resolver": "^4.4 || ^5.0 || ^6.0", - "symfony/polyfill-php80": "^1.17" + "symfony/polyfill-php80": "^1.26" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "guzzlehttp/guzzle": "^7.4", + "bamarni/composer-bin-plugin": "^1.8.2", + "guzzlehttp/guzzle": "^7.5", "http-interop/http-factory-guzzle": "^1.0" }, "autoload": { @@ -59,7 +59,14 @@ "config": { "preferred-install": "dist", "allow-plugins": { - "bamarni/composer-bin-plugin": true + "bamarni/composer-bin-plugin": true, + "php-http/discovery": true + } + }, + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false } } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1c3433e2..34beb6de 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,7 +1,7 @@ parameters: ignoreErrors: - - message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int, array\\)\\: bool\\)\\|null, Closure\\(\\)\\: void given\\.$#" + message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int\\)\\: bool\\)\\|null, Closure\\(\\)\\: void given\\.$#" count: 1 path: src/Api/AbstractApi.php @@ -10,6 +10,11 @@ parameters: count: 1 path: src/Api/AbstractApi.php + - + message: "#^Parameter \\#4 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" + count: 1 + path: src/Api/AbstractApi.php + - message: "#^Property Gitlab\\\\Api\\\\AbstractApi\\:\\:\\$perPage is never written, only read\\.$#" count: 1 diff --git a/src/ResultPager.php b/src/ResultPager.php index 55bac330..5c22d795 100644 --- a/src/ResultPager.php +++ b/src/ResultPager.php @@ -259,6 +259,7 @@ private function get(string $key): array */ private static function bindPerPage(AbstractApi $api, int $perPage): AbstractApi { + /** @var Closure(AbstractApi): AbstractApi */ $closure = Closure::bind(static function (AbstractApi $api) use ($perPage): AbstractApi { $clone = clone $api; @@ -267,7 +268,6 @@ private static function bindPerPage(AbstractApi $api, int $perPage): AbstractApi return $clone; }, null, AbstractApi::class); - /** @var AbstractApi */ return $closure($api); } } diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json index 4ba502da..88a5f740 100644 --- a/vendor-bin/phpstan/composer.json +++ b/vendor-bin/phpstan/composer.json @@ -1,9 +1,9 @@ { "require": { - "php": "^8.0.2", - "phpstan/phpstan": "1.4.2", - "phpstan/phpstan-deprecation-rules": "1.0.0", - "phpstan/phpstan-strict-rules": "1.1.0", + "php": "^8.1", + "phpstan/phpstan": "1.10.3", + "phpstan/phpstan-deprecation-rules": "1.1.2", + "phpstan/phpstan-strict-rules": "1.5.0", "thecodingmachine/phpstan-strict-rules": "1.0.0", "ergebnis/phpstan-rules": "1.0.0" }, diff --git a/vendor-bin/psalm/composer.json b/vendor-bin/psalm/composer.json index abd249a3..5060e693 100644 --- a/vendor-bin/psalm/composer.json +++ b/vendor-bin/psalm/composer.json @@ -1,7 +1,7 @@ { "require": { - "php": "^8.0.2", - "psalm/phar": "4.18.1" + "php": "^8.1", + "psalm/phar": "5.7.6" }, "config": { "preferred-install": "dist" From 37533bb75e6fa9bdd59be7e2a94ab7882f98e7ce Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 6 Mar 2023 11:27:51 +0000 Subject: [PATCH 004/117] Support PHPUnit 10 --- phpunit.xml.dist | 38 ++++++------------- tests/Api/ProjectsTest.php | 2 +- tests/Api/RepositoriesTest.php | 2 +- tests/Api/TagsTest.php | 2 +- tests/Api/TestCase.php | 4 +- tests/Api/UsersTest.php | 2 +- .../Util/QueryStringBuilderTest.php | 3 +- vendor-bin/phpunit/composer.json | 2 +- 8 files changed, 20 insertions(+), 35 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1ba23a0a..4ac266fb 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,29 +1,13 @@ - - - - ./tests - - - - - ./src - - + + + + ./tests + + + + + ./src + + diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 7fd019bf..3599bb00 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -2082,7 +2082,7 @@ protected function getMultipleProjectsDataWithNamespace() ]; } - public function possibleAccessLevels() + public static function possibleAccessLevels(): array { return [ [10], diff --git a/tests/Api/RepositoriesTest.php b/tests/Api/RepositoriesTest.php index 54cf1c5e..bb3075e2 100644 --- a/tests/Api/RepositoriesTest.php +++ b/tests/Api/RepositoriesTest.php @@ -380,7 +380,7 @@ public function shouldGetCommitRefsWithParams(string $type, array $expectedArray $this->assertEquals($expectedArray, $api->commitRefs(1, 'abcd1234', ['type' => $type])); } - public function dataGetCommitRefsWithParams() + public static function dataGetCommitRefsWithParams(): array { return [ 'type_tag' => [ diff --git a/tests/Api/TagsTest.php b/tests/Api/TagsTest.php index 25946aeb..a13730d4 100644 --- a/tests/Api/TagsTest.php +++ b/tests/Api/TagsTest.php @@ -140,7 +140,7 @@ public function shouldUpdateRelease(string $releaseName, string $description, ar $this->assertEquals($expectedResult, $api->updateRelease(1, $releaseName, $params)); } - public function releaseDataProvider() + public static function releaseDataProvider(): array { return [ [ diff --git a/tests/Api/TestCase.php b/tests/Api/TestCase.php index 59bc8fb2..7234af3c 100644 --- a/tests/Api/TestCase.php +++ b/tests/Api/TestCase.php @@ -33,7 +33,7 @@ abstract protected function getApiClass(); protected function getApiMock(array $methods = []) { $httpClient = $this->getMockBuilder(ClientInterface::class) - ->setMethods(['sendRequest']) + ->onlyMethods(['sendRequest']) ->getMock(); $httpClient ->expects($this->any()) @@ -42,7 +42,7 @@ protected function getApiMock(array $methods = []) $client = Client::createWithHttpClient($httpClient); return $this->getMockBuilder($this->getApiClass()) - ->setMethods(\array_merge(['getAsResponse', 'get', 'post', 'postRaw', 'patch', 'delete', 'put', 'head'], $methods)) + ->onlyMethods(\array_merge(['getAsResponse', 'get', 'post', 'delete', 'put'], $methods)) ->setConstructorArgs([$client, null]) ->getMock(); } diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index 04f3e1d6..18635737 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -259,7 +259,7 @@ public function shouldGetOwnedUsersProjects(): void $this->assertEquals($expectedArray, $api->usersProjects(1, ['owned' => true])); } - public function possibleAccessLevels() + public static function possibleAccessLevels(): array { return [ [10], diff --git a/tests/HttpClient/Util/QueryStringBuilderTest.php b/tests/HttpClient/Util/QueryStringBuilderTest.php index df3326ee..ddcc5cb0 100644 --- a/tests/HttpClient/Util/QueryStringBuilderTest.php +++ b/tests/HttpClient/Util/QueryStringBuilderTest.php @@ -14,6 +14,7 @@ namespace Gitlab\Tests\HttpClient\Util; +use Generator; use Gitlab\HttpClient\Util\QueryStringBuilder; use PHPUnit\Framework\TestCase; @@ -30,7 +31,7 @@ public function testBuild(array $query, string $expected): void $this->assertSame(\sprintf('?%s', $expected), QueryStringBuilder::build($query)); } - public function queryStringProvider() + public static function queryStringProvider(): Generator { yield 'indexed array' => [ [ diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index c8a184d5..59819b44 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -1,7 +1,7 @@ { "require": { "php": "^7.4.15 || ^8.0.2", - "phpunit/phpunit": "^9.5.12" + "phpunit/phpunit": "^9.6.3 || ^10.0.12" }, "config": { "preferred-install": "dist" From 585bce1f71d20bb27d87dde96af16682c717140c Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 6 Mar 2023 11:28:00 +0000 Subject: [PATCH 005/117] Added PHP 8.2 support --- .github/workflows/tests.yml | 2 +- CHANGELOG.md | 4 ++++ README.md | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8250f3b5..e1bed421 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - php: ['7.4', '8.0', '8.1'] + php: ['7.4', '8.0', '8.1', '8.2'] steps: - name: Checkout Code diff --git a/CHANGELOG.md b/CHANGELOG.md index 57f9a1a5..e20343c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.9.0] - 2023-03-XX + +* Add PHP 8.2 support + ## [11.8.0] - 2022-04-24 * Add support for `reviewer_id` and `wip` params in `MergeRequests::all()` diff --git a/README.md b/README.md index 66ee3eba..1f6af1c2 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Check out the [change log](CHANGELOG.md), [releases](https://github.com/GitLabPH ## Installation -This version supports [PHP](https://php.net) 7.4-8.1. To get started, simply require the project using [Composer](https://getcomposer.org). You will also need to install packages that "provide" [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) and [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation). +This version supports [PHP](https://php.net) 7.4-8.2. To get started, simply require the project using [Composer](https://getcomposer.org). You will also need to install packages that "provide" [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) and [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation). ### Standard Installation From 76ba6d9920922d4f8e700e4a35daf27a1d28a4d5 Mon Sep 17 00:00:00 2001 From: Tom Janssen Date: Mon, 6 Mar 2023 12:31:45 +0100 Subject: [PATCH 006/117] [11.9] Deploy Tokens (#701) Co-authored-by: Graham Campbell --- src/Api/Groups.php | 71 ++++++++++++++++++ src/Api/Projects.php | 71 ++++++++++++++++++ tests/Api/GroupsTest.php | 149 +++++++++++++++++++++++++++++++++++++ tests/Api/ProjectsTest.php | 148 ++++++++++++++++++++++++++++++++++++ 4 files changed, 439 insertions(+) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 798871de..6f4b68f7 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -729,4 +729,75 @@ private function getSubgroupSearchResolver() return $resolver; } + + /** + * @param int|string $group_id + * @param bool|null $active + * + * @return mixed + */ + public function deployTokens($group_id, bool $active = null) + { + return $this->get('groups/'.self::encodePath($group_id).'/deploy_tokens', (null !== $active) ? ['active' => $active] : []); + } + + /** + * @param int|string $group_id + * @param array $parameters { + * + * @var string $name the name of the deploy token + * @var \DateTimeInterface $expires_at expiration date for the deploy token, does not expire if no value is provided + * @var string $username the username for the deploy token + * @var array $scopes the scopes, one or many of: read_repository, read_registry, write_registry, read_package_registry, write_package_registry + * } + * + * @return mixed + */ + public function createDeployToken($group_id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { + return $value->format('c'); + }; + + $resolver->define('name') + ->required() + ; + + $resolver->define('scopes') + ->required() + ->allowedTypes('array') + ->allowedValues(function ($scopes) { + $allowed = ['read_repository', 'read_registry', 'write_registry', 'read_package_registry', 'write_package_registry']; + foreach ($scopes as $scope) { + if (!\in_array($scope, $allowed, true)) { + return false; + } + } + + return true; + }) + ; + $resolver->setDefined('username') + ->setAllowedTypes('username', 'string') + ; + + $resolver->setDefined('expires_at') + ->setAllowedTypes('expires_at', \DateTimeInterface::class) + ->setNormalizer('expires_at', $datetimeNormalizer) + ; + + return $this->post('groups/'.self::encodePath($group_id).'/deploy_tokens', $resolver->resolve($parameters)); + } + + /** + * @param int|string $group_id + * @param int $token_id + * + * @return mixed + */ + public function deleteDeployToken($group_id, int $token_id) + { + return $this->delete('groups/'.self::encodePath($group_id).'/deploy_tokens/'.self::encodePath($token_id)); + } } diff --git a/src/Api/Projects.php b/src/Api/Projects.php index ab2d4b77..0234f82e 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -783,6 +783,77 @@ public function enableDeployKey($project_id, int $key_id) return $this->post($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id).'/enable')); } + /** + * @param int|string $project_id + * @param bool|null $active + * + * @return mixed + */ + public function deployTokens($project_id, bool $active = null) + { + return $this->get($this->getProjectPath($project_id, 'deploy_tokens'), (null !== $active) ? ['active' => $active] : []); + } + + /** + * @param int|string $project_id + * @param array $parameters { + * + * @var string $name the name of the deploy token + * @var \DateTimeInterface $expires_at expiration date for the deploy token, does not expire if no value is provided + * @var string $username the username for the deploy token + * @var array $scopes the scopes, one or many of: read_repository, read_registry, write_registry, read_package_registry, write_package_registry + * } + * + * @return mixed + */ + public function createDeployToken($project_id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { + return $value->format('c'); + }; + + $resolver->define('name') + ->required() + ; + + $resolver->define('scopes') + ->required() + ->allowedTypes('array') + ->allowedValues(function ($scopes) { + $allowed = ['read_repository', 'read_registry', 'write_registry', 'read_package_registry', 'write_package_registry']; + foreach ($scopes as $scope) { + if (!\in_array($scope, $allowed, true)) { + return false; + } + } + + return true; + }) + ; + $resolver->setDefined('username') + ->setAllowedTypes('username', 'string') + ; + + $resolver->setDefined('expires_at') + ->setAllowedTypes('expires_at', \DateTimeInterface::class) + ->setNormalizer('expires_at', $datetimeNormalizer) + ; + + return $this->post($this->getProjectPath($project_id, 'deploy_tokens'), $resolver->resolve($parameters)); + } + + /** + * @param int|string $project_id + * @param int $token_id + * + * @return mixed + */ + public function deleteDeployToken($project_id, int $token_id) + { + return $this->delete($this->getProjectPath($project_id, 'deploy_tokens/'.self::encodePath($token_id))); + } + /** * @param int|string $project_id * @param array $parameters { diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index 59329d9d..6a5f552d 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -14,6 +14,7 @@ namespace Gitlab\Tests\Api; +use DateTime; use Gitlab\Api\Groups; class GroupsTest extends TestCase @@ -735,4 +736,152 @@ public function shouldGetGroupMergeRequests(): void $this->assertEquals($expectedArray, $api->mergeRequests(1, [])); } + + /** + * @test + */ + public function shouldGetDeployTokens(): void + { + $expectedArray = [ + [ + 'id' => 1, + 'name' => 'MyToken', + 'username' => 'gitlab+deploy-token-1', + 'expires_at' => '2020-02-14T00:00:00.000Z', + 'revoked' => false, + 'expired' => false, + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/deploy_tokens') + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->deployTokens(1)); + } + + /** + * @test + */ + public function shouldGetActiveDeployTokens(): void + { + $expectedArray = [ + [ + 'id' => 1, + 'name' => 'MyToken', + 'username' => 'gitlab+deploy-token-1', + 'expires_at' => '2020-02-14T00:00:00.000Z', + 'revoked' => false, + 'expired' => true, + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/deploy_tokens', ['active' => true]) + ->will($this->returnValue([])); + + $this->assertEquals([], $api->deployTokens(1, true)); + } + + /** + * @test + */ + public function shouldGetInactiveDeployTokens(): void + { + $expectedArray = [ + [ + 'id' => 1, + 'name' => 'MyToken', + 'username' => 'gitlab+deploy-token-1', + 'expires_at' => '2020-02-14T00:00:00.000Z', + 'revoked' => false, + 'expired' => true, + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/deploy_tokens', ['active' => false]) + ->will($this->returnValue([])); + + $this->assertEquals([], $api->deployTokens(1, false)); + } + + /** + * @test + */ + public function shouldCreateDeployToken(): void + { + $expectedArray = [ + 'id' => 1, + 'name' => 'My Deploy Token', + 'username' => 'custom-user', + 'token' => 'jMRvtPNxrn3crTAGukpZ', + 'expires_at' => '2021-01-01T00:00:00.000Z', + 'revoked' => false, + 'expired' => false, + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('post') + ->with( + 'groups/1/deploy_tokens', + [ + 'name' => 'My Deploy Token', + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + 'expires_at' => (new DateTime('2021-01-01'))->format('c'), + ] + ) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->createDeployToken(1, [ + 'name' => 'My Deploy Token', + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + 'expires_at' => new DateTime('2021-01-01'), + ])); + } + + /** + * @test + */ + public function shouldDeleteDeployToken(): void + { + $expectedBool = true; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('delete') + ->with('groups/1/deploy_tokens/2') + ->will($this->returnValue($expectedBool)); + + $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); + } } diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 3599bb00..278aa90d 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -1369,6 +1369,154 @@ public function shoudEnableDeployKey(): void $this->assertEquals($expectedBool, $api->enableDeployKey(1, 3)); } + /** + * @test + */ + public function shouldGetDeployTokens(): void + { + $expectedArray = [ + [ + 'id' => 1, + 'name' => 'MyToken', + 'username' => 'gitlab+deploy-token-1', + 'expires_at' => '2020-02-14T00:00:00.000Z', + 'revoked' => false, + 'expired' => false, + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/deploy_tokens') + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->deployTokens(1)); + } + + /** + * @test + */ + public function shouldGetActiveDeployTokens(): void + { + $expectedArray = [ + [ + 'id' => 1, + 'name' => 'MyToken', + 'username' => 'gitlab+deploy-token-1', + 'expires_at' => '2020-02-14T00:00:00.000Z', + 'revoked' => false, + 'expired' => true, + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/deploy_tokens', ['active' => true]) + ->will($this->returnValue([])); + + $this->assertEquals([], $api->deployTokens(1, true)); + } + + /** + * @test + */ + public function shouldGetInactiveDeployTokens(): void + { + $expectedArray = [ + [ + 'id' => 1, + 'name' => 'MyToken', + 'username' => 'gitlab+deploy-token-1', + 'expires_at' => '2020-02-14T00:00:00.000Z', + 'revoked' => false, + 'expired' => true, + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/deploy_tokens', ['active' => false]) + ->will($this->returnValue([])); + + $this->assertEquals([], $api->deployTokens(1, false)); + } + + /** + * @test + */ + public function shouldCreateDeployToken(): void + { + $expectedArray = [ + 'id' => 1, + 'name' => 'My Deploy Token', + 'username' => 'custom-user', + 'token' => 'jMRvtPNxrn3crTAGukpZ', + 'expires_at' => '2021-01-01T00:00:00.000Z', + 'revoked' => false, + 'expired' => false, + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('post') + ->with( + 'projects/1/deploy_tokens', + [ + 'name' => 'My Deploy Token', + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + 'expires_at' => (new DateTime('2021-01-01'))->format('c'), + ] + ) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->createDeployToken(1, [ + 'name' => 'My Deploy Token', + 'scopes' => [ + 'read_repository', + 'read_registry', + ], + 'expires_at' => new DateTime('2021-01-01'), + ])); + } + + /** + * @test + */ + public function shouldDeleteDeployToken(): void + { + $expectedBool = true; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('delete') + ->with('projects/1/deploy_tokens/2') + ->will($this->returnValue($expectedBool)); + + $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); + } + /** * @test */ From 617d7b4214a12d54a28fbc0f1f4d0f4f3ed16268 Mon Sep 17 00:00:00 2001 From: Christoph Rosse Date: Mon, 6 Mar 2023 12:33:12 +0100 Subject: [PATCH 007/117] [11.9] Add source parameter to pipelines API (#708) Co-authored-by: Christoph Rosse --- src/Api/Projects.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 0234f82e..125965f6 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -338,7 +338,8 @@ public function enableRunner(int $project_id, int $runner_id) * @var string $name the name of the user who triggered pipelines * @var string $username the username of the user who triggered pipelines * @var string $order_by order pipelines by id, status, ref, or user_id (default: id) - * @var string $order Sort pipelines in asc or desc order (default: desc). + * @var string $order sort pipelines in asc or desc order (default: desc) + * @var string $source The source of the pipeline * } * * @return mixed @@ -381,6 +382,24 @@ public function pipelines($project_id, array $parameters = []) $resolver->setDefined('sort') ->setAllowedValues('sort', ['asc', 'desc']) ; + $resolver->setDefined('source') + ->setAllowedValues('source', [ + 'push', + 'web', + 'trigger', + 'schedule', + 'api', + 'external', + 'pipeline', + 'chat', + 'webide', + 'merge_request_event', + 'external_pull_request_event', + 'parent_pipeline', + 'ondemand_dast_scan', + 'ondemand_dast_validation', + ] + ); return $this->get($this->getProjectPath($project_id, 'pipelines'), $resolver->resolve($parameters)); } From 60886765124f8ba198c41ea9747f726c088e7709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20DECOOL?= Date: Mon, 6 Mar 2023 12:34:08 +0100 Subject: [PATCH 008/117] [11.9] Add support for `Projects::pipelineTestReport` & `Projects::pipelineTestReportSummary` (#709) * Add support for `Projects::pipelineTestReport` * Add support for `Projects::pipelineTestReportSummary` --- src/Api/Projects.php | 22 +++++++++++++++++ tests/Api/ProjectsTest.php | 48 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 125965f6..19d432fe 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -437,6 +437,28 @@ public function pipelineVariables($project_id, int $pipeline_id) return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/variables')); } + /** + * @param int|string $project_id + * @param int $pipeline_id + * + * @return mixed + */ + public function pipelineTestReport($project_id, int $pipeline_id) + { + return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report')); + } + + /** + * @param int|string $project_id + * @param int $pipeline_id + * + * @return mixed + */ + public function pipelineTestReportSummary($project_id, int $pipeline_id) + { + return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report_summary')); + } + /** * @param int|string $project_id * @param string $commit_ref diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 278aa90d..9abb2c60 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -847,6 +847,54 @@ public function shouldGetPipelineVariables(): void $this->assertEquals($expectedArray, $api->pipelineVariables(1, 3)); } + /** + * @test + */ + public function shouldGetPipelineTestReport(): void + { + $expectedArray = [ + 'total_time' => 0.011809, + 'total_count' => 8, + 'success_count' => 8, + 'failed_count' => 0, + 'skipped_count' => 0, + 'error_count' => 0, + 'test_suites' => [], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/pipelines/3/test_report') + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->pipelineTestReport(1, 3)); + } + + /** + * @test + */ + public function shouldGetPipelineTestReportSummary(): void + { + $expectedArray = [ + 'total_time' => 0.011809, + 'total_count' => 8, + 'success_count' => 8, + 'failed_count' => 0, + 'skipped_count' => 0, + 'error_count' => 0, + 'test_suites' => [], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/pipelines/3/test_report_summary') + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->pipelineTestReportSummary(1, 3)); + } + /** * @test */ From dbc36b5a7c13337b046f2e8e85511fffbbca2097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20DECOOL?= Date: Mon, 6 Mar 2023 12:36:01 +0100 Subject: [PATCH 009/117] [11.9] Allow `update_at` order by in `Projects::pipelines` (#710) Co-authored-by: Graham Campbell --- src/Api/Projects.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 19d432fe..f0a0cfca 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -337,9 +337,9 @@ public function enableRunner(int $project_id, int $runner_id) * @var bool $yaml_errors returns pipelines with invalid configurations * @var string $name the name of the user who triggered pipelines * @var string $username the username of the user who triggered pipelines - * @var string $order_by order pipelines by id, status, ref, or user_id (default: id) + * @var string $order_by order pipelines by id, status, ref, updated_at, or user_id (default: id) * @var string $order sort pipelines in asc or desc order (default: desc) - * @var string $source The source of the pipeline + * @var string $source the source of the pipeline * } * * @return mixed @@ -377,7 +377,7 @@ public function pipelines($project_id, array $parameters = []) ->setNormalizer('updated_before', $datetimeNormalizer) ; $resolver->setDefined('order_by') - ->setAllowedValues('order_by', ['id', 'status', 'ref', 'user_id']) + ->setAllowedValues('order_by', ['id', 'status', 'ref', 'updated_at', 'user_id']) ; $resolver->setDefined('sort') ->setAllowedValues('sort', ['asc', 'desc']) From 64eddd53f482e7e9123b5138ccefd6a1116b39fc Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 6 Mar 2023 05:37:02 -0600 Subject: [PATCH 010/117] [11.9] Feature/groups issues (#714) --- src/Api/Groups.php | 144 +++++++++++++++++++++++++++++++++++++ src/Api/Issues.php | 13 +++- src/Api/Projects.php | 31 ++++++++ tests/Api/GroupsTest.php | 53 ++++++++++++++ tests/Api/IssuesTest.php | 8 +-- tests/Api/ProjectsTest.php | 32 +++++++++ 6 files changed, 276 insertions(+), 5 deletions(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 6f4b68f7..7f139722 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -378,6 +378,119 @@ public function subgroups($group_id, array $parameters = []) return $this->get('groups/'.self::encodePath($group_id).'/subgroups', $resolver->resolve($parameters)); } + /** + * @param int|string $group_id + * @param array $parameters { + * + * @var string $assignee_id Return issues assigned to the given user id. Mutually exclusive with assignee_username. + * None returns unassigned issues. Any returns issues with an assignee. + * @var string $assignee_username Return issues assigned to the given username. Similar to assignee_id and mutually exclusive with assignee_id. + * In GitLab CE, the assignee_username array should only contain a single value. Otherwise, an invalid parameter error is returned. + * @var int $author_id Return issues created by the given user id. Mutually exclusive with author_username. + * Combine with scope=all or scope=assigned_to_me. + * @var string $author_username Return issues created by the given username. Similar to author_id and mutually exclusive with author_id. + * @var bool $confidential Filter confidential or public issues + * @var \DateTimeInterface $created_after Return issues created after the given time (inclusive) + * @var \DateTimeInterface $created_before Return issues created before the given time (inclusive) + * @var int $iteration_id Return issues assigned to the given iteration ID. None returns issues that do not belong to an iteration. Any returns issues that belong to an iteration. Mutually exclusive with iteration_title. + * @var string $iteration_title Return issues assigned to the iteration with the given title. Similar to iteration_id and mutually exclusive with iteration_id. + * @var string $labels Comma-separated list of label names, issues must have all labels to be returned. None lists all issues with no labels. Any lists all issues with at least one label. No+Label (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. + * @var string $milestone The milestone title. None lists all issues with no milestone. Any lists all issues that have an assigned milestone. + * @var string $my_reaction_emoji Return issues reacted by the authenticated user by the given emoji. None returns issues not given a reaction. Any returns issues given at least one reaction. + * @var bool $non_archived Return issues from non archived projects. Default is true. + * @var string $not Return issues that do not match the parameters supplied. Accepts: labels, milestone, author_id, author_username, assignee_id, assignee_username, my_reaction_emoji, search, in + * @var string $order_by Return issues ordered by created_at, updated_at, priority, due_date, relative_position, label_priority, milestone_due, popularity, weight fields. Default is created_at + * @var string $scope Return issues for the given scope: created_by_me, assigned_to_me or all. Defaults to all. + * @var string $search Search group issues against their title and description + * @var string $sort Return issues sorted in asc or desc order. Default is desc + * @var string $state Return all issues or just those that are opened or closed + * @var \DateTimeInterface $updated_after Return issues updated on or after the given time. Expected in ISO 8601 format (2019-03-15T08:00:00Z) + * @var \DateTimeInterface $updated_before Return issues updated on or before the given time. Expected in ISO 8601 format (2019-03-15T08:00:00Z) + * @var int $weight Return issues with the specified weight. None returns issues with no weight assigned. Any returns issues with a weight assigned. + * @var bool $with_labels_details If true, the response returns more details for each label in labels field: :name, :color, :description, :description_html, :text_color. Default is false. + * } + * + * @return mixed + */ + public function issues($group_id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { + return $value->format('c'); + }; + + $resolver->setDefined('assignee_id'); + $resolver->setDefined('assignee_username') + ->setAllowedTypes('assignee_username', 'string'); + + $resolver->setDefined('author_id'); + $resolver->setDefined('author_username') + ->setAllowedTypes('author_username', 'string'); + + $resolver->setDefined('confidential') + ->setAllowedTypes('confidential', 'bool') + ->setNormalizer('confidential', $booleanNormalizer); + + $resolver->setDefined('created_after') + ->setAllowedTypes('created_after', \DateTimeInterface::class) + ->setNormalizer('created_after', $datetimeNormalizer); + $resolver->setDefined('created_before') + ->setAllowedTypes('created_before', \DateTimeInterface::class) + ->setNormalizer('created_before', $datetimeNormalizer); + + $resolver->setDefined('updated_after') + ->setAllowedTypes('updated_after', \DateTimeInterface::class) + ->setNormalizer('updated_after', $datetimeNormalizer); + $resolver->setDefined('updated_before') + ->setAllowedTypes('updated_before', \DateTimeInterface::class) + ->setNormalizer('updated_before', $datetimeNormalizer); + + $resolver->setDefined('iteration_id'); + $resolver->setDefined('iteration_title') + ->setAllowedTypes('iteration_title', 'string'); + + $resolver->setDefined('labels') + ->setAllowedTypes('labels', 'string'); + + $resolver->setDefined('milestone') + ->setAllowedTypes('milestone', 'string'); + + $resolver->setDefined('my_reaction_emoji') + ->setAllowedTypes('my_reaction_emoji', 'string'); + + $resolver->setDefined('non_archived') + ->setAllowedTypes('non_archived', 'bool') + ->setNormalizer('non_archived', $booleanNormalizer); + + $resolver->setDefined('not') + ->setAllowedTypes('not', 'string'); + + $resolver->setDefined('order_by') + ->setAllowedValues('order_by', ['created_at', 'updated_at']); + $resolver->setDefined('sort') + ->setAllowedValues('sort', ['asc', 'desc']); + + $resolver->setDefined('scope') + ->setAllowedTypes('scope', 'string'); + + $resolver->setDefined('search') + ->setAllowedTypes('search', 'string'); + + $resolver->setDefined('state') + ->setAllowedValues('state', [self::STATE_ALL, self::STATE_OPENED, self::STATE_CLOSED]); + + $resolver->setDefined('weight'); + + $resolver->setDefined('with_labels_details') + ->setAllowedTypes('with_labels_details', 'bool') + ->setNormalizer('with_labels_details', $booleanNormalizer); + + return $this->get('groups/'.self::encodePath($group_id).'/issues', $resolver->resolve($parameters)); + } + /** * @param int|string $group_id * @param array $parameters @@ -618,6 +731,37 @@ public function mergeRequests($group_id, array $parameters = []) return $this->get('groups/'.self::encodePath($group_id).'/merge_requests', $resolver->resolve($parameters)); } + /** + * @param int|string $group_id + * @param array $parameters { + * + * @var string $state Return opened, upcoming, current (previously started), closed, or all iterations. + * Filtering by started state is deprecated starting with 14.1, please use current instead. + * @var string $search return only iterations with a title matching the provided string + * @var bool $include_ancestors Include iterations from parent group and its ancestors. Defaults to true. + * } + * + * @return mixed + */ + public function iterations($group_id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + + $resolver->setDefined('state') + ->setAllowedValues('state', ['opened', 'upcoming', 'current', 'current (previously started)', 'closed', 'all']) + ; + $resolver->setDefined('include_ancestors') + ->setAllowedTypes('include_ancestors', 'bool') + ->setNormalizer('include_ancestors', $booleanNormalizer) + ->setDefault('include_ancestors', true) + ; + + return $this->get('groups/'.self::encodePath($group_id).'/iterations', $resolver->resolve($parameters)); + } + /** * @param int|string $group_id * @param array $parameters { diff --git a/src/Api/Issues.php b/src/Api/Issues.php index cd099bea..360e8b51 100644 --- a/src/Api/Issues.php +++ b/src/Api/Issues.php @@ -41,8 +41,11 @@ class Issues extends AbstractApi * @var int[] $iids return only the issues having the given iid * @var string $order_by return requests ordered by created_at or updated_at fields (default is created_at) * @var string $sort return requests sorted in asc or desc order (default is desc) - * @var bool $confidential filter confidential or public issues + * @var bool $confidential filter confidential or public issues * @var string $search search issues against their title and description + * @var int $assignee_id return issues assigned to the specified user id + * @var int $iteration_id return issues assigned to the specified iteration id + * @var string $iteration_title return issues assigned to the specified iteration title * } * * @return mixed @@ -465,6 +468,8 @@ protected function createOptionsResolver(): OptionsResolver ; $resolver->setDefined('labels'); $resolver->setDefined('milestone'); + $resolver->setDefined('milestone_id') + ->setAllowedTypes('milestone_id', 'integer'); $resolver->setDefined('with_labels_details') ->setAllowedTypes('with_labels_details', 'bool') ->setNormalizer('with_labels_details', $booleanNormalizer) @@ -495,6 +500,12 @@ protected function createOptionsResolver(): OptionsResolver $resolver->setDefined('assignee_id') ->setAllowedTypes('assignee_id', 'integer') ; + $resolver->setDefined('iteration_id') + ->setAllowedTypes('iteration_id', 'integer') + ; + $resolver->setDefined('iteration_title') + ->setAllowedTypes('iteration_title', 'string') + ; $resolver->setDefined('weight') ->setAllowedTypes('weight', 'integer') ; diff --git a/src/Api/Projects.php b/src/Api/Projects.php index f0a0cfca..691752a4 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -693,6 +693,37 @@ public function boards($project_id) return $this->get($this->getProjectPath($project_id, 'boards')); } + /** + * @param int|string $project_id + * @param array $parameters { + * + * @var string $state Return opened, upcoming, current (previously started), closed, or all iterations. + * Filtering by started state is deprecated starting with 14.1, please use current instead. + * @var string $search return only iterations with a title matching the provided string + * @var bool $include_ancestors Include iterations from parent group and its ancestors. Defaults to true. + * } + * + * @return mixed + */ + public function iterations($project_id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + + $resolver->setDefined('state') + ->setAllowedValues('state', ['opened', 'upcoming', 'current', 'current (previously started)', 'closed', 'all']) + ; + $resolver->setDefined('include_ancestors') + ->setAllowedTypes('include_ancestors', 'bool') + ->setNormalizer('include_ancestors', $booleanNormalizer) + ->setDefault('include_ancestors', true) + ; + + return $this->get('projects/'.self::encodePath($project_id).'/iterations', $resolver->resolve($parameters)); + } + /** * Gets a list of all discussion items for a single commit. * diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index 6a5f552d..8cee4946 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -365,6 +365,27 @@ public function shouldGetAllSubgroups(): void $this->assertEquals($expectedArray, $api->subgroups(1, ['page' => 1, 'per_page' => 10])); } + /** + * @test + */ + public function shouldGetAllIssues(): void + { + $expectedArray = [ + ['id' => 101, 'name' => 'An issue'], + ['id' => 102, 'name' => 'Another issue'], + ['id' => 103, 'name' => 'A third issue'], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/issues', ['page' => 1, 'per_page' => 10]) + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->issues(1, ['page' => 1, 'per_page' => 10])); + } + /** * @test */ @@ -677,6 +698,38 @@ public function shouldGetAllGroupProjectsIncludingCustomAttributes(): void $this->assertEquals($expectedArray, $api->projects(1, ['with_custom_attributes' => true])); } + /** + * @test + */ + public function shouldGetIterations(): void + { + $expectedArray = [ + [ + 'id' => 5, + 'iid' => 2, + 'sequence' => 1, + 'group_id' => 123, + 'title' => '2022: Sprint 1', + 'description' => '', + 'state' => 3, + 'created_at' => '2021-09-29T21:24:43.913Z', + 'updated_at' => '2022-03-29T19:09:08.368Z', + 'start_date' => '2022-01-10', + 'due_date' => '2022-01-23', + 'web_url' => 'https://example.com/groups/example/-/iterations/34', + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/iterations') + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->iterations(1)); + } + /** * @test */ diff --git a/tests/Api/IssuesTest.php b/tests/Api/IssuesTest.php index c62e198f..7c62ffd9 100644 --- a/tests/Api/IssuesTest.php +++ b/tests/Api/IssuesTest.php @@ -91,11 +91,11 @@ public function shouldGetGroupIssuesWithParams(): void $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('groups/1/issues', ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened']) + ->with('groups/1/issues', ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_title' => 'Title', 'assignee_id' => 1]) ->will($this->returnValue($expectedArray)) ; - $this->assertEquals($expectedArray, $api->group(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened'])); + $this->assertEquals($expectedArray, $api->group(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_title' => 'Title', 'assignee_id' => 1])); } /** @@ -131,11 +131,11 @@ public function shouldGetProjectIssuesWithParams(): void $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('projects/1/issues', ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened']) + ->with('projects/1/issues', ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_id' => 1, 'assignee_id' => 2]) ->will($this->returnValue($expectedArray)) ; - $this->assertEquals($expectedArray, $api->all(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened'])); + $this->assertEquals($expectedArray, $api->all(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_id' => 1, 'assignee_id' => 2])); } /** diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 9abb2c60..8962d051 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -673,6 +673,38 @@ public function getProjectBoardsExpectedArray() ]; } + /** + * @test + */ + public function shouldGetIterations(): void + { + $expectedArray = [ + [ + 'id' => 5, + 'iid' => 2, + 'sequence' => 1, + 'group_id' => 123, + 'title' => '2022: Sprint 1', + 'description' => '', + 'state' => 3, + 'created_at' => '2021-09-29T21:24:43.913Z', + 'updated_at' => '2022-03-29T19:09:08.368Z', + 'start_date' => '2022-01-10', + 'due_date' => '2022-01-23', + 'web_url' => 'https://example.com/groups/example/-/iterations/34', + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/iterations') + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->iterations(1)); + } + /** * @test */ From 89ffa5473d53f4d2a0f2ee11b2128ab5c2dc8d8c Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 6 Mar 2023 11:40:04 +0000 Subject: [PATCH 011/117] Update CHANGELOG.md --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e20343c2..16cf9d4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.9.0] - 2023-03-XX * Add PHP 8.2 support +* Add support for group and project deploy tokens +* Add source parameter to pipelines API +* Add support for `Groups::issues` +* Add support for `Groups::iterations` +* Add support for `Projects::iterations` +* Add support for `Projects::pipelineTestReport` +* Add support for `Projects::pipelineTestReportSummary` +* Added support for `update_at` order by in `Projects::pipelines` +* Added additional parameters to `Issues::all` +* Added additional parameters to `Issues::group` ## [11.8.0] - 2022-04-24 From 35000ed7f781bd627ff92025b6b5c244117181f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Costa=20Silva?= <1574795+joaocsilva@users.noreply.github.com> Date: Mon, 6 Mar 2023 12:42:29 +0100 Subject: [PATCH 012/117] [11.9] Add support for `allowed_to_create` in `Projects::addProtectedTag` (#736) --- src/Api/Projects.php | 13 +++++++++++++ tests/Api/ProjectsTest.php | 16 +++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 691752a4..fe88c0b0 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1545,6 +1545,19 @@ public function addProtectedTag($project_id, array $parameters = []) ->setAllowedTypes('create_access_level', 'int') ->setAllowedValues('create_access_level', [0, 30, 40]) ; + $resolver->setDefined('allowed_to_create') + ->setAllowedTypes('allowed_to_create', 'array') + ->setAllowedValues('allowed_to_create', function (array $value) { + $keys = \array_keys((array) \call_user_func_array('array_merge', $value)); + $diff = \array_diff($keys, ['user_id', 'group_id', 'access_level']); + $values = \array_map(function ($item) { + return \array_values($item)[0] ?? ''; + }, $value); + $integer = \count($values) === \count(\array_filter($values, 'is_int')); + + return \count($value) > 0 && 0 === \count($diff) && $integer; + }) + ; return $this->post($this->getProjectPath($project_id, 'protected_tags'), $resolver->resolve($parameters)); } diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 8962d051..27f279bf 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -2766,19 +2766,21 @@ public function shouldAddProtectedTag(): void $expectedArray = [ 'name' => 'release-*', 'create_access_level' => [ - 'access_level' => 40, - 'access_level_description' => 'Maintainers', + ['access_level' => 40, 'access_level_description' => 'Maintainers'], + ['group_id' => 123], ], ]; $api = $this->getApiMock(); + $params = [ + 'name' => 'release-*', + 'create_access_level' => 40, + 'allowed_to_create' => [['group_id' => 123]], + ]; $api->expects($this->once()) ->method('post') - ->with( - 'projects/1/protected_tags', - ['name' => 'release-*', 'create_access_level' => 40] - ) + ->with('projects/1/protected_tags', $params) ->will($this->returnValue($expectedArray)); - $this->assertEquals($expectedArray, $api->addProtectedTag(1, ['name' => 'release-*', 'create_access_level' => 40])); + $this->assertEquals($expectedArray, $api->addProtectedTag(1, $params)); } /** From e1f74cc1a67ccba8bae3de800d3cec21653ab5a7 Mon Sep 17 00:00:00 2001 From: Wim Reckman Date: Mon, 6 Mar 2023 12:44:29 +0100 Subject: [PATCH 013/117] [11.9] Add support for user starred projects (#735) Co-authored-by: Wim Reckman --- src/Api/Users.php | 82 +++++++++++++++++++++++++++++++++++++ tests/Api/UsersTest.php | 91 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 173 insertions(+) diff --git a/src/Api/Users.php b/src/Api/Users.php index a1cbff80..0c53298e 100644 --- a/src/Api/Users.php +++ b/src/Api/Users.php @@ -174,6 +174,88 @@ public function usersProjects(int $id, array $parameters = []) return $this->get('users/'.self::encodePath($id).'/projects', $resolver->resolve($parameters)); } + /** + * @param int $id + * @param array $parameters { + * + * @var bool $archived limit by archived status + * @var string $visibility limit by visibility public, internal, or private + * @var string $order_by Return projects ordered by id, name, path, created_at, updated_at, + * or last_activity_at fields (default is created_at) + * @var string $sort Return projects sorted in asc or desc order (default is desc) + * @var string $search return list of projects matching the search criteria + * @var bool $simple return only the ID, URL, name, and path of each project + * @var bool $owned limit by projects owned by the current user + * @var bool $membership limit by projects that the current user is a member of + * @var bool $starred limit by projects starred by the current user + * @var bool $statistics include project statistics + * @var bool $with_issues_enabled limit by enabled issues feature + * @var bool $with_merge_requests_enabled limit by enabled merge requests feature + * @var int $min_access_level Limit by current user minimal access level + * @var bool $with_custom_attributes Include custom attributes in response (administrator only) + * } + * + * @return mixed + */ + public function usersStarredProjects(int $id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + $resolver->setDefined('archived') + ->setAllowedTypes('archived', 'bool') + ->setNormalizer('archived', $booleanNormalizer) + ; + $resolver->setDefined('visibility') + ->setAllowedValues('visibility', ['public', 'internal', 'private']) + ; + $resolver->setDefined('order_by') + ->setAllowedValues('order_by', ['id', 'name', 'path', 'created_at', 'updated_at', 'last_activity_at']) + ; + $resolver->setDefined('sort') + ->setAllowedValues('sort', ['asc', 'desc']) + ; + $resolver->setDefined('search'); + $resolver->setDefined('simple') + ->setAllowedTypes('simple', 'bool') + ->setNormalizer('simple', $booleanNormalizer) + ; + $resolver->setDefined('owned') + ->setAllowedTypes('owned', 'bool') + ->setNormalizer('owned', $booleanNormalizer) + ; + $resolver->setDefined('membership') + ->setAllowedTypes('membership', 'bool') + ->setNormalizer('membership', $booleanNormalizer) + ; + $resolver->setDefined('starred') + ->setAllowedTypes('starred', 'bool') + ->setNormalizer('starred', $booleanNormalizer) + ; + $resolver->setDefined('statistics') + ->setAllowedTypes('statistics', 'bool') + ->setNormalizer('statistics', $booleanNormalizer) + ; + $resolver->setDefined('with_issues_enabled') + ->setAllowedTypes('with_issues_enabled', 'bool') + ->setNormalizer('with_issues_enabled', $booleanNormalizer) + ; + $resolver->setDefined('with_merge_requests_enabled') + ->setAllowedTypes('with_merge_requests_enabled', 'bool') + ->setNormalizer('with_merge_requests_enabled', $booleanNormalizer) + ; + $resolver->setDefined('min_access_level') + ->setAllowedValues('min_access_level', [null, 10, 20, 30, 40, 50]) + ; + $resolver->setDefined('with_custom_attributes') + ->setAllowedTypes('with_custom_attributes', 'bool') + ->setNormalizer('with_custom_attributes', $booleanNormalizer) + ; + + return $this->get('users/'.self::encodePath($id).'/starred_projects', $resolver->resolve($parameters)); + } + /** * @return mixed */ diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index 18635737..2839c0c9 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -294,6 +294,97 @@ public function shouldSearchUsersProjects(): void $this->assertEquals($expectedArray, $api->usersProjects(1, ['search' => 'a project'])); } + /** + * @test + */ + public function shouldShowUsersStarredProjects(): void + { + $expectedArray = $this->getUsersProjectsData(); + + $api = $this->getUsersProjectsRequestMock('users/1/starred_projects', $expectedArray); + + $this->assertEquals($expectedArray, $api->usersStarredProjects(1)); + } + + /** + * @test + */ + public function shouldShowUsersStarredProjectsWithLimit(): void + { + $expectedArray = [$this->getUsersProjectsData()[0]]; + + $api = $this->getUsersProjectsRequestMock('users/1/starred_projects', $expectedArray, ['per_page' => 1]); + + $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['per_page' => 1])); + } + + /** + * @test + */ + public function shouldGetAllUsersStarredProjectsSortedByName(): void + { + $expectedArray = $this->getUsersProjectsData(); + + $api = $this->getUsersProjectsRequestMock( + 'users/1/starred_projects', + $expectedArray, + ['page' => 1, 'per_page' => 5, 'order_by' => 'name', 'sort' => 'asc'] + ); + + $this->assertEquals( + $expectedArray, + $api->usersStarredProjects(1, ['page' => 1, 'per_page' => 5, 'order_by' => 'name', 'sort' => 'asc']) + ); + } + + /** + * @test + */ + public function shouldGetNotArchivedUsersStarredProjects(): void + { + $expectedArray = $this->getUsersProjectsData(); + + $api = $this->getUsersProjectsRequestMock('users/1/starred_projects', $expectedArray, ['archived' => 'false']); + + $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['archived' => false])); + } + + /** + * @test + */ + public function shouldGetOwnedUsersStarredProjects(): void + { + $expectedArray = $this->getUsersProjectsData(); + + $api = $this->getUsersProjectsRequestMock('users/1/starred_projects', $expectedArray, ['owned' => 'true']); + + $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['owned' => true])); + } + + /** + * @test + * @dataProvider possibleAccessLevels + */ + public function shouldGetStarredProjectsWithMinimumAccessLevel($level): void + { + $expectedArray = $this->getUsersProjectsData(); + + $api = $this->getUsersProjectsRequestMock('users/1/starred_projects', $expectedArray, ['min_access_level' => $level]); + + $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['min_access_level' => $level])); + } + + /** + * @test + */ + public function shouldSearchUsersStarredProjects(): void + { + $expectedArray = $this->getUsersProjectsData(); + + $api = $this->getUsersProjectsRequestMock('users/1/starred_projects', $expectedArray, ['search' => 'a project']); + $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['search' => 'a project'])); + } + /** * @test */ From 83ec71fb383f3bf714f7b0bdfd5af0f151b3de18 Mon Sep 17 00:00:00 2001 From: Niek Brekelmans Date: Mon, 6 Mar 2023 12:47:29 +0100 Subject: [PATCH 014/117] [11.9] Add support for `Projects::projectAccessToken` (#715) Co-authored-by: Niek Brekelmans --- src/Api/Projects.php | 11 +++++++++++ tests/Api/ProjectsTest.php | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index fe88c0b0..00210acb 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1451,6 +1451,17 @@ public function projectAccessTokens($project_id) return $this->get($this->getProjectPath($project_id, 'access_tokens')); } + /** + * @param int|string $project_id + * @param int|string $token_id + * + * @return mixed + */ + public function projectAccessToken($project_id, $token_id) + { + return $this->get($this->getProjectPath($project_id, 'access_tokens/'.self::encodePath($token_id))); + } + /** * @param int|string $project_id * @param array $parameters { diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 27f279bf..7e0584e1 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -2678,6 +2678,33 @@ public function shouldGetProjectAccessTokens(): void $this->assertEquals($expectedArray, $api->projectAccessTokens(1)); } + /** + * @test + */ + public function shouldGetProjectAccessToken(): void + { + $expectedArray = [ + 'user_id' => 141, + 'scopes' => [ + 'api', + ], + 'name' => 'token', + 'expires_at' => '2021-01-31', + 'id' => 42, + 'active' => true, + 'created_at' => '2021-01-20T22:11:48.151Z', + 'revoked' => false, + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/access_tokens/42') + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->projectAccessToken(1, 42)); + } + /** * @test */ From 9841383fca32d5446389e995643b7151c65e633d Mon Sep 17 00:00:00 2001 From: Don Kidd Date: Mon, 6 Mar 2023 06:52:06 -0500 Subject: [PATCH 015/117] [11.9] Add support for `Jobs::artifactByJobId` (#734) --- src/Api/Jobs.php | 12 ++++++++++++ tests/Api/JobsTest.php | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/Api/Jobs.php b/src/Api/Jobs.php index 9d122433..8dcf8692 100644 --- a/src/Api/Jobs.php +++ b/src/Api/Jobs.php @@ -169,6 +169,18 @@ public function artifactByRefName($project_id, string $ref_name, string $job_nam ])->getBody(); } + /** + * @param int|string $project_id + * @param int $job_id + * @param string $artifact_path + * + * @return StreamInterface + */ + public function artifactByJobId($project_id, $job_id, string $artifact_path) + { + return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/artifacts/'.self::encodePath($artifact_path))->getBody(); + } + /** * @param int|string $project_id * @param int $job_id diff --git a/tests/Api/JobsTest.php b/tests/Api/JobsTest.php index 840e8ba6..5d355b11 100644 --- a/tests/Api/JobsTest.php +++ b/tests/Api/JobsTest.php @@ -119,6 +119,23 @@ public function shouldGetArtifacts(): void $this->assertEquals('foobar', $api->artifacts(1, 3)->getContents()); } + /** + * @test + */ + public function shouldGetArtifactsByJobId(): void + { + $returnedStream = new Response(200, [], 'foobar'); + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('getAsResponse') + ->with('projects/1/jobs/3/artifacts/artifact_path') + ->will($this->returnValue($returnedStream)) + ; + + $this->assertEquals('foobar', $api->artifactByJobId(1, 3, 'artifact_path')->getContents()); + } + /** * @test */ From b08f2210420a6740fbe7ae6adb6011892fa3514e Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Mon, 6 Mar 2023 12:55:22 +0100 Subject: [PATCH 016/117] [11.9] Add ability to authenticate with a job token (#722) --- src/Client.php | 7 +++++++ src/HttpClient/Plugin/Authentication.php | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/Client.php b/src/Client.php index 74e77920..5e704f50 100644 --- a/src/Client.php +++ b/src/Client.php @@ -72,6 +72,13 @@ class Client */ public const AUTH_HTTP_TOKEN = 'http_token'; + /** + * The job token authentication method. + * + * @var string + */ + public const AUTH_HTTP_JOB_TOKEN = 'http_job_token'; + /** * The OAuth 2 token authentication method. * diff --git a/src/HttpClient/Plugin/Authentication.php b/src/HttpClient/Plugin/Authentication.php index 92fc8019..923c981f 100644 --- a/src/HttpClient/Plugin/Authentication.php +++ b/src/HttpClient/Plugin/Authentication.php @@ -84,6 +84,10 @@ private static function buildHeaders(string $method, string $token, string $sudo case Client::AUTH_HTTP_TOKEN: $headers['PRIVATE-TOKEN'] = $token; + break; + case Client::AUTH_HTTP_JOB_TOKEN: + $headers['JOB-TOKEN'] = $token; + break; case Client::AUTH_OAUTH_TOKEN: $headers['Authorization'] = \sprintf('Bearer %s', $token); From 1e3d00798a2f46b1b16650fa04782d377ce95d2a Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 6 Mar 2023 11:56:04 +0000 Subject: [PATCH 017/117] Update CHANGELOG.md --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16cf9d4a..18dddbcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,14 +10,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Add PHP 8.2 support * Add support for group and project deploy tokens * Add source parameter to pipelines API +* Add support for `Jobs::artifactByJobId` +* Add support for `Users::usersStarredProjects` * Add support for `Groups::issues` * Add support for `Groups::iterations` * Add support for `Projects::iterations` +* Add support for `Projects::projectAccessToken` * Add support for `Projects::pipelineTestReport` * Add support for `Projects::pipelineTestReportSummary` -* Added support for `update_at` order by in `Projects::pipelines` +* Add support for `allowed_to_create` in `Projects::addProtectedTag` +* Add support for `update_at` order by in `Projects::pipelines` * Added additional parameters to `Issues::all` * Added additional parameters to `Issues::group` +* Added the ability to authenticate with a job token ## [11.8.0] - 2022-04-24 From f788d197f5a7dfe89bbb74817d5e9c97599e7b26 Mon Sep 17 00:00:00 2001 From: Tom Janssen Date: Mon, 6 Mar 2023 13:04:04 +0100 Subject: [PATCH 018/117] [11.9] Add support for `access_level` in `Projects::createProjectAccessToken` (#731) --- src/Api/Projects.php | 6 ++++++ tests/Api/ProjectsTest.php | 1 + 2 files changed, 7 insertions(+) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 00210acb..f7d874ec 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1468,6 +1468,7 @@ public function projectAccessToken($project_id, $token_id) * * @var string $name the name of the project access token * @var array $scopes the scopes, one or many of: api, read_api, read_registry, write_registry, read_repository, write_repository + * @var int $access_level the access level: 10 (Guest), 20 (Reporter), 30 (Developer), 40 (Maintainer), 50 (Owner) * @var \DateTimeInterface $expires_at the token expires at midnight UTC on that date * } * @@ -1499,6 +1500,11 @@ public function createProjectAccessToken($project_id, array $parameters = []) }) ; + $resolver->setDefined('access_level') + ->setAllowedTypes('access_level', 'int') + ->setAllowedValues('access_level', [10, 20, 30, 40, 50]) + ; + $resolver->setDefined('expires_at') ->setAllowedTypes('expires_at', \DateTimeInterface::class) ->setNormalizer('expires_at', $datetimeNormalizer) diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 7e0584e1..3c3e072e 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -2735,6 +2735,7 @@ public function shouldCreateProjectAccessToken(): void 'api', 'read_repository', ], + 'access_level' => 30, 'expires_at' => '2021-01-31', ] ) From c41ba94f529588e6d69b4cc61c3cc58f24bfce4e Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 6 Mar 2023 12:08:35 +0000 Subject: [PATCH 019/117] Revert "[11.9] Add support for `access_level` in `Projects::createProjectAccessToken` (#731)" This reverts commit f788d197f5a7dfe89bbb74817d5e9c97599e7b26. --- src/Api/Projects.php | 6 ------ tests/Api/ProjectsTest.php | 1 - 2 files changed, 7 deletions(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index f7d874ec..00210acb 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1468,7 +1468,6 @@ public function projectAccessToken($project_id, $token_id) * * @var string $name the name of the project access token * @var array $scopes the scopes, one or many of: api, read_api, read_registry, write_registry, read_repository, write_repository - * @var int $access_level the access level: 10 (Guest), 20 (Reporter), 30 (Developer), 40 (Maintainer), 50 (Owner) * @var \DateTimeInterface $expires_at the token expires at midnight UTC on that date * } * @@ -1500,11 +1499,6 @@ public function createProjectAccessToken($project_id, array $parameters = []) }) ; - $resolver->setDefined('access_level') - ->setAllowedTypes('access_level', 'int') - ->setAllowedValues('access_level', [10, 20, 30, 40, 50]) - ; - $resolver->setDefined('expires_at') ->setAllowedTypes('expires_at', \DateTimeInterface::class) ->setNormalizer('expires_at', $datetimeNormalizer) diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 3c3e072e..7e0584e1 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -2735,7 +2735,6 @@ public function shouldCreateProjectAccessToken(): void 'api', 'read_repository', ], - 'access_level' => 30, 'expires_at' => '2021-01-31', ] ) From 61de71cd7538fb0688a0e6416f7d59602872b530 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 6 Mar 2023 12:09:10 +0000 Subject: [PATCH 020/117] Update psalm-baseline.xml --- psalm-baseline.xml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 33fdc838..ac9935de 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,14 +1,25 @@ - + - + + + + + + + + - - $clone->perPage + + perPage]]> - - $closure($api) - From 00d5d0fd16dfe9d16259d630f06c959451b0c6f2 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 6 Mar 2023 12:10:16 +0000 Subject: [PATCH 021/117] Release 11.9.0 --- CHANGELOG.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18dddbcb..3dc107bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [11.9.0] - 2023-03-XX +## [11.9.0] - 2023-03-06 * Add PHP 8.2 support * Add support for group and project deploy tokens diff --git a/README.md b/README.md index 1f6af1c2..9e41f721 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ We present a modern [GitLab API v4](https://docs.gitlab.com/ce/api/) client for ![Banner](https://user-images.githubusercontent.com/2829600/86969006-fc2e3b00-c164-11ea-80b7-8750160a65c4.png)

-Build Status +Build Status StyleCI Status Software License Packagist Downloads From 92bed613bdbff22f074cc47efbeb56a5a2726773 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Mon, 6 Mar 2023 23:57:31 +0100 Subject: [PATCH 022/117] [11.10] Add support for `Packages::addGenericFile()` (#721) --- src/Api/AbstractApi.php | 22 ++++++++++++++++++++++ src/Api/Packages.php | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index 5c81d6fd..0024f4b7 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -153,6 +153,28 @@ protected function put(string $uri, array $params = [], array $headers = [], arr return ResponseMediator::getContent($response); } + /** + * @param string $uri + * @param string $file + * @param array $headers + * @param array $uriParams + * + * @return mixed + */ + protected function putFile(string $uri, string $file, array $headers = [], array $uriParams = []) + { + $resource = self::tryFopen($file, 'r'); + $body = $this->client->getStreamFactory()->createStreamFromResource($resource); + + if ($body->isReadable()) { + $headers = \array_merge([ResponseMediator::CONTENT_TYPE_HEADER => self::guessFileContentType($file)], $headers); + } + + $response = $this->client->getHttpClient()->put(self::prepareUri($uri, $uriParams), $headers, $body); + + return ResponseMediator::getContent($response); + } + /** * @param string $uri * @param array $params diff --git a/src/Api/Packages.php b/src/Api/Packages.php index 0a386dc2..3e77c031 100644 --- a/src/Api/Packages.php +++ b/src/Api/Packages.php @@ -110,6 +110,28 @@ public function removeFile($project_id, int $package_id, int $package_file_id) ); } + /** + * @param int|string $project_id + * @param string $package_name + * @param string $package_version + * @param string $file + * @param string $status + * + * @return mixed + */ + public function addGenericFile($project_id, string $package_name, string $package_version, string $file, string $status = 'default') + { + return $this->putFile( + $this->getProjectPath( + $project_id, + 'packages/generic/'.self::encodePath($package_name).'/'.self::encodePath($package_version).'/'.self::encodePath(\basename($file)) + ), + $file, + [], + ['status' => $status] + ); + } + /** * @param int|string $project_id * @param int $package_id From 012a57602f32db2143b40f0dea32c6badfa38062 Mon Sep 17 00:00:00 2001 From: Tom Janssen Date: Tue, 7 Mar 2023 14:23:23 +0100 Subject: [PATCH 023/117] [11.10] Add support for `access_level` in `Projects::createProjectAccessToken` (#740) --- src/Api/Projects.php | 6 ++++++ tests/Api/ProjectsTest.php | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 00210acb..f7d874ec 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1468,6 +1468,7 @@ public function projectAccessToken($project_id, $token_id) * * @var string $name the name of the project access token * @var array $scopes the scopes, one or many of: api, read_api, read_registry, write_registry, read_repository, write_repository + * @var int $access_level the access level: 10 (Guest), 20 (Reporter), 30 (Developer), 40 (Maintainer), 50 (Owner) * @var \DateTimeInterface $expires_at the token expires at midnight UTC on that date * } * @@ -1499,6 +1500,11 @@ public function createProjectAccessToken($project_id, array $parameters = []) }) ; + $resolver->setDefined('access_level') + ->setAllowedTypes('access_level', 'int') + ->setAllowedValues('access_level', [10, 20, 30, 40, 50]) + ; + $resolver->setDefined('expires_at') ->setAllowedTypes('expires_at', \DateTimeInterface::class) ->setNormalizer('expires_at', $datetimeNormalizer) diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 7e0584e1..a3594a6d 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -2735,6 +2735,7 @@ public function shouldCreateProjectAccessToken(): void 'api', 'read_repository', ], + 'access_level' => 30, 'expires_at' => '2021-01-31', ] ) @@ -2746,6 +2747,7 @@ public function shouldCreateProjectAccessToken(): void 'api', 'read_repository', ], + 'access_level' => 30, 'expires_at' => new DateTime('2021-01-31'), ])); } From 3e78bf539af604140924469f8543caab63979db5 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Tue, 7 Mar 2023 13:24:08 +0000 Subject: [PATCH 024/117] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dc107bb..69239310 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.10.0] - UPCOMING + +* Add support for `Packages::addGenericFile()` +* Add support for `access_level` in `Projects::createProjectAccessToken` + ## [11.9.0] - 2023-03-06 * Add PHP 8.2 support From 3b50ce202f3ebaa364603a5e251c60701ff37154 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Thu, 9 Mar 2023 13:01:45 +0000 Subject: [PATCH 025/117] Bumped version --- src/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 5e704f50..40b09edf 100644 --- a/src/Client.php +++ b/src/Client.php @@ -98,7 +98,7 @@ class Client * * @var string */ - private const USER_AGENT = 'gitlab-php-api-client/11.9'; + private const USER_AGENT = 'gitlab-php-api-client/11.10'; /** * The HTTP client builder. From b6c83346f252ba2879e258b2ddd791208a8a730c Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Thu, 9 Mar 2023 13:02:17 +0000 Subject: [PATCH 026/117] Bumped version --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9e41f721..a2fc8e0b 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This version supports [PHP](https://php.net) 7.4-8.2. To get started, simply req ### Standard Installation ```bash -$ composer require "m4tthumphrey/php-gitlab-api:^11.9" \ +$ composer require "m4tthumphrey/php-gitlab-api:^11.10" \ "guzzlehttp/guzzle:^7.5" "http-interop/http-factory-guzzle:^1.2" ``` @@ -37,7 +37,7 @@ $ composer require "m4tthumphrey/php-gitlab-api:^11.9" \ #### Laravel: ```bash -$ composer require "graham-campbell/gitlab:^7.0" +$ composer require "graham-campbell/gitlab:^7.1" ``` #### Symfony: From 91f0ea1a866552119387e7b8d26711e0421d0969 Mon Sep 17 00:00:00 2001 From: Niclas Hoyer Date: Thu, 9 Mar 2023 14:03:53 +0100 Subject: [PATCH 027/117] [11.10] Add support milestone merge requests endpoint (#741) --- src/Api/Milestones.php | 11 +++++++++++ tests/Api/MilestonesTest.php | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/Api/Milestones.php b/src/Api/Milestones.php index 8aba4ab9..f7b18922 100644 --- a/src/Api/Milestones.php +++ b/src/Api/Milestones.php @@ -109,4 +109,15 @@ public function issues($project_id, int $milestone_id) { return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id).'/issues')); } + + /** + * @param int|string $project_id + * @param int $milestone_id + * + * @return mixed + */ + public function mergeRequests($project_id, int $milestone_id) + { + return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id).'/merge_requests')); + } } diff --git a/tests/Api/MilestonesTest.php b/tests/Api/MilestonesTest.php index 5bb14797..16f86a35 100644 --- a/tests/Api/MilestonesTest.php +++ b/tests/Api/MilestonesTest.php @@ -126,6 +126,26 @@ public function shouldGetMilestonesIssues(): void $this->assertEquals($expectedArray, $api->issues(1, 3)); } + /** + * @test + */ + public function shouldGetMilestonesMergeRequests(): void + { + $expectedArray = [ + ['id' => 1, 'title' => 'A merge request'], + ['id' => 2, 'title' => 'Another merge request'], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/milestones/3/merge_requests') + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->mergeRequests(1, 3)); + } + protected function getApiClass() { return Milestones::class; From 6fd6344aa1e71cd9c524106feeb5ce62ef2c8d3f Mon Sep 17 00:00:00 2001 From: Philipp Kolmann Date: Thu, 9 Mar 2023 14:06:16 +0100 Subject: [PATCH 028/117] [11.10] Add optional expires_at parameter to project members (#713) Co-authored-by: Philipp Kolmann --- src/Api/Projects.php | 36 ++++++++++++++++++++----------- tests/Api/ProjectsTest.php | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 12 deletions(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index f7d874ec..1cc9dcbc 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -586,32 +586,44 @@ public function allMember($project_id, int $user_id) } /** - * @param int|string $project_id - * @param int $user_id - * @param int $access_level + * @param int|string $project_id + * @param int $user_id + * @param int $access_level + * @param string|null $expires_at * * @return mixed */ - public function addMember($project_id, int $user_id, int $access_level) + public function addMember($project_id, int $user_id, int $access_level, string $expires_at = null) { - return $this->post($this->getProjectPath($project_id, 'members'), [ + $params = [ 'user_id' => $user_id, 'access_level' => $access_level, - ]); + ]; + if (null !== $expires_at) { + $params['expires_at'] = $expires_at; + } + + return $this->post($this->getProjectPath($project_id, 'members'), $params); } /** - * @param int|string $project_id - * @param int $user_id - * @param int $access_level + * @param int|string $project_id + * @param int $user_id + * @param int $access_level + * @param string|null $expires_at * * @return mixed */ - public function saveMember($project_id, int $user_id, int $access_level) + public function saveMember($project_id, int $user_id, int $access_level, string $expires_at = null) { - return $this->put($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id)), [ + $params = [ 'access_level' => $access_level, - ]); + ]; + if (null !== $expires_at) { + $params['expires_at'] = $expires_at; + } + + return $this->put($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id)), $params); } /** diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index a3594a6d..3fafdf3f 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -1171,6 +1171,28 @@ public function shouldAddMember(): void $this->assertEquals($expectedArray, $api->addMember(1, 2, 3)); } + /** + * @test + */ + public function shouldAddMemberWithExpiration(): void + { + // tomorrow + $expiration = \date('Y-m-d', \time() + 86400); + $expectedArray = [ + 'user_id' => 3, + 'access_level' => 3, + 'expires_at' => $expiration, + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('post') + ->with('projects/1/members', ['user_id' => 3, 'access_level' => 3, 'expires_at' => $expiration]) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->addMember(1, 3, 3, $expiration)); + } + /** * @test */ @@ -1187,6 +1209,28 @@ public function shouldSaveMember(): void $this->assertEquals($expectedArray, $api->saveMember(1, 2, 4)); } + /** + * @test + */ + public function shouldSaveMemberWithExpiration(): void + { + // tomorrow + $expiration = \date('Y-m-d', \time() + 86400); + $expectedArray = [ + 'user_id' => 3, + 'access_level' => 4, + 'expires_at' => $expiration, + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('put') + ->with('projects/1/members/3', ['access_level' => 4, 'expires_at' => $expiration]) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->saveMember(1, 3, 4, $expiration)); + } + /** * @test */ From ff8d9bec23085fb2588fa1526075a5fd059e1bcb Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Thu, 9 Mar 2023 13:07:25 +0000 Subject: [PATCH 029/117] Update CHANGELOG.md --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69239310..39bc141d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.10.0] - UPCOMING -* Add support for `Packages::addGenericFile()` +* Add support for `Packages::addGenericFile` +* Add support for `Milestones::mergeRequests` * Add support for `access_level` in `Projects::createProjectAccessToken` +* Add support for `expires_at` in `Projects::addMember` and `Projects::saveMember` ## [11.9.0] - 2023-03-06 From 2912bfb810e9afa9467a45070e5594e7820ea30c Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 12 Mar 2023 23:50:04 +0000 Subject: [PATCH 030/117] Tweaks --- src/Api/Projects.php | 19 ++----------------- tests/Api/ProjectsTest.php | 1 + tests/Api/RepositoriesTest.php | 3 ++- tests/Api/TagsTest.php | 2 ++ tests/Api/UsersTest.php | 2 ++ 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 00210acb..1ca253c0 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -383,23 +383,8 @@ public function pipelines($project_id, array $parameters = []) ->setAllowedValues('sort', ['asc', 'desc']) ; $resolver->setDefined('source') - ->setAllowedValues('source', [ - 'push', - 'web', - 'trigger', - 'schedule', - 'api', - 'external', - 'pipeline', - 'chat', - 'webide', - 'merge_request_event', - 'external_pull_request_event', - 'parent_pipeline', - 'ondemand_dast_scan', - 'ondemand_dast_validation', - ] - ); + ->setAllowedValues('source', ['push', 'web', 'trigger', 'schedule', 'api', 'external', 'pipeline', 'chat', 'webide', 'merge_request_event', 'external_pull_request_event', 'parent_pipeline', 'ondemand_dast_scan', 'ondemand_dast_validation']) + ; return $this->get($this->getProjectPath($project_id, 'pipelines'), $resolver->resolve($parameters)); } diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 7e0584e1..bc7e64e0 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -104,6 +104,7 @@ public function shouldGetNotArchivedProjects(): void /** * @test + * * @dataProvider possibleAccessLevels */ public function shouldGetProjectsWithMinimumAccessLevel($level): void diff --git a/tests/Api/RepositoriesTest.php b/tests/Api/RepositoriesTest.php index bb3075e2..67e9ceb8 100644 --- a/tests/Api/RepositoriesTest.php +++ b/tests/Api/RepositoriesTest.php @@ -362,9 +362,10 @@ public function shouldGetCommitRefs(): void } /** - * @dataProvider dataGetCommitRefsWithParams * @test * + * @dataProvider dataGetCommitRefsWithParams + * * @param string $type * @param array $expectedArray */ diff --git a/tests/Api/TagsTest.php b/tests/Api/TagsTest.php index a13730d4..91f675e9 100644 --- a/tests/Api/TagsTest.php +++ b/tests/Api/TagsTest.php @@ -96,6 +96,7 @@ public function shouldRemoveTag(): void /** * @test + * * @dataProvider releaseDataProvider * * @param string $releaseName @@ -119,6 +120,7 @@ public function shouldCreateRelease(string $releaseName, string $description, ar /** * @test + * * @dataProvider releaseDataProvider * * @param string $releaseName diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index 2839c0c9..d42c3b56 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -272,6 +272,7 @@ public static function possibleAccessLevels(): array /** * @test + * * @dataProvider possibleAccessLevels */ public function shouldGetProjectsWithMinimumAccessLevel($level): void @@ -363,6 +364,7 @@ public function shouldGetOwnedUsersStarredProjects(): void /** * @test + * * @dataProvider possibleAccessLevels */ public function shouldGetStarredProjectsWithMinimumAccessLevel($level): void From 0c0d270652e4a362d78a0b9ab92a1edaa31c10f8 Mon Sep 17 00:00:00 2001 From: Moritz Witte Date: Sun, 30 Apr 2023 20:46:50 +0200 Subject: [PATCH 031/117] [11.10] Added tags order_by support for version value (#737) --- src/Api/Tags.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Api/Tags.php b/src/Api/Tags.php index eed1c58f..f52cd2c0 100644 --- a/src/Api/Tags.php +++ b/src/Api/Tags.php @@ -20,7 +20,7 @@ class Tags extends AbstractApi * @param int|string $project_id * @param array $parameters { * - * @var string $order_by Return tags ordered by `name` or `updated` fields. Default is `updated`. + * @var string $order_by Return tags ordered by `name`, `updated` or `version` fields. Default is `updated`. * @var string $sort Return tags sorted in asc or desc order. Default is desc. * @var string $search Return list of tags matching the search criteria. You can use `^term` and `term$` to * find tags that begin and end with term respectively. @@ -32,7 +32,7 @@ public function all($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('order_by') - ->setAllowedValues('order_by', ['name', 'updated']); + ->setAllowedValues('order_by', ['name', 'updated', 'version']); $resolver->setDefined('sort') ->setAllowedValues('sort', ['asc', 'desc']); $resolver->setDefined('search'); From 16b300748f6e835df982288fa688a6ebfe844f2f Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 30 Apr 2023 19:56:29 +0100 Subject: [PATCH 032/117] [11.9] Correct upload avatar endpoint (#750) --- src/Api/Projects.php | 2 +- tests/Api/ProjectsTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 1ca253c0..43773b12 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1207,7 +1207,7 @@ public function uploadFile($project_id, string $file) */ public function uploadAvatar($project_id, string $file) { - return $this->put($this->getProjectPath($project_id, ''), [], [], ['avatar' => $file]); + return $this->put('projects/'.self::encodePath($project_id), [], [], ['avatar' => $file]); } /** diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index bc7e64e0..6def3b0d 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -2780,7 +2780,7 @@ public function shouldUploadAvatar(): void $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('projects/1/', [], [], ['avatar' => $fileName]) + ->with('projects/1', [], [], ['avatar' => $fileName]) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->uploadAvatar(1, $fileName)); \unlink($fileName); From c1c0483660ef205a41a9767100a10e4d02fbe96e Mon Sep 17 00:00:00 2001 From: Sergey Skaridov Date: Sun, 30 Apr 2023 22:00:07 +0300 Subject: [PATCH 033/117] [11.10] Add support for `Project::removeTrigger` (#744) --- src/Api/Projects.php | 11 +++++++++++ tests/Api/ProjectsTest.php | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 1e521ea7..47782518 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -283,6 +283,17 @@ public function createTrigger($project_id, string $description) ]); } + /** + * @param int|string $project_id + * @param int $trigger_id + * + * @return mixed + */ + public function removeTrigger($project_id, int $trigger_id) + { + return $this->delete($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); + } + /** * @param int|string $project_id * @param string $ref diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 1fed3054..a990ea48 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -726,6 +726,22 @@ public function shouldCreateTrigger(): void $this->assertEquals($expectedArray, $api->createTrigger(1, 'foobar')); } + /** + * @test + */ + public function shouldRemoveTrigger(): void + { + $expectedBool = true; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('delete') + ->with('projects/1/triggers/2') + ->will($this->returnValue($expectedBool)); + + $this->assertEquals($expectedBool, $api->removeTrigger(1, 2)); + } + /** * @test */ From 3548b4a120dd9147e401c2d620f479d957c5224c Mon Sep 17 00:00:00 2001 From: Felix Jacobi Date: Sun, 30 Apr 2023 21:00:47 +0200 Subject: [PATCH 034/117] [11.10] Add support for `Schedules::takeOwnership` and `Schedules::play` (#748) --- src/Api/Schedules.php | 22 ++++++++++++++++++++++ tests/Api/ScheduleTest.php | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/src/Api/Schedules.php b/src/Api/Schedules.php index 9be61928..7197a432 100644 --- a/src/Api/Schedules.php +++ b/src/Api/Schedules.php @@ -113,4 +113,26 @@ public function removeVariable($project_id, int $schedule_id, string $variable_k return $this->delete($this->getProjectPath($project_id, $path)); } + + /** + * @param int|string $project_id + * @param int $schedule_id + * + * @return mixed + */ + public function takeOwnership($project_id, int $schedule_id) + { + return $this->post($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)).'/take_ownership'); + } + + /** + * @param int|string $project_id + * @param int $schedule_id + * + * @return mixed + */ + public function play($project_id, int $schedule_id) + { + return $this->post($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)).'/play'); + } } diff --git a/tests/Api/ScheduleTest.php b/tests/Api/ScheduleTest.php index 35625e85..329397c3 100644 --- a/tests/Api/ScheduleTest.php +++ b/tests/Api/ScheduleTest.php @@ -202,6 +202,40 @@ public function shouldRemoveScheduleVariable(): void $this->assertEquals($expectedBool, $api->removeVariable(1, 2, 'FOO_BAR')); } + /** + * @test + */ + public function shouldTakeOwnership(): void + { + $expectedBool = true; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('post') + ->with('projects/1/pipeline_schedules/2/take_ownership') + ->will($this->returnValue($expectedBool)) + ; + + $this->assertEquals($expectedBool, $api->takeOwnership(1, 2)); + } + + /** + * @test + */ + public function shouldPlay(): void + { + $expectedBool = true; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('post') + ->with('projects/1/pipeline_schedules/2/play') + ->will($this->returnValue($expectedBool)) + ; + + $this->assertEquals($expectedBool, $api->play(1, 2)); + } + protected function getApiClass() { return Schedules::class; From 148ed10609f92e03afbf756e734ee4b76be36832 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 30 Apr 2023 20:02:00 +0100 Subject: [PATCH 035/117] Release v11.9.1 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dc107bb..2aa79bab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.9.1] - 2023-04-30 + +* Corrected upload avatar endpoint + ## [11.9.0] - 2023-03-06 * Add PHP 8.2 support From 51b81cc57a05988355e219bb36327b417e513ae1 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 30 Apr 2023 20:09:03 +0100 Subject: [PATCH 036/117] Bumped versions --- README.md | 6 +++--- composer.json | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a2fc8e0b..b9b0f578 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ This version supports [PHP](https://php.net) 7.4-8.2. To get started, simply req ```bash $ composer require "m4tthumphrey/php-gitlab-api:^11.10" \ - "guzzlehttp/guzzle:^7.5" "http-interop/http-factory-guzzle:^1.2" + "guzzlehttp/guzzle:^7.5.1" "http-interop/http-factory-guzzle:^1.2" ``` ### Framework Integration @@ -37,14 +37,14 @@ $ composer require "m4tthumphrey/php-gitlab-api:^11.10" \ #### Laravel: ```bash -$ composer require "graham-campbell/gitlab:^7.1" +$ composer require "graham-campbell/gitlab:^7.2" ``` #### Symfony: ```bash $ composer require "zeichen32/gitlabapibundle:^6.0" \ - "symfony/http-client:^5.4" "nyholm/psr7:^1.4" + "symfony/http-client:^6.2" "nyholm/psr7:^1.7" ``` We are decoupled from any HTTP messaging client by using [PSR-7](https://www.php-fig.org/psr/psr-7/), [PSR-17](https://www.php-fig.org/psr/psr-17/), [PSR-18](https://www.php-fig.org/psr/psr-18/), and [HTTPlug](https://httplug.io/). You can visit [HTTPlug for library users](https://docs.php-http.org/en/latest/httplug/users.html) to get more information about installing HTTPlug related packages. The framework integration [graham-campbell/gitlab](https://github.com/GrahamCampbell/Laravel-GitLab) is by [Graham Campbell](https://github.com/GrahamCampbell) and [zeichen32/gitlabapibundle](https://github.com/Zeichen32/GitLabApiBundle) is by [Jens Averkamp](https://github.com/Zeichen32). diff --git a/composer.json b/composer.json index d7497ce5..62301255 100644 --- a/composer.json +++ b/composer.json @@ -29,21 +29,21 @@ "php": "^7.4.15 || ^8.0.2", "ext-json": "*", "ext-xml": "*", - "php-http/cache-plugin": "^1.7.5", - "php-http/client-common": "^2.6", - "php-http/discovery": "^1.15", - "php-http/httplug": "^2.3", - "php-http/multipart-stream-builder": "^1.2", + "php-http/cache-plugin": "^1.8", + "php-http/client-common": "^2.6.1", + "php-http/discovery": "^1.17", + "php-http/httplug": "^2.4", + "php-http/multipart-stream-builder": "^1.3", "psr/cache": "^1.0 || ^2.0 || ^3.0", "psr/http-client-implementation": "^1.0", "psr/http-factory-implementation": "^1.0", - "psr/http-message": "^1.0", + "psr/http-message": "^1.1 || ^2.0", "symfony/options-resolver": "^4.4 || ^5.0 || ^6.0", "symfony/polyfill-php80": "^1.26" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "guzzlehttp/guzzle": "^7.5", + "guzzlehttp/guzzle": "^7.5.1", "http-interop/http-factory-guzzle": "^1.0" }, "autoload": { From e541623fa53e5c6387aeacea1bef58cda04c31d1 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 30 Apr 2023 20:09:07 +0100 Subject: [PATCH 037/117] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e10d9453..837818f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Add support for `Packages::addGenericFile` * Add support for `Milestones::mergeRequests` +* Add support for `Project::removeTrigger` +* Add support for `Schedules::takeOwnership` and `Schedules::play` * Add support for `access_level` in `Projects::createProjectAccessToken` * Add support for `expires_at` in `Projects::addMember` and `Projects::saveMember` +* Add support for `order_by` `version` in `Tags::all` +* Added support for `psr/http-message` v2 ## [11.9.1] - 2023-04-30 From f80b11fdce64f9fcf8f34f7be45651c4e27ab518 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 30 Apr 2023 20:50:08 +0100 Subject: [PATCH 038/117] Release 11.10.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 837818f5..e6ec0255 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [11.10.0] - UPCOMING +## [11.10.0] - 2023-04-30 * Add support for `Packages::addGenericFile` * Add support for `Milestones::mergeRequests` From bb5437a410d426b4e63345a015ce4e6064c08acf Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 17 Jul 2023 10:10:02 +0100 Subject: [PATCH 039/117] Update .styleci.yml --- .styleci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.styleci.yml b/.styleci.yml index 0eeb39ab..fd4fc87b 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -10,6 +10,7 @@ enabled: - declare_strict_types - native_constant_invocation - native_function_invocation + - phpdoc_align - phpdoc_order - void_return From 0d37c75f5080b1553eceb04b31fce28e9526f9ea Mon Sep 17 00:00:00 2001 From: Aju Chacko Date: Mon, 17 Jul 2023 14:41:15 +0530 Subject: [PATCH 040/117] [11.11] Add `expires_at` parameter to `Groups::addMember()` (#746) --- src/Api/AbstractApi.php | 10 ++++++++++ src/Api/Groups.php | 19 ++++++++++++++++--- src/Api/Projects.php | 2 +- tests/Api/GroupsTest.php | 9 ++++++--- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index 0024f4b7..cb53f852 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -38,6 +38,16 @@ abstract class AbstractApi */ private const URI_PREFIX = '/api/v4/'; + /** + * The access levels for groups and projects + * as defined in the Gitlab::Access module. + * + * @see https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/access.rb + * + * @var array + */ + protected const ACCESS_LEVELS = [0, 10, 20, 30, 40, 50]; + /** * The client instance. * diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 7f139722..8b469322 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -208,15 +208,28 @@ public function allMember($group_id, int $user_id) * @param int|string $group_id * @param int $user_id * @param int $access_level + * @param array $parameters * * @return mixed */ - public function addMember($group_id, int $user_id, int $access_level) + public function addMember($group_id, int $user_id, int $access_level, array $parameters = []) { - return $this->post('groups/'.self::encodePath($group_id).'/members', [ + $dateNormalizer = function (OptionsResolver $optionsResolver, \DateTimeInterface $date): string { + return $date->format('Y-m-d'); + }; + + $resolver = $this->createOptionsResolver() + ->setDefined('expires_at') + ->setAllowedTypes('expires_at', \DateTimeInterface::class) + ->setNormalizer('expires_at', $dateNormalizer) + ; + + $parameters = \array_merge([ 'user_id' => $user_id, 'access_level' => $access_level, - ]); + ], $resolver->resolve($parameters)); + + return $this->post('groups/'.self::encodePath($group_id).'/members', $parameters); } /** diff --git a/src/Api/Projects.php b/src/Api/Projects.php index fa2877dc..0289a5e5 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1276,7 +1276,7 @@ public function addShare($project_id, array $parameters = []) $resolver->setRequired('group_access') ->setAllowedTypes('group_access', 'int') - ->setAllowedValues('group_access', [0, 10, 20, 30, 40, 50]); + ->setAllowedValues('group_access', self::ACCESS_LEVELS); $resolver->setDefined('expires_at') ->setAllowedTypes('expires_at', \DateTimeInterface::class) diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index 8cee4946..07f60b6f 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -282,16 +282,19 @@ public function shouldGetMembers(): void */ public function shouldAddMember(): void { - $expectedArray = ['id' => 1, 'name' => 'Matt']; + $tomorrow = (new DateTime('tomorrow')); + $expectedArray = ['id' => 1, 'name' => 'Matt', 'expires_at' => $tomorrow]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('groups/1/members', ['user_id' => 2, 'access_level' => 3]) + ->with('groups/1/members', [ + 'user_id' => 2, 'access_level' => 10, 'expires_at' => $tomorrow->format('Y-m-d'), + ]) ->will($this->returnValue($expectedArray)) ; - $this->assertEquals($expectedArray, $api->addMember(1, 2, 3)); + $this->assertEquals($expectedArray, $api->addMember(1, 2, 10, ['expires_at' => $tomorrow])); } /** From 0c8224a248831358e3cca5d29dc725346e96c302 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 17 Jul 2023 10:12:49 +0100 Subject: [PATCH 041/117] Bumped versions --- CHANGELOG.md | 4 ++++ README.md | 4 ++-- src/Client.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6ec0255..84b9f768 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.11.0] - UPCOMING + +* Add support for `expires_at` in `Groups::addMember` + ## [11.10.0] - 2023-04-30 * Add support for `Packages::addGenericFile` diff --git a/README.md b/README.md index b9b0f578..afdf50e8 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This version supports [PHP](https://php.net) 7.4-8.2. To get started, simply req ### Standard Installation ```bash -$ composer require "m4tthumphrey/php-gitlab-api:^11.10" \ +$ composer require "m4tthumphrey/php-gitlab-api:^11.11" \ "guzzlehttp/guzzle:^7.5.1" "http-interop/http-factory-guzzle:^1.2" ``` @@ -37,7 +37,7 @@ $ composer require "m4tthumphrey/php-gitlab-api:^11.10" \ #### Laravel: ```bash -$ composer require "graham-campbell/gitlab:^7.2" +$ composer require "graham-campbell/gitlab:^7.3" ``` #### Symfony: diff --git a/src/Client.php b/src/Client.php index 40b09edf..bf9b4060 100644 --- a/src/Client.php +++ b/src/Client.php @@ -98,7 +98,7 @@ class Client * * @var string */ - private const USER_AGENT = 'gitlab-php-api-client/11.10'; + private const USER_AGENT = 'gitlab-php-api-client/11.11'; /** * The HTTP client builder. From 48230af7cbc32c941d74600ea027a117c7758932 Mon Sep 17 00:00:00 2001 From: Mike Gladysch Date: Mon, 17 Jul 2023 11:13:41 +0200 Subject: [PATCH 042/117] [11.11] Added `include_retried` option on to `Jobs::pipelineBridges` (#751) --- src/Api/Jobs.php | 8 ++++++-- tests/Api/JobsTest.php | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/Api/Jobs.php b/src/Api/Jobs.php index 8dcf8692..70d7a28f 100644 --- a/src/Api/Jobs.php +++ b/src/Api/Jobs.php @@ -102,8 +102,9 @@ public function pipelineJobs($project_id, int $pipeline_id, array $parameters = * @param int $pipeline_id * @param array $parameters { * - * @var string|string[] $scope The scope of bridge jobs to show, one or array of: created, pending, running, failed, - * success, canceled, skipped, manual; showing all jobs if none provided. + * @var string|string[] $scope The scope of bridge jobs to show, one or array of: created, pending, running, failed, + * success, canceled, skipped, manual; showing all jobs if none provided + * @var bool $include_retried Include retried jobs in the response. Defaults to false. Introduced in GitLab 13.9. * } * * @return mixed @@ -275,6 +276,9 @@ protected function createOptionsResolver(): OptionsResolver }) ; + $resolver->setDefined('include_retried') + ->setAllowedTypes('include_retried', ['bool']); + return $resolver; } } diff --git a/tests/Api/JobsTest.php b/tests/Api/JobsTest.php index 5d355b11..307acf1f 100644 --- a/tests/Api/JobsTest.php +++ b/tests/Api/JobsTest.php @@ -63,6 +63,30 @@ public function shouldGetPipelineJobs(): void $this->assertEquals($expectedArray, $api->pipelineJobs(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING]])); } + /** + * @test + */ + public function shouldGetPipelineJobsIncludingRetried(): void + { + $expectedArray = [ + ['id' => 1, 'name' => 'A job'], + ['id' => 2, 'name' => 'Another job'], + ['id' => 3, 'name' => 'A job'], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/pipelines/2/jobs', [ + 'scope' => ['pending', 'running'], + 'include_retried' => true, + ]) + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->pipelineJobs(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING], 'include_retried' => true])); + } + /** * @test */ From 738aca3a6b9bc1826fd7237935d7a33de4c8adaf Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 17 Jul 2023 10:16:07 +0100 Subject: [PATCH 043/117] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84b9f768..b6a5dd52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.11.0] - UPCOMING * Add support for `expires_at` in `Groups::addMember` +* Add support for `include_retried` in `Jobs::pipelineBridges` ## [11.10.0] - 2023-04-30 From 52ac68bcdc08298fec469fdc6a687a11317a9ba3 Mon Sep 17 00:00:00 2001 From: Philipp Kolmann Date: Mon, 17 Jul 2023 11:17:34 +0200 Subject: [PATCH 044/117] [11.11] Add support for `Users::removeUserIdentity` (#762) Co-authored-by: Philipp Kolmann --- src/Api/Users.php | 13 +++++++++++++ tests/Api/UsersTest.php | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/Api/Users.php b/src/Api/Users.php index 0c53298e..94a9b862 100644 --- a/src/Api/Users.php +++ b/src/Api/Users.php @@ -592,4 +592,17 @@ public function events(int $user_id, array $parameters = []) return $this->get('users/'.self::encodePath($user_id).'/events', $resolver->resolve($parameters)); } + + /** + * Deletes a user’s authentication identity using the provider name associated with that identity. + * + * @param int $user_id + * @param string $provider + * + * @return mixed + */ + public function removeUserIdentity(int $user_id, string $provider) + { + return $this->delete('users/'.self::encodePath($user_id).'/identities/'.self::encodePath($provider)); + } } diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index d42c3b56..26921a50 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -980,4 +980,22 @@ public function shouldGetEventsWithPagination(): void $this->assertEquals($expectedArray, $api->events(1, ['page' => 2, 'per_page' => 15])); } + + /** + * @test + */ + public function getRemoveUserIdentity(): void + { + $expectedArray = [ + ['id' => 1, 'identities' => []], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('delete') + ->with('users/1/identities/test') + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->removeUserIdentity(1, 'test')); + } } From 0c15c4cbbe3b896667086bda38f25d4d814dc7ef Mon Sep 17 00:00:00 2001 From: Alex McCabe Date: Mon, 17 Jul 2023 05:19:02 -0400 Subject: [PATCH 045/117] [11.11] Add support for additional parameters in `Projects::deployment` (#753) --- src/Api/Projects.php | 45 +++++++++++++++++++++++++++++ tests/Api/ProjectsTest.php | 58 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 0289a5e5..89a9eec3 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1238,11 +1238,56 @@ public function uploadAvatar($project_id, string $file) * @param array $parameters * * @return mixed + * + * @see https://docs.gitlab.com/ee/api/deployments.html#list-project-deployments */ public function deployments($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); + $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { + return $value->format('c'); + }; + + $resolver->setDefined('order_by') + ->setAllowedTypes('order_by', 'string') + ->setAllowedValues('order_by', ['id', 'iid', 'created_at', 'updated_at', 'finished_at', 'ref']) + ; + + $resolver->setDefined('sort') + ->setAllowedTypes('sort', 'string') + ->setAllowedValues('sort', ['asc', 'desc']) + ; + + $resolver->setDefined('updated_after') + ->setAllowedTypes('updated_after', \DateTimeInterface::class) + ->setNormalizer('updated_after', $datetimeNormalizer) + ; + + $resolver->setDefined('updated_before') + ->setAllowedTypes('updated_before', \DateTimeInterface::class) + ->setNormalizer('updated_before', $datetimeNormalizer) + ; + + $resolver->setDefined('finished_after') + ->setAllowedTypes('finished_after', \DateTimeInterface::class) + ->setNormalizer('finished_after', $datetimeNormalizer) + ; + + $resolver->setDefined('finished_before') + ->setAllowedTypes('finished_before', \DateTimeInterface::class) + ->setNormalizer('finished_before', $datetimeNormalizer) + ; + + $resolver->setDefined('environment') + ->setAllowedTypes('environment', 'string') + ; + + $resolver->setDefined('status') + ->setAllowedTypes('status', 'string') + ->setAllowedValues('status', ['created', 'running', 'success', 'failed', 'canceled', 'blocked']) + ; + return $this->get($this->getProjectPath($project_id, 'deployments'), $resolver->resolve($parameters)); } diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 709752e1..7688dd53 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -2355,6 +2355,64 @@ public function shouldGetDeploymentsWithPagination(): void $this->assertEquals($expectedArray, $api->deployments(1, ['page' => 2, 'per_page' => 15])); } + /** + * @test + */ + public function shouldGetDeploymentsSorted(): void + { + $expectedArray = [ + ['id' => 1, 'sha' => '0000001'], + ['id' => 2, 'sha' => '0000002'], + ['id' => 3, 'sha' => '0000003'], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/deployments', [ + 'order_by' => 'id', + 'sort' => 'asc', + ]) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->deployments(1, ['order_by' => 'id', 'sort' => 'asc'])); + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/deployments', [ + 'order_by' => 'id', + 'sort' => 'desc', + ]) + ->will($this->returnValue(\array_reverse($expectedArray))); + + $this->assertEquals(\array_reverse($expectedArray), $api->deployments(1, ['order_by' => 'id', 'sort' => 'desc'])); + } + + /** + * @test + */ + public function shouldGetDeploymentsFiltered(): void + { + $expectedArray = [ + ['id' => 1, 'sha' => '0000001'], + ['id' => 2, 'sha' => '0000002'], + ['id' => 3, 'sha' => '0000003'], + ]; + + $time = new DateTime('now'); + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/deployments', [ + 'updated_after' => $time->format('c'), + ]) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->deployments(1, ['updated_after' => $time])); + } + protected function getMultipleProjectsData() { return [ From 3d0f14ed927236acc5fb7e9241875543293df97e Mon Sep 17 00:00:00 2001 From: Eric Castillo Date: Mon, 17 Jul 2023 11:22:33 +0200 Subject: [PATCH 046/117] [11.11] Add support for `author_id` in `Issues::all` (#761) Co-authored-by: Eric Castillo Co-authored-by: Graham Campbell --- src/Api/Issues.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Api/Issues.php b/src/Api/Issues.php index 360e8b51..717cf984 100644 --- a/src/Api/Issues.php +++ b/src/Api/Issues.php @@ -43,9 +43,10 @@ class Issues extends AbstractApi * @var string $sort return requests sorted in asc or desc order (default is desc) * @var bool $confidential filter confidential or public issues * @var string $search search issues against their title and description - * @var int $assignee_id return issues assigned to the specified user id - * @var int $iteration_id return issues assigned to the specified iteration id - * @var string $iteration_title return issues assigned to the specified iteration title + * @var int $author_id filter issues assigned to the specified author user id + * @var int $assignee_id filter issues assigned to the specified assignee user id + * @var int $iteration_id filter issues assigned to the specified iteration id + * @var string $iteration_title filter issues assigned to the specified iteration title * } * * @return mixed @@ -497,6 +498,9 @@ protected function createOptionsResolver(): OptionsResolver $resolver->setDefined('created_before'); $resolver->setDefined('updated_after'); $resolver->setDefined('updated_before'); + $resolver->setDefined('author_id') + ->setAllowedTypes('author_id', 'integer') + ; $resolver->setDefined('assignee_id') ->setAllowedTypes('assignee_id', 'integer') ; From 34f06de2505b380845fbd2e80891d103e0483a34 Mon Sep 17 00:00:00 2001 From: Fran Garcia-Linares Date: Mon, 17 Jul 2023 11:23:43 +0200 Subject: [PATCH 047/117] [11.11] Add support for `MergeRequests::showParticipants` (#755) --- src/Api/MergeRequests.php | 11 +++++++++++ tests/Api/MergeRequestsTest.php | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/Api/MergeRequests.php b/src/Api/MergeRequests.php index 360bbb6e..ed3779f6 100644 --- a/src/Api/MergeRequests.php +++ b/src/Api/MergeRequests.php @@ -382,6 +382,17 @@ public function removeDiscussionNote($project_id, int $mr_iid, string $discussio return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id))); } + /** + * @param int|string $project_id + * @param int $mr_iid + * + * @return mixed + */ + public function showParticipants($project_id, int $mr_iid) + { + return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/participants'); + } + /** * @param int|string $project_id * @param int $mr_iid diff --git a/tests/Api/MergeRequestsTest.php b/tests/Api/MergeRequestsTest.php index 957d2efa..ae8225bc 100644 --- a/tests/Api/MergeRequestsTest.php +++ b/tests/Api/MergeRequestsTest.php @@ -350,6 +350,40 @@ public function shouldRemoveNote(): void $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); } + /** + * @test + */ + public function shouldGetMergeRequestParticipants(): void + { + $expectedArray = [ + [ + 'id' => 1, + 'name' => 'John Doe1', + 'username' => 'user1', + 'state' => 'active', + 'avatar_url' => 'http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon', + 'web_url' => 'http://localhost/user1', + ], + [ + 'id' => 5, + 'name' => 'John Doe5', + 'username' => 'user5', + 'state' => 'active', + 'avatar_url' => 'http://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80&d=identicon', + 'web_url' => 'http://localhost/user5', + ], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/merge_requests/2/participants') + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->showParticipants(1, 2)); + } + /** * @test */ From ebe5d9ebb9b07158e1cd0271a5185d37a8586789 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 17 Jul 2023 10:28:30 +0100 Subject: [PATCH 048/117] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6a5dd52..75a63979 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.11.0] - UPCOMING +* Add support for `author_id` in `Issues::all` * Add support for `expires_at` in `Groups::addMember` * Add support for `include_retried` in `Jobs::pipelineBridges` +* Add support for additional parameters in `Projects::deployment` +* Add support for `Users::removeUserIdentity` +* Add support for `MergeRequests::showParticipants` ## [11.10.0] - 2023-04-30 From e4835852685486200f5831436b017cf2ec0b3b08 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 17 Jul 2023 10:29:02 +0100 Subject: [PATCH 049/117] Bumped versions --- README.md | 4 ++-- src/Client.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index afdf50e8..8ce7ea91 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This version supports [PHP](https://php.net) 7.4-8.2. To get started, simply req ### Standard Installation ```bash -$ composer require "m4tthumphrey/php-gitlab-api:^11.11" \ +$ composer require "m4tthumphrey/php-gitlab-api:^11.12" \ "guzzlehttp/guzzle:^7.5.1" "http-interop/http-factory-guzzle:^1.2" ``` @@ -37,7 +37,7 @@ $ composer require "m4tthumphrey/php-gitlab-api:^11.11" \ #### Laravel: ```bash -$ composer require "graham-campbell/gitlab:^7.3" +$ composer require "graham-campbell/gitlab:^7.4" ``` #### Symfony: diff --git a/src/Client.php b/src/Client.php index bf9b4060..815c8367 100644 --- a/src/Client.php +++ b/src/Client.php @@ -98,7 +98,7 @@ class Client * * @var string */ - private const USER_AGENT = 'gitlab-php-api-client/11.11'; + private const USER_AGENT = 'gitlab-php-api-client/11.12'; /** * The HTTP client builder. From 1b9a894eaa8355c7e7521db29297ccf1df2f7b53 Mon Sep 17 00:00:00 2001 From: Fran Garcia-Linares Date: Mon, 17 Jul 2023 11:30:47 +0200 Subject: [PATCH 050/117] [11.11] Add support for additional parameters in `Projects::forks` (#752) --- src/Api/Projects.php | 89 +++++++++++++++++++++++++++++++++++++- tests/Api/ProjectsTest.php | 65 ++++++++++++++++++++++++++++ 2 files changed, 153 insertions(+), 1 deletion(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 89a9eec3..c8cbd01b 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1035,13 +1035,100 @@ public function languages($project_id) /** * @param int|string $project_id - * @param array $parameters + * @param array $parameters { + * + * @var bool $archived Limit by archived status + * @var string $visibility Limit by visibility public, internal, or private + * @var string $order_by Return projects ordered by id, name, path, created_at, updated_at, + * last_activity_at, repository_size, storage_size, packages_size or + * wiki_size fields (default is created_at) + * @var string $sort Return projects sorted in asc or desc order (default is desc) + * @var string $search Return list of projects matching the search criteria + * @var bool $simple Return only the ID, URL, name, and path of each project + * @var bool $owned Limit by projects owned by the current user + * @var bool $membership Limit by projects that the current user is a member of + * @var bool $starred Limit by projects starred by the current user + * @var bool $statistics Include project statistics + * @var bool $with_issues_enabled Limit by enabled issues feature + * @var bool $with_merge_requests_enabled Limit by enabled merge requests feature + * @var int $min_access_level Limit by current user minimal access level + * @var \DateTimeInterface $updated_before limit results to projects last updated before the specified time + * @var \DateTimeInterface $updated_after limit results to projects last updated after the specified time + * @var bool $with_custom_attributes Include custom attributes in response + * } * * @return mixed */ public function forks($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { + return $value->format('c'); + }; + $resolver->setDefined('archived') + ->setAllowedTypes('archived', 'bool') + ->setNormalizer('archived', $booleanNormalizer) + ; + $resolver->setDefined('visibility') + ->setAllowedValues('visibility', ['public', 'internal', 'private']) + ; + $orderBy = [ + 'id', 'name', 'path', 'created_at', 'updated_at', 'last_activity_at', + 'repository_size', 'storage_size', 'packages_size', 'wiki_size', + ]; + $resolver->setDefined('order_by') + ->setAllowedValues('order_by', $orderBy) + ; + $resolver->setDefined('sort') + ->setAllowedValues('sort', ['asc', 'desc']) + ; + $resolver->setDefined('search'); + $resolver->setDefined('simple') + ->setAllowedTypes('simple', 'bool') + ->setNormalizer('simple', $booleanNormalizer) + ; + $resolver->setDefined('owned') + ->setAllowedTypes('owned', 'bool') + ->setNormalizer('owned', $booleanNormalizer) + ; + $resolver->setDefined('membership') + ->setAllowedTypes('membership', 'bool') + ->setNormalizer('membership', $booleanNormalizer) + ; + $resolver->setDefined('starred') + ->setAllowedTypes('starred', 'bool') + ->setNormalizer('starred', $booleanNormalizer) + ; + $resolver->setDefined('statistics') + ->setAllowedTypes('statistics', 'bool') + ->setNormalizer('statistics', $booleanNormalizer) + ; + $resolver->setDefined('with_issues_enabled') + ->setAllowedTypes('with_issues_enabled', 'bool') + ->setNormalizer('with_issues_enabled', $booleanNormalizer) + ; + $resolver->setDefined('with_merge_requests_enabled') + ->setAllowedTypes('with_merge_requests_enabled', 'bool') + ->setNormalizer('with_merge_requests_enabled', $booleanNormalizer) + ; + $resolver->setDefined('min_access_level') + ->setAllowedValues('min_access_level', [null, 10, 20, 30, 40, 50]) + ; + $resolver->setDefined('updated_before') + ->setAllowedTypes('updated_before', \DateTimeInterface::class) + ->setNormalizer('updated_before', $datetimeNormalizer) + ; + $resolver->setDefined('updated_after') + ->setAllowedTypes('updated_after', \DateTimeInterface::class) + ->setNormalizer('updated_after', $datetimeNormalizer) + ; + $resolver->setDefined('with_custom_attributes') + ->setAllowedTypes('with_custom_attributes', 'bool') + ->setNormalizer('with_custom_attributes', $booleanNormalizer) + ; return $this->get($this->getProjectPath($project_id, 'forks'), $resolver->resolve($parameters)); } diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 7688dd53..f1d3752b 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -1936,6 +1936,71 @@ public function shouldGetForks(): void $this->assertEquals($expectedArray, $api->forks(1)); } + /** + * @test + */ + public function shouldGetForksUsingParameters(): void + { + $expectedArray = [ + [ + 'id' => 2, + 'forked_from_project' => [ + 'id' => 1, + ], + ], + [ + 'id' => 3, + 'forked_from_project' => [ + 'id' => 1, + ], + ], + ]; + $updated_after = new \DateTime('2018-01-01 00:00:00'); + $updated_before = new \DateTime('2018-01-31 00:00:00'); + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/forks', [ + 'archived' => 'false', + 'visibility' => 'public', + 'order_by' => 'id', + 'sort' => 'asc', + 'search' => 'term', + 'simple' => 'true', + 'owned' => 'false', + 'membership' => 'false', + 'starred' => 'false', + 'statistics' => 'false', + 'with_issues_enabled' => 'false', + 'with_merge_requests_enabled' => 'false', + 'min_access_level' => 30, + 'updated_after' => $updated_after->format('c'), + 'updated_before' => $updated_before->format('c'), + 'with_custom_attributes' => 'true', + ]) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->forks(1, [ + 'archived' => false, + 'visibility' => 'public', + 'order_by' => 'id', + 'sort' => 'asc', + 'search' => 'term', + 'simple' => true, + 'owned' => false, + 'membership' => false, + 'starred' => false, + 'statistics' => false, + 'with_issues_enabled' => false, + 'with_merge_requests_enabled' => false, + 'min_access_level' => 30, + 'updated_after' => $updated_after, + 'updated_before' => $updated_before, + 'with_custom_attributes' => true, + ])); + } + /** * @test */ From 9f630a1d6fb451d87c51832ac0314fc39498538c Mon Sep 17 00:00:00 2001 From: Niclas Hoyer Date: Mon, 17 Jul 2023 11:32:07 +0200 Subject: [PATCH 051/117] Add support for Events API (#754) --- src/Api/Events.php | 56 +++++++++++++++++++++++++++++++++++ src/Client.php | 9 ++++++ tests/Api/EventsTest.php | 64 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 src/Api/Events.php create mode 100644 tests/Api/EventsTest.php diff --git a/src/Api/Events.php b/src/Api/Events.php new file mode 100644 index 00000000..b8826e0a --- /dev/null +++ b/src/Api/Events.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Gitlab\Api; + +use Symfony\Component\OptionsResolver\Options; + +class Events extends AbstractApi +{ + /** + * @param array $parameters { + * + * @var string $action include only events of a particular action type + * @var string $target_type include only events of a particular target type + * @var \DateTimeInterface $before include only events created before a particular date + * @var \DateTimeInterface $after include only events created after a particular date + * @var string $scope include all events across a user’s projects + * @var string $sort sort events in asc or desc order by created_at + * + * } + * + * @return mixed + */ + public function all(array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { + return $value->format('Y-m-d'); + }; + + $resolver->setDefined('action'); + $resolver->setDefined('target_type'); + $resolver->setDefined('before') + ->setAllowedTypes('before', \DateTimeInterface::class) + ->setNormalizer('before', $datetimeNormalizer) + ; + $resolver->setDefined('after') + ->setAllowedTypes('after', \DateTimeInterface::class) + ->setNormalizer('after', $datetimeNormalizer) + ; + $resolver->setDefined('scope'); + $resolver->setDefined('sort'); + + return $this->get('events', $resolver->resolve($parameters)); + } +} diff --git a/src/Client.php b/src/Client.php index bf9b4060..681b3a54 100644 --- a/src/Client.php +++ b/src/Client.php @@ -17,6 +17,7 @@ use Gitlab\Api\DeployKeys; use Gitlab\Api\Deployments; use Gitlab\Api\Environments; +use Gitlab\Api\Events; use Gitlab\Api\Groups; use Gitlab\Api\GroupsBoards; use Gitlab\Api\GroupsEpics; @@ -174,6 +175,14 @@ public function environments(): Environments return new Environments($this); } + /** + * @return Events + */ + public function events(): Events + { + return new Events($this); + } + /** * @return Groups */ diff --git a/tests/Api/EventsTest.php b/tests/Api/EventsTest.php new file mode 100644 index 00000000..4b4fd689 --- /dev/null +++ b/tests/Api/EventsTest.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Gitlab\Tests\Api; + +use Gitlab\Api\Events; + +class EventsTest extends TestCase +{ + protected function getApiClass() + { + return Events::class; + } + + /** + * @test + */ + public function shouldGetAllEvents(): void + { + $expectedArray = [ + ['id' => 1, 'target_type' => 'Issue'], + ['id' => 2, 'target_type' => null], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('events', []) + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->all()); + } + + /** + * @test + */ + public function shouldGetEventsAfter(): void + { + $expectedArray = [ + ['id' => 1, 'target_type' => 'Issue'], + ['id' => 2, 'target_type' => null], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('events', ['after' => '1970-01-01']) + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->all(['after' => new \DateTime('1970-01-01')])); + } +} From f80b572dd730e86f08864e3a69573a30220a216a Mon Sep 17 00:00:00 2001 From: Jan Fejtek Date: Mon, 17 Jul 2023 11:34:57 +0200 Subject: [PATCH 052/117] [11.11] Add support for `tier` in `Environments::create` (#758) --- src/Api/Environments.php | 3 +++ tests/Api/EnvironmentsTest.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/Api/Environments.php b/src/Api/Environments.php index 9f01cdf6..09cd632b 100644 --- a/src/Api/Environments.php +++ b/src/Api/Environments.php @@ -44,6 +44,7 @@ public function all($project_id, array $parameters = []) * * @var string $name The name of the environment * @var string $external_url Place to link to for this environment + * @var string $tier The tier of the new environment. Allowed values are production, staging, testing, development, and other. * } * * @return mixed @@ -56,6 +57,8 @@ public function create($project_id, array $parameters = []) ->setAllowedTypes('name', 'string'); $resolver->setDefined('external_url') ->setAllowedTypes('external_url', 'string'); + $resolver->setDefined('tier') + ->setAllowedValues('tier', ['production', 'staging', 'testing', 'development', 'other']); return $this->post($this->getProjectPath($project_id, 'environments'), $resolver->resolve($parameters)); } diff --git a/tests/Api/EnvironmentsTest.php b/tests/Api/EnvironmentsTest.php index b21cb443..03dec459 100644 --- a/tests/Api/EnvironmentsTest.php +++ b/tests/Api/EnvironmentsTest.php @@ -155,12 +155,14 @@ public function shouldCreateEnvironment(): void 'name' => 'review/fix-baz', 'slug' => 'review-fix-baz-dfjre5', 'external_url' => 'https://review-fix-baz-dfjre5.example.gitlab.com/', + 'tier' => 'production', ], ]; $params = [ 'name' => 'review/fix-baz', 'external_url' => 'https://review-fix-baz-dfjre5.example.gitlab.com/', + 'tier' => 'production', ]; $api = $this->getApiMock(); From a56f7f2a51ef0ffe6fb88a6851644bee33ed604c Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 17 Jul 2023 10:36:41 +0100 Subject: [PATCH 053/117] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75a63979..97ac4955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.11.0] - UPCOMING * Add support for `author_id` in `Issues::all` +* Add support for `tier` in `Environments::create` * Add support for `expires_at` in `Groups::addMember` * Add support for `include_retried` in `Jobs::pipelineBridges` * Add support for additional parameters in `Projects::deployment` +* Add support for additional parameters in `Projects::forks` +* Add support for `Events::all` * Add support for `Users::removeUserIdentity` * Add support for `MergeRequests::showParticipants` From e6ea96390a5243113ba737ee6d45a4a66103598d Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 17 Jul 2023 10:36:49 +0100 Subject: [PATCH 054/117] Update .styleci.yml --- .styleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.styleci.yml b/.styleci.yml index fd4fc87b..e6e77550 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -10,7 +10,6 @@ enabled: - declare_strict_types - native_constant_invocation - native_function_invocation - - phpdoc_align - phpdoc_order - void_return @@ -18,5 +17,6 @@ disabled: - native_constant_invocation_symfony - native_function_invocation_symfony - no_superfluous_phpdoc_tags_symfony + - phpdoc_align - phpdoc_to_comment - phpdoc_var_without_name From 7cd35efcce8a5ca22710bda3b56b918b5542d9f5 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 17 Jul 2023 10:38:04 +0100 Subject: [PATCH 055/117] Release 11.11.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97ac4955..e8b8e481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [11.11.0] - UPCOMING +## [11.11.0] - 2023-07-17 * Add support for `author_id` in `Issues::all` * Add support for `tier` in `Environments::create` From 62acfd13ba189be7747257c97062ce5f65998f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Wilko=C5=82azki?= Date: Sun, 8 Oct 2023 15:51:42 +0200 Subject: [PATCH 056/117] [11.11] Fix double encoding of job name in artifacts download (#773) * Fix double encoding of $job_name Removed call to self::encodePath, as the `job` parameter is part of a url query, which is later encoded by `QueryStringBuilder` in `AbstractApi::prepareUri` * Use `job name` with space to test url encoding --- src/Api/Jobs.php | 4 ++-- tests/Api/JobsTest.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Api/Jobs.php b/src/Api/Jobs.php index 70d7a28f..bd318f89 100644 --- a/src/Api/Jobs.php +++ b/src/Api/Jobs.php @@ -151,7 +151,7 @@ public function artifacts($project_id, int $job_id) public function artifactsByRefName($project_id, string $ref_name, string $job_name) { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/download', [ - 'job' => self::encodePath($job_name), + 'job' => $job_name, ])->getBody(); } @@ -166,7 +166,7 @@ public function artifactsByRefName($project_id, string $ref_name, string $job_na public function artifactByRefName($project_id, string $ref_name, string $job_name, string $artifact_path) { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/raw/'.self::encodePath($artifact_path), [ - 'job' => self::encodePath($job_name), + 'job' => $job_name, ])->getBody(); } diff --git a/tests/Api/JobsTest.php b/tests/Api/JobsTest.php index 307acf1f..9ca55526 100644 --- a/tests/Api/JobsTest.php +++ b/tests/Api/JobsTest.php @@ -171,12 +171,12 @@ public function shouldGetArtifactsByRefName(): void $api->expects($this->once()) ->method('getAsResponse') ->with('projects/1/jobs/artifacts/master/download', [ - 'job' => 'job_name', + 'job' => 'job name', ]) ->will($this->returnValue($returnedStream)) ; - $this->assertEquals('foobar', $api->artifactsByRefName(1, 'master', 'job_name')->getContents()); + $this->assertEquals('foobar', $api->artifactsByRefName(1, 'master', 'job name')->getContents()); } /** @@ -189,11 +189,11 @@ public function shouldGetArtifactByRefName(): void $api->expects($this->once()) ->method('getAsResponse') ->with('projects/1/jobs/artifacts/master/raw/artifact_path', [ - 'job' => 'job_name', + 'job' => 'job name', ]) ->will($this->returnValue($returnedStream)) ; - $this->assertEquals('foobar', $api->artifactByRefName(1, 'master', 'job_name', 'artifact_path')->getContents()); + $this->assertEquals('foobar', $api->artifactByRefName(1, 'master', 'job name', 'artifact_path')->getContents()); } /** From 6c16615044e896333d34cff0d796659aceb12662 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 14:55:44 +0100 Subject: [PATCH 057/117] Bumped versions and support PHP 8.3 --- .github/workflows/static.yml | 4 ++-- .github/workflows/tests.yml | 4 ++-- README.md | 4 ++-- composer.json | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 42c11f17..66542937 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -45,7 +45,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e1bed421..eb2530e2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,11 +11,11 @@ jobs: strategy: matrix: - php: ['7.4', '8.0', '8.1', '8.2'] + php: ['7.4', '8.0', '8.1', '8.2', '8.3'] steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/README.md b/README.md index 8ce7ea91..97648228 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ This version supports [PHP](https://php.net) 7.4-8.2. To get started, simply req ```bash $ composer require "m4tthumphrey/php-gitlab-api:^11.12" \ - "guzzlehttp/guzzle:^7.5.1" "http-interop/http-factory-guzzle:^1.2" + "guzzlehttp/guzzle:^7.8" "http-interop/http-factory-guzzle:^1.2" ``` ### Framework Integration @@ -44,7 +44,7 @@ $ composer require "graham-campbell/gitlab:^7.4" ```bash $ composer require "zeichen32/gitlabapibundle:^6.0" \ - "symfony/http-client:^6.2" "nyholm/psr7:^1.7" + "symfony/http-client:^6.3" "nyholm/psr7:^1.8" ``` We are decoupled from any HTTP messaging client by using [PSR-7](https://www.php-fig.org/psr/psr-7/), [PSR-17](https://www.php-fig.org/psr/psr-17/), [PSR-18](https://www.php-fig.org/psr/psr-18/), and [HTTPlug](https://httplug.io/). You can visit [HTTPlug for library users](https://docs.php-http.org/en/latest/httplug/users.html) to get more information about installing HTTPlug related packages. The framework integration [graham-campbell/gitlab](https://github.com/GrahamCampbell/Laravel-GitLab) is by [Graham Campbell](https://github.com/GrahamCampbell) and [zeichen32/gitlabapibundle](https://github.com/Zeichen32/GitLabApiBundle) is by [Jens Averkamp](https://github.com/Zeichen32). diff --git a/composer.json b/composer.json index 62301255..a2add51f 100644 --- a/composer.json +++ b/composer.json @@ -30,8 +30,8 @@ "ext-json": "*", "ext-xml": "*", "php-http/cache-plugin": "^1.8", - "php-http/client-common": "^2.6.1", - "php-http/discovery": "^1.17", + "php-http/client-common": "^2.7", + "php-http/discovery": "^1.19", "php-http/httplug": "^2.4", "php-http/multipart-stream-builder": "^1.3", "psr/cache": "^1.0 || ^2.0 || ^3.0", @@ -43,8 +43,8 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "guzzlehttp/guzzle": "^7.5.1", - "http-interop/http-factory-guzzle": "^1.0" + "guzzlehttp/guzzle": "^7.8", + "http-interop/http-factory-guzzle": "^1.2" }, "autoload": { "psr-4": { From c529f59050f1f4ad63d5699ded82f22cd91a6d1e Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 14:56:18 +0100 Subject: [PATCH 058/117] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8b8e481..0cd81a7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.11.1] - 2023-10-XX + +* Fixed double encoding of job name in artifacts download + ## [11.11.0] - 2023-07-17 * Add support for `author_id` in `Issues::all` From 35c831f4a5a5db6a801ef7f8593a71af0a3e3082 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 14:56:53 +0100 Subject: [PATCH 059/117] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cd81a7f..989080c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.12.0] - 2023-10-XX + +* Add PHP 8.3 support + ## [11.11.1] - 2023-10-XX * Fixed double encoding of job name in artifacts download From f8178aee98a3f86aac11898f30453d316689d6df Mon Sep 17 00:00:00 2001 From: Jan Fejtek Date: Sun, 8 Oct 2023 15:57:57 +0200 Subject: [PATCH 060/117] [11.12] Passing parameters to removeVariable method (#757) * Passing parameters to removeVariable method * Update Projects.php * Update Projects.php * Update Projects.php added resolver + docs * Update Projects.php add filter level to params * Update Projects.php * Update Projects.php conding style * Update Projects.php coding style --- src/Api/Projects.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index c8cbd01b..ed0931c8 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1288,14 +1288,24 @@ public function updateVariable($project_id, string $key, string $value, ?bool $p } /** - * @param int|string $project_id - * @param string $key + * @param int|string $project_id + * @param string $key + * @param array $parameters { + * + * @var array $filter { + * + * @var string $environment_scope Use filter[environment_scope] to select the variable with the matching environment_scope attribute. + * } + * } * * @return mixed */ - public function removeVariable($project_id, string $key) + public function removeVariable($project_id, string $key, array $parameters = []) { - return $this->delete($this->getProjectPath($project_id, 'variables/'.self::encodePath($key))); + $resolver = new OptionsResolver(); + $resolver->setDefined('filter') + ->setAllowedTypes('filter', 'array'); + return $this->delete($this->getProjectPath($project_id, 'variables/'.self::encodePath($key)), $resolver->resolve($parameters)); } /** From 0f375915dc598abb6e1566db80d2621c4fd810b4 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 8 Oct 2023 13:58:15 +0000 Subject: [PATCH 061/117] Apply fixes from StyleCI --- src/Api/Projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index ed0931c8..ebec6d94 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1293,7 +1293,6 @@ public function updateVariable($project_id, string $key, string $value, ?bool $p * @param array $parameters { * * @var array $filter { - * * @var string $environment_scope Use filter[environment_scope] to select the variable with the matching environment_scope attribute. * } * } @@ -1305,6 +1304,7 @@ public function removeVariable($project_id, string $key, array $parameters = []) $resolver = new OptionsResolver(); $resolver->setDefined('filter') ->setAllowedTypes('filter', 'array'); + return $this->delete($this->getProjectPath($project_id, 'variables/'.self::encodePath($key)), $resolver->resolve($parameters)); } From 4ca1836bbd1577043a39a325d9410e64a26d9ed0 Mon Sep 17 00:00:00 2001 From: tetreum Date: Sun, 8 Oct 2023 16:04:12 +0200 Subject: [PATCH 062/117] Add support for `author` in `Repositories::commits` (#777) --- src/Api/Repositories.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Api/Repositories.php b/src/Api/Repositories.php index 3cdf19db..ac6f4f0f 100644 --- a/src/Api/Repositories.php +++ b/src/Api/Repositories.php @@ -212,6 +212,7 @@ public function commits($project_id, array $parameters = []) $resolver->setDefined('path'); $resolver->setDefined('ref_name'); + $resolver->setDefined('author'); $resolver->setDefined('since') ->setAllowedTypes('since', \DateTimeInterface::class) ->setNormalizer('since', $datetimeNormalizer) From a8b21d7e57f35a96f768375d836708de4815c255 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 15:04:28 +0100 Subject: [PATCH 063/117] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 989080c0..cfce5c88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.12.0] - 2023-10-XX * Add PHP 8.3 support +* Add support for `environment_scope` in `Project::removeVariable` +* Add support for `author` in `Repositories::commits` ## [11.11.1] - 2023-10-XX From 7c6856be8d248f99872a5568f84e5371eb3e612c Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 15:05:08 +0100 Subject: [PATCH 064/117] Bumped version --- README.md | 4 ++-- src/Client.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 97648228..8e3d18e9 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This version supports [PHP](https://php.net) 7.4-8.2. To get started, simply req ### Standard Installation ```bash -$ composer require "m4tthumphrey/php-gitlab-api:^11.12" \ +$ composer require "m4tthumphrey/php-gitlab-api:^11.13" \ "guzzlehttp/guzzle:^7.8" "http-interop/http-factory-guzzle:^1.2" ``` @@ -37,7 +37,7 @@ $ composer require "m4tthumphrey/php-gitlab-api:^11.12" \ #### Laravel: ```bash -$ composer require "graham-campbell/gitlab:^7.4" +$ composer require "graham-campbell/gitlab:^7.5" ``` #### Symfony: diff --git a/src/Client.php b/src/Client.php index b444dec1..33fd3a86 100644 --- a/src/Client.php +++ b/src/Client.php @@ -99,7 +99,7 @@ class Client * * @var string */ - private const USER_AGENT = 'gitlab-php-api-client/11.12'; + private const USER_AGENT = 'gitlab-php-api-client/11.13'; /** * The HTTP client builder. From d4b9a8fafbd6142c7bcc34cf64ce63d994e4d807 Mon Sep 17 00:00:00 2001 From: Olaf Klejnstrup-Jensen Date: Sun, 8 Oct 2023 16:07:07 +0200 Subject: [PATCH 065/117] [11.12] Add support for `filter` in `Projects::variable` (#767) * fix: add filter option to project variable method This commit implements the option to add a filter[environment_scope] to a variable request, when multiple variables with the same name exist, but have different environment scopes. See documentation for more information https://docs.gitlab.com/ee/api/project_level_variables.html#get-a-single-variable * fix: fix indenting and remove extra resolver --- src/Api/Projects.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index ebec6d94..0d0db19d 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1214,12 +1214,17 @@ public function variables($project_id, array $parameters = []) /** * @param int|string $project_id * @param string $key + * @param array $parameters * * @return mixed */ - public function variable($project_id, string $key) + public function variable($project_id, string $key, array $parameters = []) { - return $this->get($this->getProjectPath($project_id, 'variables/'.self::encodePath($key))); + $resolver = $this->createOptionsResolver(); + $resolver->setDefined('filter') + ->setAllowedTypes('filter', 'array'); + + return $this->get($this->getProjectPath($project_id, 'variables/'.self::encodePath($key)), $resolver->resolve($parameters)); } /** From b682054419887cf7b82edaacaebd652620acae23 Mon Sep 17 00:00:00 2001 From: Remi Date: Sun, 8 Oct 2023 16:07:51 +0200 Subject: [PATCH 066/117] Add support for additional parameters in `Projects::labels` and `Groups::labels` (#765) Co-authored-by: Remi FUSSIEN --- src/Api/Groups.php | 24 +++++++++++++++++++++++- src/Api/Projects.php | 16 +++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 8b469322..3c0ee3eb 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -506,7 +506,14 @@ public function issues($group_id, array $parameters = []) /** * @param int|string $group_id - * @param array $parameters + * @param array $parameters { + * + * @var bool $with_counts Whether or not to include issue and merge request counts. Defaults to false. + * @var bool $include_ancestor_groups Include ancestor groups. Defaults to true. + * @var bool $include_descendant_groups Include descendant groups. Defaults to false. + * @var bool $only_group_labels Toggle to include only group labels or also project labels. Defaults to true. + * @var string $search Keyword to filter labels by. + * } * * @return mixed */ @@ -514,6 +521,21 @@ public function labels($group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); + $resolver->setDefined('with_counts') + ->setAllowedTypes('with_counts', 'bool'); + + $resolver->setDefined('include_ancestor_groups') + ->setAllowedTypes('include_ancestor_groups', 'bool'); + + $resolver->setDefined('include_descendant_groups') + ->setAllowedTypes('include_descendant_groups', 'bool'); + + $resolver->setDefined('only_group_labels') + ->setAllowedTypes('only_group_labels', 'bool'); + + $resolver->setDefined('search') + ->setAllowedTypes('search', 'string'); + return $this->get('groups/'.self::encodePath($group_id).'/labels', $resolver->resolve($parameters)); } diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 0d0db19d..b7ad32b1 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -976,7 +976,12 @@ public function events($project_id, array $parameters = []) /** * @param int|string $project_id - * @param array $parameters + * @param array $parameters { + * + * @var bool $with_counts Whether or not to include issue and merge request counts. Defaults to false. + * @var bool $include_ancestor_groups Include ancestor groups. Defaults to true. + * @var string $search Keyword to filter labels by. + * } * * @return mixed */ @@ -984,6 +989,15 @@ public function labels($project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); + $resolver->setDefined('with_counts') + ->setAllowedTypes('with_counts', 'bool'); + + $resolver->setDefined('include_ancestor_groups') + ->setAllowedTypes('include_ancestor_groups', 'bool'); + + $resolver->setDefined('search') + ->setAllowedTypes('search', 'string'); + return $this->get($this->getProjectPath($project_id, 'labels'), $resolver->resolve($parameters)); } From 41e2bae20d8cb80a53b4708d72f494b5cc33a76c Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 15:08:14 +0100 Subject: [PATCH 067/117] Update CHANGELOG.md --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfce5c88..f4cda079 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.12.0] - 2023-10-XX * Add PHP 8.3 support -* Add support for `environment_scope` in `Project::removeVariable` +* Add support for `environment_scope` in `Projects::removeVariable` +* Add support for `filter` in `Projects::variable` * Add support for `author` in `Repositories::commits` +* Add support for additional parameters in `Projects::labels` and `Groups::labels` ## [11.11.1] - 2023-10-XX From ca38dfb9dea51912f5a79a0be9e9ac4532b59d58 Mon Sep 17 00:00:00 2001 From: Jeroen van den Enden Date: Sun, 8 Oct 2023 16:10:27 +0200 Subject: [PATCH 068/117] Add `Projects::updateProtectedBranch` method (#771) --- src/Api/AbstractApi.php | 27 +++++++++++++++++++++++++++ src/Api/Projects.php | 12 ++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index cb53f852..c7026135 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -163,6 +163,33 @@ protected function put(string $uri, array $params = [], array $headers = [], arr return ResponseMediator::getContent($response); } + /** + * @param string $uri + * @param array $params + * @param array $headers + * @param array $files + * + * @return mixed + */ + protected function patch(string $uri, array $params = [], array $headers = [], array $files = []) + { + if (0 < \count($files)) { + $builder = $this->createMultipartStreamBuilder($params, $files); + $body = self::prepareMultipartBody($builder); + $headers = self::addMultipartContentType($headers, $builder); + } else { + $body = self::prepareJsonBody($params); + + if (null !== $body) { + $headers = self::addJsonContentType($headers); + } + } + + $response = $this->client->getHttpClient()->patch(self::prepareUri($uri), $headers, $body ?? ''); + + return ResponseMediator::getContent($response); + } + /** * @param string $uri * @param string $file diff --git a/src/Api/Projects.php b/src/Api/Projects.php index b7ad32b1..e9db722f 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1546,6 +1546,18 @@ public function deleteProtectedBranch($project_id, string $branch_name) return $this->delete($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name))); } + /** + * @param int|string $project_id + * @param string $branch_name + * @param array $parameters + * + * @return mixed + */ + public function updateProtectedBranch($project_id, string $branch_name, array $parameters = []) + { + return $this->patch($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name)), $parameters); + } + /** * @param int|string $project_id * From 97301c88b50ff009851247b6454a6a07b8d651dd Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 15:10:43 +0100 Subject: [PATCH 069/117] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4cda079..9cbdc228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.12.0] - 2023-10-XX * Add PHP 8.3 support +* Add `Projects::updateProtectedBranch` method * Add support for `environment_scope` in `Projects::removeVariable` * Add support for `filter` in `Projects::variable` * Add support for `author` in `Repositories::commits` From 71d1408e488e1df53001bf14c9f7c63db2b3cd84 Mon Sep 17 00:00:00 2001 From: Luke40172 Date: Sun, 8 Oct 2023 16:12:26 +0200 Subject: [PATCH 070/117] Added method to update approval configuration (#770) Co-authored-by: Luuk Kleiweg --- src/Api/Projects.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index e9db722f..a4d1c148 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1568,6 +1568,17 @@ public function approvalsConfiguration($project_id) return $this->get('projects/'.self::encodePath($project_id).'/approvals'); } + /** + * @param int|string $project_id + * @param array $parameters + * + * @return mixed + */ + public function updateApprovalsConfiguration($project_id, array $parameters = []) + { + return $this->post('projects/'.self::encodePath($project_id).'/approvals', $parameters); + } + /** * @param int|string $project_id * From 41b94783b8517d07472410010d0ed140e592dbcf Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 15:12:39 +0100 Subject: [PATCH 071/117] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cbdc228..8313d288 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.12.0] - 2023-10-XX * Add PHP 8.3 support -* Add `Projects::updateProtectedBranch` method +* Add `Projects::updateProtectedBranch` and `Projects::updateApprovalsConfiguration` * Add support for `environment_scope` in `Projects::removeVariable` * Add support for `filter` in `Projects::variable` * Add support for `author` in `Repositories::commits` From 9266dd2bef3c11f99912b64ac872cd4e60942615 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 15:12:59 +0100 Subject: [PATCH 072/117] Release 11.11.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cd81a7f..6756237e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [11.11.1] - 2023-10-XX +## [11.11.1] - 2023-10-08 * Fixed double encoding of job name in artifacts download From 671b76e7c4ffbd006d5da30040c67495782ad954 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 15:17:31 +0100 Subject: [PATCH 073/117] Fixed Laravel package version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b9b0f578..0e3d3c45 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ $ composer require "m4tthumphrey/php-gitlab-api:^11.10" \ #### Laravel: ```bash -$ composer require "graham-campbell/gitlab:^7.2" +$ composer require "graham-campbell/gitlab:^7.1" ``` #### Symfony: From b19aea749bf9c72d0f9f8550a974f141eeb6a3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Wilko=C5=82azki?= Date: Sun, 8 Oct 2023 15:51:42 +0200 Subject: [PATCH 074/117] [11.11] Fix double encoding of job name in artifacts download (#773) * Fix double encoding of $job_name Removed call to self::encodePath, as the `job` parameter is part of a url query, which is later encoded by `QueryStringBuilder` in `AbstractApi::prepareUri` * Use `job name` with space to test url encoding --- src/Api/Jobs.php | 4 ++-- tests/Api/JobsTest.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Api/Jobs.php b/src/Api/Jobs.php index 8dcf8692..4e8f5283 100644 --- a/src/Api/Jobs.php +++ b/src/Api/Jobs.php @@ -150,7 +150,7 @@ public function artifacts($project_id, int $job_id) public function artifactsByRefName($project_id, string $ref_name, string $job_name) { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/download', [ - 'job' => self::encodePath($job_name), + 'job' => $job_name, ])->getBody(); } @@ -165,7 +165,7 @@ public function artifactsByRefName($project_id, string $ref_name, string $job_na public function artifactByRefName($project_id, string $ref_name, string $job_name, string $artifact_path) { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/raw/'.self::encodePath($artifact_path), [ - 'job' => self::encodePath($job_name), + 'job' => $job_name, ])->getBody(); } diff --git a/tests/Api/JobsTest.php b/tests/Api/JobsTest.php index 5d355b11..39acaef5 100644 --- a/tests/Api/JobsTest.php +++ b/tests/Api/JobsTest.php @@ -147,12 +147,12 @@ public function shouldGetArtifactsByRefName(): void $api->expects($this->once()) ->method('getAsResponse') ->with('projects/1/jobs/artifacts/master/download', [ - 'job' => 'job_name', + 'job' => 'job name', ]) ->will($this->returnValue($returnedStream)) ; - $this->assertEquals('foobar', $api->artifactsByRefName(1, 'master', 'job_name')->getContents()); + $this->assertEquals('foobar', $api->artifactsByRefName(1, 'master', 'job name')->getContents()); } /** @@ -165,11 +165,11 @@ public function shouldGetArtifactByRefName(): void $api->expects($this->once()) ->method('getAsResponse') ->with('projects/1/jobs/artifacts/master/raw/artifact_path', [ - 'job' => 'job_name', + 'job' => 'job name', ]) ->will($this->returnValue($returnedStream)) ; - $this->assertEquals('foobar', $api->artifactByRefName(1, 'master', 'job_name', 'artifact_path')->getContents()); + $this->assertEquals('foobar', $api->artifactByRefName(1, 'master', 'job name', 'artifact_path')->getContents()); } /** From b232aa61d9af026ea0c0a69f1a735f3ef0ed8337 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 15:18:28 +0100 Subject: [PATCH 075/117] Release 11.10.1 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6ec0255..564fdc79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.10.1] - 2023-10-08 + +* Fixed double encoding of job name in artifacts download + ## [11.10.0] - 2023-04-30 * Add support for `Packages::addGenericFile` From b0d70a6142c52407a226d940ef2d0ae96e65c7e7 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 15:28:30 +0100 Subject: [PATCH 076/117] Release 11.12.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3919fd75..2757196e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [11.12.0] - 2023-10-XX +## [11.12.0] - 2023-10-08 * Add PHP 8.3 support * Add `Projects::updateProtectedBranch` and `Projects::updateApprovalsConfiguration` From a35dea4ee9ca1317d8c32e058bb9643978eeab37 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Oct 2023 15:31:49 +0100 Subject: [PATCH 077/117] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dbc43a47..40852a35 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Check out the [change log](CHANGELOG.md), [releases](https://github.com/GitLabPH ## Installation -This version supports [PHP](https://php.net) 7.4-8.2. To get started, simply require the project using [Composer](https://getcomposer.org). You will also need to install packages that "provide" [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) and [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation). +This version supports [PHP](https://php.net) 7.4-8.3. To get started, simply require the project using [Composer](https://getcomposer.org). You will also need to install packages that "provide" [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) and [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation). ### Standard Installation From f56d415498cd0dbb95d0a06799a179ab7d513437 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 3 Dec 2023 22:16:39 +0000 Subject: [PATCH 078/117] Update SA tooling and support for `symfony/options-resolver:^7.0` --- CHANGELOG.md | 4 ++++ composer.json | 8 ++++---- phpstan.neon.dist | 1 - phpunit.xml.dist | 6 +++--- psalm-baseline.xml | 2 +- src/HttpClient/Plugin/Authentication.php | 3 ++- src/HttpClient/Plugin/ExceptionThrower.php | 2 +- vendor-bin/phpstan/composer.json | 8 ++++---- vendor-bin/phpunit/composer.json | 2 +- vendor-bin/psalm/composer.json | 2 +- 10 files changed, 21 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2757196e..171f9899 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.13.0] - UPCOMING + +* Add support for `symfony/options-resolver:^7.0` + ## [11.12.0] - 2023-10-08 * Add PHP 8.3 support diff --git a/composer.json b/composer.json index a2add51f..96efc599 100644 --- a/composer.json +++ b/composer.json @@ -29,16 +29,16 @@ "php": "^7.4.15 || ^8.0.2", "ext-json": "*", "ext-xml": "*", - "php-http/cache-plugin": "^1.8", - "php-http/client-common": "^2.7", - "php-http/discovery": "^1.19", + "php-http/cache-plugin": "^1.8.1", + "php-http/client-common": "^2.7.1", + "php-http/discovery": "^1.19.2", "php-http/httplug": "^2.4", "php-http/multipart-stream-builder": "^1.3", "psr/cache": "^1.0 || ^2.0 || ^3.0", "psr/http-client-implementation": "^1.0", "psr/http-factory-implementation": "^1.0", "psr/http-message": "^1.1 || ^2.0", - "symfony/options-resolver": "^4.4 || ^5.0 || ^6.0", + "symfony/options-resolver": "^4.4 || ^5.0 || ^6.0 || ^7.0", "symfony/polyfill-php80": "^1.26" }, "require-dev": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 892f32f8..4a745989 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -7,7 +7,6 @@ includes: rules: - Ergebnis\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule - Ergebnis\PHPStan\Rules\Expressions\NoCompactRule - - Ergebnis\PHPStan\Rules\Expressions\NoEmptyRule - Ergebnis\PHPStan\Rules\Expressions\NoEvalRule - Ergebnis\PHPStan\Rules\Files\DeclareStrictTypesRule - Ergebnis\PHPStan\Rules\Methods\PrivateInFinalClassRule diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4ac266fb..b689bdf4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,13 @@ - + ./tests - + ./src - + diff --git a/psalm-baseline.xml b/psalm-baseline.xml index ac9935de..ec73699b 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + */ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise { diff --git a/src/HttpClient/Plugin/ExceptionThrower.php b/src/HttpClient/Plugin/ExceptionThrower.php index ac9d1889..207ecaaa 100644 --- a/src/HttpClient/Plugin/ExceptionThrower.php +++ b/src/HttpClient/Plugin/ExceptionThrower.php @@ -42,7 +42,7 @@ final class ExceptionThrower implements Plugin * @param callable $next * @param callable $first * - * @return Promise + * @return Promise */ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise { diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json index 88a5f740..38f61a08 100644 --- a/vendor-bin/phpstan/composer.json +++ b/vendor-bin/phpstan/composer.json @@ -1,11 +1,11 @@ { "require": { "php": "^8.1", - "phpstan/phpstan": "1.10.3", - "phpstan/phpstan-deprecation-rules": "1.1.2", - "phpstan/phpstan-strict-rules": "1.5.0", + "phpstan/phpstan": "1.10.47", + "phpstan/phpstan-deprecation-rules": "1.1.4", + "phpstan/phpstan-strict-rules": "1.5.2", "thecodingmachine/phpstan-strict-rules": "1.0.0", - "ergebnis/phpstan-rules": "1.0.0" + "ergebnis/phpstan-rules": "2.1.0" }, "config": { "preferred-install": "dist" diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index 59819b44..ce2646eb 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -1,7 +1,7 @@ { "require": { "php": "^7.4.15 || ^8.0.2", - "phpunit/phpunit": "^9.6.3 || ^10.0.12" + "phpunit/phpunit": "^9.6.15 || ^10.5.1" }, "config": { "preferred-install": "dist" diff --git a/vendor-bin/psalm/composer.json b/vendor-bin/psalm/composer.json index 5060e693..5a8af7c0 100644 --- a/vendor-bin/psalm/composer.json +++ b/vendor-bin/psalm/composer.json @@ -1,7 +1,7 @@ { "require": { "php": "^8.1", - "psalm/phar": "5.7.6" + "psalm/phar": "5.16.0" }, "config": { "preferred-install": "dist" From b3244ef0259eba5dd775bb9ad3344804c46b6c69 Mon Sep 17 00:00:00 2001 From: Don Kidd Date: Sun, 3 Dec 2023 17:21:30 -0500 Subject: [PATCH 079/117] [11.13] Addition of Status & Environment to list of possible values (#769) * Addition of Status & Environment to list of possible values that can be sent to deployment * Fix style issue * Missed a space.. * Fix style issues * Missed something in the style * Update php doc with new additional values * Fix for style * update spaces * Missed something with the style * copy paste error --- src/Api/Deployments.php | 9 ++++++ tests/Api/DeploymentsTest.php | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/src/Api/Deployments.php b/src/Api/Deployments.php index f0fcbcc6..9af41697 100644 --- a/src/Api/Deployments.php +++ b/src/Api/Deployments.php @@ -23,6 +23,10 @@ class Deployments extends AbstractApi * @var string $order_by Return deployments ordered by id, iid, created_at, updated_at, * or ref fields (default is id) * @var string $sort Return deployments sorted in asc or desc order (default is desc) + * @var string $status Return deployments filtered by status of deployment allowed + * values of status are 'created', 'running', 'success', 'failed', + * 'canceled', 'blocked' + * @var string $environment Return deployments filtered to a particular environment * } * * @return mixed @@ -36,6 +40,11 @@ public function all($project_id, array $parameters = []) $resolver->setDefined('sort') ->setAllowedTypes('sort', 'string') ->setAllowedValues('sort', ['desc', 'asc']); + $resolver->setDefined('status') + ->setAllowedTypes('status', 'string') + ->setAllowedValues('status', ['created', 'running', 'success', 'failed', 'canceled', 'blocked']); + $resolver->setDefined('environment') + ->setAllowedTypes('environment', 'string'); return $this->get($this->getProjectPath($project_id, 'deployments'), $resolver->resolve($parameters)); } diff --git a/tests/Api/DeploymentsTest.php b/tests/Api/DeploymentsTest.php index 0f84792a..6629a592 100644 --- a/tests/Api/DeploymentsTest.php +++ b/tests/Api/DeploymentsTest.php @@ -278,4 +278,59 @@ protected function getApiClass() { return Deployments::class; } + + /** + * @test + */ + public function shouldAllowDeploymentFilterByStatus(): void + { + $expectedArray = $this->getMultipleDeploymentsData(); + + $api = $this->getMultipleDeploymentsRequestMock( + 'projects/1/deployments', + $expectedArray, + ['status' => 'success'] + ); + + $this->assertEquals( + $expectedArray, + $api->all(1, ['status' => 'success']) + ); + } + + /** + * @test + */ + public function shouldAllowFilterByEnvironment(): void + { + $expectedArray = $this->getMultipleDeploymentsData(); + + $api = $this->getMultipleDeploymentsRequestMock( + 'projects/1/deployments', + $expectedArray, + ['environment' => 'production'] + ); + + $this->assertEquals( + $expectedArray, + $api->all(1, ['environment' => 'production']) + ); + } + + /** + * @test + */ + public function shouldAllowEmptyArrayIfAllExcludedByFilter(): void + { + $expectedArray = $this->getMultipleDeploymentsData(); + + $api = $this->getMultipleDeploymentsRequestMock( + 'projects/1/deployments', + [], + ['environment' => 'test'] + ); + + $this->assertEquals([], $api->all(1, ['environment' => 'test']) + ); + } } From 89eef5058457d0d96bfa40a6f19d5139129ff984 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Sun, 3 Dec 2023 16:30:08 -0600 Subject: [PATCH 080/117] [11.13] Add support for Advanced Search API (#783) * [11.8] Added search API * Fixed lint issues * Fixed last issue with Search API * remove pagination parameters https://github.com/GitLabPHP/Client/pull/696/files#r857165665 * mark required properties * add state parameter * add newer scopes * add search endpoint to groups and projects * add missing namespaces * fix code style --------- Co-authored-by: Adrian David Castro Tenemaya --- src/Api/Groups.php | 53 +++++++++++++++++++++++++++ src/Api/Projects.php | 53 +++++++++++++++++++++++++++ src/Api/Search.php | 73 ++++++++++++++++++++++++++++++++++++++ src/Client.php | 9 +++++ tests/Api/GroupsTest.php | 32 +++++++++++++++++ tests/Api/ProjectsTest.php | 32 +++++++++++++++++ tests/Api/SearchTest.php | 57 +++++++++++++++++++++++++++++ 7 files changed, 309 insertions(+) create mode 100644 src/Api/Search.php create mode 100644 tests/Api/SearchTest.php diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 3c0ee3eb..cd961b1f 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -14,6 +14,8 @@ namespace Gitlab\Api; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -979,4 +981,55 @@ public function deleteDeployToken($group_id, int $token_id) { return $this->delete('groups/'.self::encodePath($group_id).'/deploy_tokens/'.self::encodePath($token_id)); } + + /** + * @param int|string $id + * @param array $parameters { + * + * @var string $scope The scope to search in + * @var string $search The search query + * @var string $state Filter by state. Issues and merge requests are supported; it is ignored for other scopes. + * @var bool $confidential Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. + * @var string $order_by Allowed values are created_at only. If this is not set, the results are either sorted by created_at in descending order for basic search, or by the most relevant documents when using advanced search. + * @var string $sort Return projects sorted in asc or desc order (default is desc) + * } + * + * @throws UndefinedOptionsException If an option name is undefined + * @throws InvalidOptionsException If an option doesn't fulfill the + * specified validation rules + * + * @return mixed + */ + public function search($id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + $resolver->setDefined('confidential') + ->setAllowedTypes('confidential', 'bool') + ->setNormalizer('confidential', $booleanNormalizer); + $scope = [ + 'issues', + 'merge_requests', + 'milestones', + 'projects', + 'users', + 'blobs', + 'commits', + 'notes', + 'wiki_blobs', + ]; + $resolver->setRequired('scope') + ->setAllowedValues('scope', $scope); + $resolver->setRequired('search'); + $resolver->setDefined('order_by') + ->setAllowedValues('order_by', ['created_at']); + $resolver->setDefined('sort') + ->setAllowedValues('sort', ['asc', 'desc']); + $resolver->setDefined('state') + ->setAllowedValues('state', ['opened', 'closed']); + + return $this->get('groups/'.self::encodePath($id).'/search', $resolver->resolve($parameters)); + } } diff --git a/src/Api/Projects.php b/src/Api/Projects.php index a4d1c148..1852fa02 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -1781,4 +1781,57 @@ public function deleteProtectedTag($project_id, string $tag_name) { return $this->delete($this->getProjectPath($project_id, 'protected_tags/'.self::encodePath($tag_name))); } + + /** + * @param int|string $id + * @param array $parameters { + * + * @var string $scope The scope to search in + * @var string $search The search query + * @var string $state Filter by state. Issues and merge requests are supported; it is ignored for other scopes. + * @var string $ref The name of a repository branch or tag to search on. The project’s default branch is used by default. Applicable only for scopes blobs, commits, and wiki_blobs. + * @var bool $confidential Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. + * @var string $order_by Allowed values are created_at only. If this is not set, the results are either sorted by created_at in descending order for basic search, or by the most relevant documents when using advanced search. + * @var string $sort Return projects sorted in asc or desc order (default is desc) + * } + * + * @throws UndefinedOptionsException If an option name is undefined + * @throws InvalidOptionsException If an option doesn't fulfill the + * specified validation rules + * + * @return mixed + */ + public function search($id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + $resolver->setDefined('confidential') + ->setAllowedTypes('confidential', 'bool') + ->setNormalizer('confidential', $booleanNormalizer); + $scope = [ + 'blobs', + 'commits', + 'issues', + 'merge_requests', + 'milestones', + 'notes', + 'users', + 'wiki_blobs', + ]; + $resolver->setRequired('scope') + ->setAllowedValues('scope', $scope); + $resolver->setRequired('search'); + $resolver->setDefined('ref') + ->setAllowedTypes('ref', 'string'); + $resolver->setDefined('order_by') + ->setAllowedValues('order_by', ['created_at']); + $resolver->setDefined('sort') + ->setAllowedValues('sort', ['asc', 'desc']); + $resolver->setDefined('state') + ->setAllowedValues('state', ['opened', 'closed']); + + return $this->get('projects/'.self::encodePath($id).'/search', $resolver->resolve($parameters)); + } } diff --git a/src/Api/Search.php b/src/Api/Search.php new file mode 100644 index 00000000..094b98fb --- /dev/null +++ b/src/Api/Search.php @@ -0,0 +1,73 @@ + + * (c) Graham Campbell + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Gitlab\Api; + +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; +use Symfony\Component\OptionsResolver\Options; + +class Search extends AbstractApi +{ + /** + * @param array $parameters { + * + * @var string $scope The scope to search in + * @var string $search The search query + * @var string $state Filter by state. Issues and merge requests are supported; it is ignored for other scopes. + * @var bool $confidential Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. + * @var string $order_by Allowed values are created_at only. If this is not set, the results are either sorted by created_at in descending order for basic search, or by the most relevant documents when using advanced search. + * @var string $sort Return projects sorted in asc or desc order (default is desc) + * } + * + * @throws UndefinedOptionsException If an option name is undefined + * @throws InvalidOptionsException If an option doesn't fulfill the + * specified validation rules + * + * @return mixed + */ + public function all(array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + $resolver->setDefined('confidential') + ->setAllowedTypes('confidential', 'bool') + ->setNormalizer('confidential', $booleanNormalizer); + $scope = [ + 'projects', + 'issues', + 'merge_requests', + 'milestones', + 'snippet_titles', + 'wiki_blobs', + 'commits', + 'blobs', + 'notes', + 'users', + ]; + $resolver->setRequired('scope') + ->setAllowedValues('scope', $scope); + $resolver->setRequired('search'); + $resolver->setDefined('order_by') + ->setAllowedValues('order_by', ['created_at']); + $resolver->setDefined('sort') + ->setAllowedValues('sort', ['asc', 'desc']); + $resolver->setDefined('state') + ->setAllowedValues('state', ['opened', 'closed']); + + return $this->get('search', $resolver->resolve($parameters)); + } +} diff --git a/src/Client.php b/src/Client.php index 33fd3a86..3f1a8fc6 100644 --- a/src/Client.php +++ b/src/Client.php @@ -40,6 +40,7 @@ use Gitlab\Api\ResourceStateEvents; use Gitlab\Api\ResourceWeightEvents; use Gitlab\Api\Schedules; +use Gitlab\Api\Search; use Gitlab\Api\Snippets; use Gitlab\Api\SystemHooks; use Gitlab\Api\Tags; @@ -351,6 +352,14 @@ public function repositoryFiles(): RepositoryFiles return new RepositoryFiles($this); } + /** + * @return Search + */ + public function search(): Search + { + return new Search($this); + } + /** * @return Schedules */ diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index 07f60b6f..19209bfd 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -940,4 +940,36 @@ public function shouldDeleteDeployToken(): void $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); } + + /** + * @test + */ + public function shouldSearchGroups(): void + { + $expectedArray = [ + ['id' => 6, 'name' => 'Project 6 bla'], + ['id' => 7, 'name' => 'Project 7 bla'], + ['id' => 8, 'name' => 'Project 8 bla'], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/123/search', [ + 'scope' => 'projects', + 'confidential' => 'false', + 'search' => 'bla', + 'order_by' => 'created_at', + 'sort' => 'desc', + ]) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->search(123, [ + 'scope' => 'projects', + 'confidential' => false, + 'search' => 'bla', + 'order_by' => 'created_at', + 'sort' => 'desc', + ])); + } } diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index f1d3752b..c3296d62 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -3017,4 +3017,36 @@ protected function getApiClass() { return Projects::class; } + + /** + * @test + */ + public function shouldSearchGroups(): void + { + $expectedArray = [ + ['id' => 6, 'title' => 'Issue 6 bla'], + ['id' => 7, 'title' => 'Issue 7 bla'], + ['id' => 8, 'title' => 'Issue 8 bla'], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/123/search', [ + 'scope' => 'issues', + 'confidential' => 'false', + 'search' => 'bla', + 'order_by' => 'created_at', + 'sort' => 'desc', + ]) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->search(123, [ + 'scope' => 'issues', + 'confidential' => false, + 'search' => 'bla', + 'order_by' => 'created_at', + 'sort' => 'desc', + ])); + } } diff --git a/tests/Api/SearchTest.php b/tests/Api/SearchTest.php new file mode 100644 index 00000000..e1e7c991 --- /dev/null +++ b/tests/Api/SearchTest.php @@ -0,0 +1,57 @@ + + * (c) Graham Campbell + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Gitlab\Tests\Api; + +use Gitlab\Api\Search; + +class SearchTest extends TestCase +{ + /** + * @test + */ + public function shouldGetAll(): void + { + $expectedArray = [ + ['id' => 6, 'name' => 'Project 6 bla'], + ['id' => 7, 'name' => 'Project 7 bla'], + ['id' => 8, 'name' => 'Project 8 bla'], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('search', [ + 'scope' => 'projects', + 'confidential' => 'false', + 'search' => 'bla', + 'order_by' => 'created_at', + 'sort' => 'desc', + ]) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->all([ + 'scope' => 'projects', + 'confidential' => false, + 'search' => 'bla', + 'order_by' => 'created_at', + 'sort' => 'desc', + ])); + } + + protected function getApiClass() + { + return Search::class; + } +} From fa951ebe60ae898a661a336b5f90fc4a2f205918 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 3 Dec 2023 22:40:04 +0000 Subject: [PATCH 081/117] Tweaks --- CHANGELOG.md | 2 ++ src/Api/Groups.php | 15 +++++++-------- src/Api/Projects.php | 20 +++++++++----------- src/Api/Search.php | 15 +++++++-------- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 171f9899..a2282a40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.13.0] - UPCOMING * Add support for `symfony/options-resolver:^7.0` +* Add support for `status` and `environment` in `Deployments::all` +* Add support for `Groups::search`, `Projects::search`, and `Search::all` ## [11.12.0] - 2023-10-08 diff --git a/src/Api/Groups.php b/src/Api/Groups.php index cd961b1f..5a97e0cf 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -986,17 +986,16 @@ public function deleteDeployToken($group_id, int $token_id) * @param int|string $id * @param array $parameters { * - * @var string $scope The scope to search in - * @var string $search The search query - * @var string $state Filter by state. Issues and merge requests are supported; it is ignored for other scopes. - * @var bool $confidential Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. - * @var string $order_by Allowed values are created_at only. If this is not set, the results are either sorted by created_at in descending order for basic search, or by the most relevant documents when using advanced search. - * @var string $sort Return projects sorted in asc or desc order (default is desc) + * @var string $scope The scope to search in + * @var string $search The search query + * @var string $state Filter by state. Issues and merge requests are supported; it is ignored for other scopes. + * @var bool $confidential Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. + * @var string $order_by Allowed values are created_at only. If this is not set, the results are either sorted by created_at in descending order for basic search, or by the most relevant documents when using advanced search. + * @var string $sort Return projects sorted in asc or desc order (default is desc) * } * * @throws UndefinedOptionsException If an option name is undefined - * @throws InvalidOptionsException If an option doesn't fulfill the - * specified validation rules + * @throws InvalidOptionsException If an option doesn't fulfill the specified validation rules * * @return mixed */ diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 1852fa02..d0c66833 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -53,8 +53,7 @@ class Projects extends AbstractApi * } * * @throws UndefinedOptionsException If an option name is undefined - * @throws InvalidOptionsException If an option doesn't fulfill the - * specified validation rules + * @throws InvalidOptionsException If an option doesn't fulfill the specified validation rules * * @return mixed */ @@ -1786,18 +1785,17 @@ public function deleteProtectedTag($project_id, string $tag_name) * @param int|string $id * @param array $parameters { * - * @var string $scope The scope to search in - * @var string $search The search query - * @var string $state Filter by state. Issues and merge requests are supported; it is ignored for other scopes. - * @var string $ref The name of a repository branch or tag to search on. The project’s default branch is used by default. Applicable only for scopes blobs, commits, and wiki_blobs. - * @var bool $confidential Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. - * @var string $order_by Allowed values are created_at only. If this is not set, the results are either sorted by created_at in descending order for basic search, or by the most relevant documents when using advanced search. - * @var string $sort Return projects sorted in asc or desc order (default is desc) + * @var string $scope The scope to search in + * @var string $search The search query + * @var string $state Filter by state. Issues and merge requests are supported; it is ignored for other scopes. + * @var string $ref The name of a repository branch or tag to search on. The project’s default branch is used by default. Applicable only for scopes blobs, commits, and wiki_blobs. + * @var bool $confidential Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. + * @var string $order_by Allowed values are created_at only. If this is not set, the results are either sorted by created_at in descending order for basic search, or by the most relevant documents when using advanced search. + * @var string $sort Return projects sorted in asc or desc order (default is desc) * } * * @throws UndefinedOptionsException If an option name is undefined - * @throws InvalidOptionsException If an option doesn't fulfill the - * specified validation rules + * @throws InvalidOptionsException If an option doesn't fulfill the specified validation rules * * @return mixed */ diff --git a/src/Api/Search.php b/src/Api/Search.php index 094b98fb..61d53fae 100644 --- a/src/Api/Search.php +++ b/src/Api/Search.php @@ -23,17 +23,16 @@ class Search extends AbstractApi /** * @param array $parameters { * - * @var string $scope The scope to search in - * @var string $search The search query - * @var string $state Filter by state. Issues and merge requests are supported; it is ignored for other scopes. - * @var bool $confidential Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. - * @var string $order_by Allowed values are created_at only. If this is not set, the results are either sorted by created_at in descending order for basic search, or by the most relevant documents when using advanced search. - * @var string $sort Return projects sorted in asc or desc order (default is desc) + * @var string $scope The scope to search in + * @var string $search The search query + * @var string $state Filter by state. Issues and merge requests are supported; it is ignored for other scopes. + * @var bool $confidential Filter by confidentiality. Issues scope is supported; it is ignored for other scopes. + * @var string $order_by Allowed values are created_at only. If this is not set, the results are either sorted by created_at in descending order for basic search, or by the most relevant documents when using advanced search. + * @var string $sort Return projects sorted in asc or desc order (default is desc) * } * * @throws UndefinedOptionsException If an option name is undefined - * @throws InvalidOptionsException If an option doesn't fulfill the - * specified validation rules + * @throws InvalidOptionsException If an option doesn't fulfill the specified validation rules * * @return mixed */ From 66742709f2de1e14acfd232358b4f0c1b51b43c8 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 3 Dec 2023 22:42:01 +0000 Subject: [PATCH 082/117] Release 11.13.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2282a40..4d09fbda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [11.13.0] - UPCOMING +## [11.13.0] - 2023-12-03 * Add support for `symfony/options-resolver:^7.0` * Add support for `status` and `environment` in `Deployments::all` From 3ddf538db34423f3b7dad7eebd2fa78dd3540521 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 3 Dec 2023 22:45:47 +0000 Subject: [PATCH 083/117] Prepare for 11.14 --- CHANGELOG.md | 4 ++++ README.md | 7 +++---- src/Client.php | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d09fbda..0614fae0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.14.0] - UPCOMING + +TBC + ## [11.13.0] - 2023-12-03 * Add support for `symfony/options-resolver:^7.0` diff --git a/README.md b/README.md index a7c598f5..49f7d565 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This version supports [PHP](https://php.net) 7.4-8.3. To get started, simply req ### Standard Installation ```bash -$ composer require "m4tthumphrey/php-gitlab-api:^11.13" \ +$ composer require "m4tthumphrey/php-gitlab-api:^11.14" \ "guzzlehttp/guzzle:^7.8" "http-interop/http-factory-guzzle:^1.2" ``` @@ -37,14 +37,13 @@ $ composer require "m4tthumphrey/php-gitlab-api:^11.13" \ #### Laravel: ```bash -$ composer require "graham-campbell/gitlab:^7.4" +$ composer require "graham-campbell/gitlab:^7.5" ``` #### Symfony: ```bash -$ composer require "zeichen32/gitlabapibundle:^6.0" \ - "symfony/http-client:^6.3" "nyholm/psr7:^1.8" +$ composer require "zeichen32/gitlabapibundle:^6.1" ``` We are decoupled from any HTTP messaging client by using [PSR-7](https://www.php-fig.org/psr/psr-7/), [PSR-17](https://www.php-fig.org/psr/psr-17/), [PSR-18](https://www.php-fig.org/psr/psr-18/), and [HTTPlug](https://httplug.io/). You can visit [HTTPlug for library users](https://docs.php-http.org/en/latest/httplug/users.html) to get more information about installing HTTPlug related packages. The framework integration [graham-campbell/gitlab](https://github.com/GrahamCampbell/Laravel-GitLab) is by [Graham Campbell](https://github.com/GrahamCampbell) and [zeichen32/gitlabapibundle](https://github.com/Zeichen32/GitLabApiBundle) is by [Jens Averkamp](https://github.com/Zeichen32). diff --git a/src/Client.php b/src/Client.php index 3f1a8fc6..4082f1ac 100644 --- a/src/Client.php +++ b/src/Client.php @@ -100,7 +100,7 @@ class Client * * @var string */ - private const USER_AGENT = 'gitlab-php-api-client/11.13'; + private const USER_AGENT = 'gitlab-php-api-client/11.14'; /** * The HTTP client builder. From 93f0181325591579e0dc5b758082fb4e65964b68 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 3 Dec 2023 23:01:44 +0000 Subject: [PATCH 084/117] Updated install docs for `zeichen32/gitlabapibundle` --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index a7c598f5..cb4a137c 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,7 @@ $ composer require "graham-campbell/gitlab:^7.4" #### Symfony: ```bash -$ composer require "zeichen32/gitlabapibundle:^6.0" \ - "symfony/http-client:^6.3" "nyholm/psr7:^1.8" +$ composer require "zeichen32/gitlabapibundle:^6.1" ``` We are decoupled from any HTTP messaging client by using [PSR-7](https://www.php-fig.org/psr/psr-7/), [PSR-17](https://www.php-fig.org/psr/psr-17/), [PSR-18](https://www.php-fig.org/psr/psr-18/), and [HTTPlug](https://httplug.io/). You can visit [HTTPlug for library users](https://docs.php-http.org/en/latest/httplug/users.html) to get more information about installing HTTPlug related packages. The framework integration [graham-campbell/gitlab](https://github.com/GrahamCampbell/Laravel-GitLab) is by [Graham Campbell](https://github.com/GrahamCampbell) and [zeichen32/gitlabapibundle](https://github.com/Zeichen32/GitLabApiBundle) is by [Jens Averkamp](https://github.com/Zeichen32). From dd5eecc94d30eb83ee8933a3dd4d4c6a64d62cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20T=C3=AD=C5=BEek?= Date: Sun, 17 Mar 2024 22:16:20 +0100 Subject: [PATCH 085/117] Ability to set release name (#781) User can create release with diferent name --- src/Api/Repositories.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Api/Repositories.php b/src/Api/Repositories.php index ac6f4f0f..809f556e 100644 --- a/src/Api/Repositories.php +++ b/src/Api/Repositories.php @@ -146,16 +146,18 @@ public function createTag($project_id, string $name, string $ref, ?string $messa /** * @param int|string $project_id * @param string $tag_name - * @param string $description + * @param string $description + * @param ?string $name * * @return mixed */ - public function createRelease($project_id, string $tag_name, string $description) + public function createRelease($project_id, string $tag_name, string $description, ?string $name = null) { return $this->post($this->getProjectPath($project_id, 'releases'), [ 'id' => $project_id, 'tag_name' => $tag_name, 'description' => $description, + 'name' => $name ?? $tag_name, ]); } From 7d52be14671c57547680cd3910a494873e298872 Mon Sep 17 00:00:00 2001 From: Jan Nedbal Date: Sun, 17 Mar 2024 22:18:13 +0100 Subject: [PATCH 086/117] [11.14] Update `MergeRequests::all` to use millisecond precision (#787) * MergeRequests::all: send datetimes with microsecond precision * Fix format - 2023-01-24T18:05:25.801Z works - 2023-01-24T18:05:25.801+00:00 does not work * Ensure UTC timezone is used * Adjust test * Fix typo * Fix for old PHP, improve test * Fix cs * Use some milliseconds in test --- src/Api/MergeRequests.php | 4 +++- tests/Api/MergeRequestsTest.php | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Api/MergeRequests.php b/src/Api/MergeRequests.php index ed3779f6..2bb8584a 100644 --- a/src/Api/MergeRequests.php +++ b/src/Api/MergeRequests.php @@ -74,7 +74,9 @@ public function all($project_id = null, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { - return $value->format('c'); + $utc = (new \DateTimeImmutable($value->format(\DateTimeImmutable::RFC3339_EXTENDED)))->setTimezone(new \DateTimeZone('UTC')); + + return $utc->format('Y-m-d\TH:i:s.v\Z'); }; $resolver->setDefined('iids') ->setAllowedTypes('iids', 'array') diff --git a/tests/Api/MergeRequestsTest.php b/tests/Api/MergeRequestsTest.php index ae8225bc..227b89a0 100644 --- a/tests/Api/MergeRequestsTest.php +++ b/tests/Api/MergeRequestsTest.php @@ -107,11 +107,11 @@ public function shouldGetAllWithDateTimeParams(): void $expectedArray = $this->getMultipleMergeRequestsData(); $createdAfter = new \DateTime('2018-01-01 00:00:00'); - $createdBefore = new \DateTime('2018-01-31 00:00:00'); + $createdBefore = new \DateTime('2018-01-31 12:00:00.123+03:00'); $expectedWithArray = [ - 'created_after' => $createdAfter->format(\DATE_ATOM), - 'created_before' => $createdBefore->format(\DATE_ATOM), + 'created_after' => '2018-01-01T00:00:00.000Z', + 'created_before' => '2018-01-31T09:00:00.123Z', ]; $api = $this->getApiMock(); From f6fcad69202a7396f936c0a2604d01ca543d46d2 Mon Sep 17 00:00:00 2001 From: TZK- <7808125+TZK-@users.noreply.github.com> Date: Sun, 17 Mar 2024 22:18:43 +0100 Subject: [PATCH 087/117] Fix project events not allowing approved action (#788) Co-authored-by: Thibault GRANADA --- src/Api/Projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index d0c66833..3f5d1962 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -954,7 +954,7 @@ public function events($project_id, array $parameters = []) }; $resolver->setDefined('action') - ->setAllowedValues('action', ['created', 'updated', 'closed', 'reopened', 'pushed', 'commented', 'merged', 'joined', 'left', 'destroyed', 'expired']) + ->setAllowedValues('action', ['created', 'updated', 'closed', 'reopened', 'pushed', 'commented', 'merged', 'joined', 'left', 'destroyed', 'expired', 'approved']) ; $resolver->setDefined('target_type') ->setAllowedValues('target_type', ['issue', 'milestone', 'merge_request', 'note', 'project', 'snippet', 'user']) From 26a4f3a62c0529d2304f9622b76db9a004ddd80d Mon Sep 17 00:00:00 2001 From: Wenchao Xue <94999661+wenchaoxue@users.noreply.github.com> Date: Sun, 17 Mar 2024 17:22:05 -0400 Subject: [PATCH 088/117] [11.14] Group milestones API: able to call GitLab API with addtional parameters updated_before and updated_after (#786) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * accept the parameters updated_before and updated_after (Introduced in GitLab 15.10) * add missing phpunit tests Groups Milestones (Gitlab\Tests\Api\GroupsMilestones) ✔ Should get all milestones with parameter one iids value ✔ Should get all milestones with parameter two iids values ✔ Should get all milestones with parameter state with active ✔ Should get all milestones with parameter state with closed ✔ Should get all milestones with parameter search ✔ Should get all milestones with parameter updated before ✔ Should get all milestones with parameter updated after * fix code style * remove unused variable and rename meaningful variable * Change the dataProvider function to static (deprecated in PHPUnit 10) * use DateTimeInterface instead of string for $updated_after and $updated_before update unit tests * Update GroupsMilestones.php * Update GroupsMilestonesTest.php --------- Co-authored-by: Graham Campbell --- src/Api/GroupsMilestones.php | 18 +++++- tests/Api/GroupsMilestonesTest.php | 100 +++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletion(-) diff --git a/src/Api/GroupsMilestones.php b/src/Api/GroupsMilestones.php index f870f78c..fad1c5d8 100644 --- a/src/Api/GroupsMilestones.php +++ b/src/Api/GroupsMilestones.php @@ -14,6 +14,8 @@ namespace Gitlab\Api; +use Symfony\Component\OptionsResolver\Options; + class GroupsMilestones extends AbstractApi { /** @@ -32,7 +34,9 @@ class GroupsMilestones extends AbstractApi * * @var int[] $iids return only the milestones having the given iids * @var string $state return only active or closed milestones - * @var string $search Return only milestones with a title or description matching the provided string. + * @var string $search Return only milestones with a title or description matching the provided string + * @var \DateTimeInterface $updated_after Return only milestones updated on or after the given datetime. Expected in ISO 8601 format (2019-03-15T08:00:00Z) + * @var \DateTimeInterface $updated_before Return only milestones updated on or before the given datetime. Expected in ISO 8601 format (2019-03-15T08:00:00Z) * } * * @return mixed @@ -40,6 +44,11 @@ class GroupsMilestones extends AbstractApi public function all($group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); + $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { + $utc = (new \DateTimeImmutable($value->format(\DateTimeImmutable::RFC3339_EXTENDED)))->setTimezone(new \DateTimeZone('UTC')); + + return $utc->format('Y-m-d\TH:i:s.v\Z'); + }; $resolver->setDefined('iids') ->setAllowedTypes('iids', 'array') ->setAllowedValues('iids', function (array $value) { @@ -51,6 +60,13 @@ public function all($group_id, array $parameters = []) ; $resolver->setDefined('search'); + $resolver->setDefined('updated_after') + ->setAllowedTypes('updated_after', \DateTimeInterface::class) + ->setNormalizer('updated_after', $datetimeNormalizer); + $resolver->setDefined('updated_before') + ->setAllowedTypes('updated_before', \DateTimeInterface::class) + ->setNormalizer('updated_before', $datetimeNormalizer); + return $this->get('groups/'.self::encodePath($group_id).'/milestones', $resolver->resolve($parameters)); } diff --git a/tests/Api/GroupsMilestonesTest.php b/tests/Api/GroupsMilestonesTest.php index 3dc5d7a7..9fcd80cf 100644 --- a/tests/Api/GroupsMilestonesTest.php +++ b/tests/Api/GroupsMilestonesTest.php @@ -38,6 +38,106 @@ public function shouldGetAllMilestones(): void $this->assertEquals($expectedArray, $api->all(1)); } + /** + * @test + */ + public function shouldGetAllMilestonesWithParameterOneIidsValue(): void + { + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/milestones', ['iids' => [456]]) + ; + + $api->all(1, ['iids' => [456]]); + } + + /** + * @test + */ + public function shouldGetAllMilestonesWithParameterTwoIidsValues(): void + { + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/milestones', ['iids' => [456, 789]]) + ; + + $api->all(1, ['iids' => [456, 789]]); + } + + public static function getAllMilestonesWithParameterStateDataProvider() + { + return [ + GroupsMilestones::STATE_ACTIVE => [GroupsMilestones::STATE_ACTIVE], + GroupsMilestones::STATE_CLOSED => [GroupsMilestones::STATE_CLOSED], + ]; + } + + /** + * @test + * + * @dataProvider getAllMilestonesWithParameterStateDataProvider + */ + public function shouldGetAllMilestonesWithParameterState(string $state): void + { + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/milestones', ['state' => $state]) + ; + + $api->all(1, ['state' => $state]); + } + + /** + * @test + */ + public function shouldGetAllMilestonesWithParameterSearch(): void + { + $searchValue = 'abc'; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/milestones', ['search' => $searchValue]) + ; + + $api->all(1, ['search' => $searchValue]); + } + + /** + * @test + */ + public function shouldGetAllMilestonesWithParameterUpdatedBefore(): void + { + $updatedBefore = new \DateTimeImmutable('2023-11-25T08:00:00Z'); + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/milestones', ['updated_before' => '2023-11-25T08:00:00.000Z']) + ; + + $api->all(1, ['updated_before' => $updatedBefore]); + } + + /** + * @test + */ + public function shouldGetAllMilestonesWithParameterUpdatedAfter(): void + { + $updatedAfter = new \DateTimeImmutable('2023-11-25T08:00:00Z'); + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/milestones', ['updated_after' => '2023-11-25T08:00:00.000Z']) + ; + + $api->all(1, ['updated_after' => $updatedAfter]); + } + /** * @test */ From 04d543be5b67f939e2885d24966f521594febe50 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 17 Mar 2024 21:29:48 +0000 Subject: [PATCH 089/117] Fixes --- phpstan-baseline.neon | 10 ++++++++++ psalm-baseline.xml | 12 +++++++++++- psalm.xml | 2 ++ src/Api/Repositories.php | 28 +++++++++++++++------------- vendor-bin/phpstan/composer.json | 4 ++-- vendor-bin/phpunit/composer.json | 2 +- vendor-bin/psalm/composer.json | 2 +- 7 files changed, 42 insertions(+), 18 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 34beb6de..cfeceeaf 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -20,6 +20,16 @@ parameters: count: 1 path: src/Api/AbstractApi.php + - + message: "#^PHPDoc tag @return contains generic type Http\\\\Promise\\\\Promise\\ but interface Http\\\\Promise\\\\Promise is not generic\\.$#" + count: 1 + path: src/HttpClient/Plugin/Authentication.php + + - + message: "#^PHPDoc tag @return contains generic type Http\\\\Promise\\\\Promise\\ but interface Http\\\\Promise\\\\Promise is not generic\\.$#" + count: 1 + path: src/HttpClient/Plugin/ExceptionThrower.php + - message: "#^Cannot cast mixed to string\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index ec73699b..88bf06d2 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + + + + ]]> + + + + + ]]> + + perPage]]> diff --git a/psalm.xml b/psalm.xml index 6b3b81a1..3dd74b68 100644 --- a/psalm.xml +++ b/psalm.xml @@ -6,6 +6,8 @@ xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config%20vendor/vimeo/psalm/config.xsd" errorBaseline="psalm-baseline.xml" + findUnusedBaselineEntry="true" + findUnusedCode="false" > diff --git a/src/Api/Repositories.php b/src/Api/Repositories.php index 809f556e..02305867 100644 --- a/src/Api/Repositories.php +++ b/src/Api/Repositories.php @@ -144,37 +144,39 @@ public function createTag($project_id, string $name, string $ref, ?string $messa } /** - * @param int|string $project_id - * @param string $tag_name - * @param string $description - * @param ?string $name + * @param int|string $project_id + * @param string $tag_name + * @param string $description + * @param string|null $name * * @return mixed */ public function createRelease($project_id, string $tag_name, string $description, ?string $name = null) { - return $this->post($this->getProjectPath($project_id, 'releases'), [ + return $this->post($this->getProjectPath($project_id, 'releases'), array_filter([ 'id' => $project_id, 'tag_name' => $tag_name, 'description' => $description, - 'name' => $name ?? $tag_name, - ]); + 'name' => $name, + ], fn ($v) => null !== $v)); } /** - * @param int|string $project_id - * @param string $tag_name - * @param string $description + * @param int|string $project_id + * @param string $tag_name + * @param string $description + * @param string|null $name * * @return mixed */ - public function updateRelease($project_id, string $tag_name, string $description) + public function updateRelease($project_id, string $tag_name, string $description, ?string $name = null) { - return $this->put($this->getProjectPath($project_id, 'releases/'.self::encodePath($tag_name)), [ + return $this->put($this->getProjectPath($project_id, 'releases/'.self::encodePath($tag_name)), array_filter([ 'id' => $project_id, 'tag_name' => $tag_name, 'description' => $description, - ]); + 'name' => $name, + ], fn ($v) => null !== $v)); } /** diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json index 38f61a08..95323c40 100644 --- a/vendor-bin/phpstan/composer.json +++ b/vendor-bin/phpstan/composer.json @@ -1,11 +1,11 @@ { "require": { "php": "^8.1", - "phpstan/phpstan": "1.10.47", + "phpstan/phpstan": "1.10.62", "phpstan/phpstan-deprecation-rules": "1.1.4", "phpstan/phpstan-strict-rules": "1.5.2", "thecodingmachine/phpstan-strict-rules": "1.0.0", - "ergebnis/phpstan-rules": "2.1.0" + "ergebnis/phpstan-rules": "2.2.0" }, "config": { "preferred-install": "dist" diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index ce2646eb..73f48cf4 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -1,7 +1,7 @@ { "require": { "php": "^7.4.15 || ^8.0.2", - "phpunit/phpunit": "^9.6.15 || ^10.5.1" + "phpunit/phpunit": "^9.6.17 || ^10.5.13" }, "config": { "preferred-install": "dist" diff --git a/vendor-bin/psalm/composer.json b/vendor-bin/psalm/composer.json index 5a8af7c0..d0f9668b 100644 --- a/vendor-bin/psalm/composer.json +++ b/vendor-bin/psalm/composer.json @@ -1,7 +1,7 @@ { "require": { "php": "^8.1", - "psalm/phar": "5.16.0" + "psalm/phar": "5.23.1" }, "config": { "preferred-install": "dist" From 7d1ee08a8f88f2ff26057840a965a2e9773bf79d Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 17 Mar 2024 21:30:04 +0000 Subject: [PATCH 090/117] Apply fixes from StyleCI --- src/Api/Repositories.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Api/Repositories.php b/src/Api/Repositories.php index 02305867..096f69a2 100644 --- a/src/Api/Repositories.php +++ b/src/Api/Repositories.php @@ -153,7 +153,7 @@ public function createTag($project_id, string $name, string $ref, ?string $messa */ public function createRelease($project_id, string $tag_name, string $description, ?string $name = null) { - return $this->post($this->getProjectPath($project_id, 'releases'), array_filter([ + return $this->post($this->getProjectPath($project_id, 'releases'), \array_filter([ 'id' => $project_id, 'tag_name' => $tag_name, 'description' => $description, @@ -171,7 +171,7 @@ public function createRelease($project_id, string $tag_name, string $description */ public function updateRelease($project_id, string $tag_name, string $description, ?string $name = null) { - return $this->put($this->getProjectPath($project_id, 'releases/'.self::encodePath($tag_name)), array_filter([ + return $this->put($this->getProjectPath($project_id, 'releases/'.self::encodePath($tag_name)), \array_filter([ 'id' => $project_id, 'tag_name' => $tag_name, 'description' => $description, From 869915e0031f3075e7df6ee2d595bf1ab5647921 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 17 Mar 2024 21:34:30 +0000 Subject: [PATCH 091/117] Add support for `php-http/cache-plugin:^2.0` --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 96efc599..4c7036bf 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "php": "^7.4.15 || ^8.0.2", "ext-json": "*", "ext-xml": "*", - "php-http/cache-plugin": "^1.8.1", + "php-http/cache-plugin": "^1.8.1 || ^2.0", "php-http/client-common": "^2.7.1", "php-http/discovery": "^1.19.2", "php-http/httplug": "^2.4", From fb6e5202a8d613b96207656920b8196c75116216 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 17 Mar 2024 21:34:35 +0000 Subject: [PATCH 092/117] Update release notes --- CHANGELOG.md | 6 +++++- LICENSE | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0614fae0..07f762fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [11.14.0] - UPCOMING -TBC +* Add support for `php-http/cache-plugin:^2.0` +* Add support for `'approved'` `status` in `Project::events` +* Add support for `name` in `createRelease` and `updateRelease` +* Add support for date filtering to `GroupsMilestones::all()` +* Update `MergeRequests::all` to use millisecond precision for date filters ## [11.13.0] - 2023-12-03 diff --git a/LICENSE b/LICENSE index 377b9fd7..2d9ff471 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ MIT License Copyright (c) 2012-2018 Matt Humphrey -Copyright (c) 2018-2023 Graham Campbell +Copyright (c) 2018-2024 Graham Campbell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 6b805882e1478873cc89ee62d2decf74eee2d5f2 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 17 Mar 2024 21:35:56 +0000 Subject: [PATCH 093/117] Release 11.14.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07f762fb..5cfd6319 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [11.14.0] - UPCOMING +## [11.14.0] - 2024-03-11 * Add support for `php-http/cache-plugin:^2.0` * Add support for `'approved'` `status` in `Project::events` From 16f80f265512636cb079403bf36eba86607f99fc Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 17 Mar 2024 21:37:36 +0000 Subject: [PATCH 094/117] Prep next version --- CHANGELOG.md | 4 ++++ README.md | 6 +++--- src/Client.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cfd6319..0c12b91b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [11.15.0] - UPCOMING + +* TBC + ## [11.14.0] - 2024-03-11 * Add support for `php-http/cache-plugin:^2.0` diff --git a/README.md b/README.md index 49f7d565..ac2d0e0f 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This version supports [PHP](https://php.net) 7.4-8.3. To get started, simply req ### Standard Installation ```bash -$ composer require "m4tthumphrey/php-gitlab-api:^11.14" \ +$ composer require "m4tthumphrey/php-gitlab-api:^11.15" \ "guzzlehttp/guzzle:^7.8" "http-interop/http-factory-guzzle:^1.2" ``` @@ -37,7 +37,7 @@ $ composer require "m4tthumphrey/php-gitlab-api:^11.14" \ #### Laravel: ```bash -$ composer require "graham-campbell/gitlab:^7.5" +$ composer require "graham-campbell/gitlab:^7.6" ``` #### Symfony: @@ -96,7 +96,7 @@ $builder->addPlugin($plugin); $client = new Gitlab\Client($builder); ``` -One can read more about HTTPlug plugins [here](https://docs.php-http.org/en/latest/plugins/introduction.html#how-it-works). Take a look around the [API methods](https://github.com/GitLabPHP/Client/tree/11.2/src/Api), and please feel free to report any bugs, noting our [code of conduct](.github/CODE_OF_CONDUCT.md). +One can read more about HTTPlug plugins [here](https://docs.php-http.org/en/latest/plugins/introduction.html#how-it-works). Take a look around the [API methods](https://github.com/GitLabPHP/Client/tree/11.15/src/Api), and please feel free to report any bugs, noting our [code of conduct](.github/CODE_OF_CONDUCT.md). ## Contributing diff --git a/src/Client.php b/src/Client.php index 4082f1ac..79c5ea6f 100644 --- a/src/Client.php +++ b/src/Client.php @@ -100,7 +100,7 @@ class Client * * @var string */ - private const USER_AGENT = 'gitlab-php-api-client/11.14'; + private const USER_AGENT = 'gitlab-php-api-client/11.15'; /** * The HTTP client builder. From 5ce17e106390a2220d4ac6e627a524e755077a2a Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 16:40:35 +0000 Subject: [PATCH 095/117] Working on next version --- .styleci.yml | 1 - CHANGELOG.md | 4 +- README.md | 9 ++- composer.json | 20 +++---- src/Api/AbstractApi.php | 22 +------ src/Api/Groups.php | 4 +- src/Api/Projects.php | 8 +-- src/Api/Repositories.php | 2 +- src/Client.php | 28 ++------- src/HttpClient/Builder.php | 73 +++++------------------- src/HttpClient/Plugin/Authentication.php | 13 +---- src/ResultPager.php | 22 ++----- 12 files changed, 52 insertions(+), 154 deletions(-) diff --git a/.styleci.yml b/.styleci.yml index e6e77550..87da8d09 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -16,7 +16,6 @@ enabled: disabled: - native_constant_invocation_symfony - native_function_invocation_symfony - - no_superfluous_phpdoc_tags_symfony - phpdoc_align - phpdoc_to_comment - phpdoc_var_without_name diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c12b91b..0084aebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [11.15.0] - UPCOMING +## [12.0.0] - UPCOMING -* TBC +* Drop support for PHP earlier than 8.1 ## [11.14.0] - 2024-03-11 diff --git a/README.md b/README.md index ac2d0e0f..d70e1991 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,7 @@ This version supports [PHP](https://php.net) 7.4-8.3. To get started, simply req ### Standard Installation ```bash -$ composer require "m4tthumphrey/php-gitlab-api:^11.15" \ - "guzzlehttp/guzzle:^7.8" "http-interop/http-factory-guzzle:^1.2" +$ composer require "m4tthumphrey/php-gitlab-api:^12.0" "guzzlehttp/guzzle:^7.9.2" ``` ### Framework Integration @@ -37,13 +36,13 @@ $ composer require "m4tthumphrey/php-gitlab-api:^11.15" \ #### Laravel: ```bash -$ composer require "graham-campbell/gitlab:^7.6" +$ composer require "graham-campbell/gitlab:^8.0" ``` #### Symfony: ```bash -$ composer require "zeichen32/gitlabapibundle:^6.1" +$ composer require "zeichen32/gitlabapibundle:^7.0" ``` We are decoupled from any HTTP messaging client by using [PSR-7](https://www.php-fig.org/psr/psr-7/), [PSR-17](https://www.php-fig.org/psr/psr-17/), [PSR-18](https://www.php-fig.org/psr/psr-18/), and [HTTPlug](https://httplug.io/). You can visit [HTTPlug for library users](https://docs.php-http.org/en/latest/httplug/users.html) to get more information about installing HTTPlug related packages. The framework integration [graham-campbell/gitlab](https://github.com/GrahamCampbell/Laravel-GitLab) is by [Graham Campbell](https://github.com/GrahamCampbell) and [zeichen32/gitlabapibundle](https://github.com/Zeichen32/GitLabApiBundle) is by [Jens Averkamp](https://github.com/Zeichen32). @@ -96,7 +95,7 @@ $builder->addPlugin($plugin); $client = new Gitlab\Client($builder); ``` -One can read more about HTTPlug plugins [here](https://docs.php-http.org/en/latest/plugins/introduction.html#how-it-works). Take a look around the [API methods](https://github.com/GitLabPHP/Client/tree/11.15/src/Api), and please feel free to report any bugs, noting our [code of conduct](.github/CODE_OF_CONDUCT.md). +One can read more about HTTPlug plugins [here](https://docs.php-http.org/en/latest/plugins/introduction.html#how-it-works). Take a look around the [API methods](https://github.com/GitLabPHP/Client/tree/12.0/src/Api), and please feel free to report any bugs, noting our [code of conduct](.github/CODE_OF_CONDUCT.md). ## Contributing diff --git a/composer.json b/composer.json index 4c7036bf..487fb319 100644 --- a/composer.json +++ b/composer.json @@ -26,25 +26,23 @@ } ], "require": { - "php": "^7.4.15 || ^8.0.2", + "php": "^8.1", "ext-json": "*", "ext-xml": "*", - "php-http/cache-plugin": "^1.8.1 || ^2.0", - "php-http/client-common": "^2.7.1", - "php-http/discovery": "^1.19.2", - "php-http/httplug": "^2.4", - "php-http/multipart-stream-builder": "^1.3", - "psr/cache": "^1.0 || ^2.0 || ^3.0", + "php-http/cache-plugin": "^2.0.1", + "php-http/client-common": "^2.7.2", + "php-http/discovery": "^1.20.0", + "php-http/httplug": "^2.4.1", + "php-http/multipart-stream-builder": "^1.4.2", + "psr/cache": "^2.0 || ^3.0", "psr/http-client-implementation": "^1.0", "psr/http-factory-implementation": "^1.0", "psr/http-message": "^1.1 || ^2.0", - "symfony/options-resolver": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/polyfill-php80": "^1.26" + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "guzzlehttp/guzzle": "^7.8", - "http-interop/http-factory-guzzle": "^1.2" + "guzzlehttp/guzzle": "^7.9.2" }, "autoload": { "psr-4": { diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index c7026135..33cfeb2e 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -48,30 +48,14 @@ abstract class AbstractApi */ protected const ACCESS_LEVELS = [0, 10, 20, 30, 40, 50]; - /** - * The client instance. - * - * @var Client - */ - private $client; + private readonly Client $client; - /** - * The per page parameter. - * - * @var int|null - */ - private $perPage; + private ?int $perPage; - /** - * Create a new API instance. - * - * @param Client $client - * - * @return void - */ public function __construct(Client $client) { $this->client = $client; + $this->perPage = null; } /** diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 5a97e0cf..e742d115 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -91,7 +91,7 @@ public function show($id) * * @return mixed */ - public function create(string $name, string $path, string $description = null, string $visibility = 'private', bool $lfs_enabled = null, bool $request_access_enabled = null, int $parent_id = null, int $shared_runners_minutes_limit = null) + public function create(string $name, string $path, ?string $description = null, string $visibility = 'private', ?bool $lfs_enabled = null, ?bool $request_access_enabled = null, ?int $parent_id = null, ?int $shared_runners_minutes_limit = null) { $params = [ 'name' => $name, @@ -917,7 +917,7 @@ private function getSubgroupSearchResolver() * * @return mixed */ - public function deployTokens($group_id, bool $active = null) + public function deployTokens($group_id, ?bool $active = null) { return $this->get('groups/'.self::encodePath($group_id).'/deploy_tokens', (null !== $active) ? ['active' => $active] : []); } diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 3f5d1962..9eb799a3 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -466,7 +466,7 @@ public function pipelineTestReportSummary($project_id, int $pipeline_id) * * @return mixed */ - public function createPipeline($project_id, string $commit_ref, array $variables = null) + public function createPipeline($project_id, string $commit_ref, ?array $variables = null) { $parameters = []; @@ -588,7 +588,7 @@ public function allMember($project_id, int $user_id) * * @return mixed */ - public function addMember($project_id, int $user_id, int $access_level, string $expires_at = null) + public function addMember($project_id, int $user_id, int $access_level, ?string $expires_at = null) { $params = [ 'user_id' => $user_id, @@ -609,7 +609,7 @@ public function addMember($project_id, int $user_id, int $access_level, string $ * * @return mixed */ - public function saveMember($project_id, int $user_id, int $access_level, string $expires_at = null) + public function saveMember($project_id, int $user_id, int $access_level, ?string $expires_at = null) { $params = [ 'access_level' => $access_level, @@ -868,7 +868,7 @@ public function enableDeployKey($project_id, int $key_id) * * @return mixed */ - public function deployTokens($project_id, bool $active = null) + public function deployTokens($project_id, ?bool $active = null) { return $this->get($this->getProjectPath($project_id, 'deploy_tokens'), (null !== $active) ? ['active' => $active] : []); } diff --git a/src/Api/Repositories.php b/src/Api/Repositories.php index 096f69a2..43d466f6 100644 --- a/src/Api/Repositories.php +++ b/src/Api/Repositories.php @@ -419,7 +419,7 @@ public function postCommitBuildStatus($project_id, string $sha, string $state, a * * @return mixed */ - public function compare($project_id, string $fromShaOrMaster, string $toShaOrMaster, bool $straight = false, string $fromProjectId = null) + public function compare($project_id, string $fromShaOrMaster, string $toShaOrMaster, bool $straight = false, ?string $fromProjectId = null) { $params = [ 'from' => $fromShaOrMaster, diff --git a/src/Client.php b/src/Client.php index 79c5ea6f..60a60633 100644 --- a/src/Client.php +++ b/src/Client.php @@ -100,30 +100,12 @@ class Client * * @var string */ - private const USER_AGENT = 'gitlab-php-api-client/11.15'; + private const USER_AGENT = 'gitlab-php-api-client/12.0'; - /** - * The HTTP client builder. - * - * @var Builder - */ - private $httpClientBuilder; - - /** - * The response history plugin. - * - * @var History - */ - private $responseHistory; + private readonly Builder $httpClientBuilder; + private readonly History $responseHistory; - /** - * Instantiate a new Gitlab client. - * - * @param Builder|null $httpClientBuilder - * - * @return void - */ - public function __construct(Builder $httpClientBuilder = null) + public function __construct(?Builder $httpClientBuilder = null) { $this->httpClientBuilder = $builder = $httpClientBuilder ?? new Builder(); $this->responseHistory = new History(); @@ -425,7 +407,7 @@ public function wiki(): Wiki * * @return void */ - public function authenticate(string $token, string $authMethod, string $sudo = null): void + public function authenticate(string $token, string $authMethod, ?string $sudo = null): void { $this->getHttpClientBuilder()->removePlugin(Authentication::class); $this->getHttpClientBuilder()->addPlugin(new Authentication($authMethod, $token, $sudo)); diff --git a/src/HttpClient/Builder.php b/src/HttpClient/Builder.php index 594b92cd..a51ad3c4 100644 --- a/src/HttpClient/Builder.php +++ b/src/HttpClient/Builder.php @@ -38,77 +38,34 @@ */ final class Builder { - /** - * The object that sends HTTP messages. - * - * @var ClientInterface - */ - private $httpClient; - - /** - * The HTTP request factory. - * - * @var RequestFactoryInterface - */ - private $requestFactory; - - /** - * The HTTP stream factory. - * - * @var StreamFactoryInterface - */ - private $streamFactory; - - /** - * The URI factory. - * - * @var UriFactoryInterface - */ - private $uriFactory; + private readonly ClientInterface $httpClient; + private readonly RequestFactoryInterface $requestFactory; + private readonly StreamFactoryInterface $streamFactory; + private readonly UriFactoryInterface $uriFactory; /** - * The currently registered plugins. - * * @var Plugin[] */ - private $plugins = []; + private array $plugins = []; - /** - * The cache plugin to use. - * - * This plugin is specially treated because it has to be the very last plugin. - * - * @var CachePlugin|null - */ - private $cachePlugin; + private ?CachePlugin $cachePlugin; - /** - * A HTTP client with all our plugins. - * - * @var HttpMethodsClientInterface|null - */ - private $pluginClient; + private ?HttpMethodsClientInterface $pluginClient; - /** - * Create a new http client builder instance. - * - * @param ClientInterface|null $httpClient - * @param RequestFactoryInterface|null $requestFactory - * @param StreamFactoryInterface|null $streamFactory - * @param UriFactoryInterface|null $uriFactory - * - * @return void - */ public function __construct( - ClientInterface $httpClient = null, - RequestFactoryInterface $requestFactory = null, - StreamFactoryInterface $streamFactory = null, - UriFactoryInterface $uriFactory = null + ?ClientInterface $httpClient = null, + ?RequestFactoryInterface $requestFactory = null, + ?StreamFactoryInterface $streamFactory = null, + ?UriFactoryInterface $uriFactory = null ) { $this->httpClient = $httpClient ?? Psr18ClientDiscovery::find(); $this->requestFactory = $requestFactory ?? Psr17FactoryDiscovery::findRequestFactory(); $this->streamFactory = $streamFactory ?? Psr17FactoryDiscovery::findStreamFactory(); $this->uriFactory = $uriFactory ?? Psr17FactoryDiscovery::findUriFactory(); + + $this->plugins = []; + $this->cachePlugin = null; + $this->pluginClient = null; } /** diff --git a/src/HttpClient/Plugin/Authentication.php b/src/HttpClient/Plugin/Authentication.php index 2160f5cd..512a9776 100644 --- a/src/HttpClient/Plugin/Authentication.php +++ b/src/HttpClient/Plugin/Authentication.php @@ -34,16 +34,9 @@ final class Authentication implements Plugin /** * @var array */ - private $headers; + private readonly array $headers; - /** - * @param string $method - * @param string $token - * @param string|null $sudo - * - * @return void - */ - public function __construct(string $method, string $token, string $sudo = null) + public function __construct(string $method, string $token, ?string $sudo = null) { $this->headers = self::buildHeaders($method, $token, $sudo); } @@ -77,7 +70,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl * * @return array */ - private static function buildHeaders(string $method, string $token, string $sudo = null): array + private static function buildHeaders(string $method, string $token, ?string $sudo = null): array { $headers = []; diff --git a/src/ResultPager.php b/src/ResultPager.php index 5c22d795..f587ed4d 100644 --- a/src/ResultPager.php +++ b/src/ResultPager.php @@ -38,35 +38,21 @@ final class ResultPager implements ResultPagerInterface private const PER_PAGE = 50; /** - * The client to use for pagination. - * * @var Client */ - private $client; + private readonly Client $client; /** - * The number of entries to request per page. - * * @var int */ - private $perPage; + private readonly int $perPage; /** - * The pagination result from the API. - * * @var array */ - private $pagination; + private array $pagination; - /** - * Create a new result pager instance. - * - * @param Client $client - * @param int|null $perPage - * - * @return void - */ - public function __construct(Client $client, int $perPage = null) + public function __construct(Client $client, ?int $perPage = null) { if (null !== $perPage && ($perPage < 1 || $perPage > 100)) { throw new ValueError(\sprintf('%s::__construct(): Argument #2 ($perPage) must be between 1 and 100, or null', self::class)); From 7e6f08fb8b28f2f15f99e350d2119b06bb21a569 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 23 Feb 2025 16:40:56 +0000 Subject: [PATCH 096/117] Apply fixes from StyleCI --- src/Api/AbstractApi.php | 36 ------ src/Api/DeployKeys.php | 2 - src/Api/Deployments.php | 1 - src/Api/Environments.php | 4 - src/Api/Groups.php | 34 ----- src/Api/GroupsBoards.php | 16 --- src/Api/GroupsEpics.php | 6 - src/Api/GroupsMilestones.php | 7 -- src/Api/IssueBoards.php | 16 --- src/Api/IssueLinks.php | 4 - src/Api/Issues.php | 55 -------- src/Api/IssuesStatistics.php | 7 -- src/Api/Jobs.php | 19 --- src/Api/Keys.php | 2 - src/Api/MergeRequests.php | 60 --------- src/Api/Milestones.php | 7 -- src/Api/Packages.php | 12 -- src/Api/Projects.php | 99 --------------- src/Api/Repositories.php | 46 ------- src/Api/RepositoryFiles.php | 4 - src/Api/ResourceIterationEvents.php | 3 - src/Api/ResourceLabelEvents.php | 3 - src/Api/ResourceMilestoneEvents.php | 3 - src/Api/ResourceStateEvents.php | 3 - src/Api/ResourceWeightEvents.php | 3 - src/Api/Schedules.php | 14 --- src/Api/Snippets.php | 23 ---- src/Api/SystemHooks.php | 5 - src/Api/Tags.php | 7 -- src/Api/Users.php | 70 ----------- src/Api/Wiki.php | 3 - src/Client.php | 119 ------------------ src/HttpClient/Builder.php | 24 ---- src/HttpClient/Message/ResponseMediator.php | 18 --- src/HttpClient/Plugin/Authentication.php | 8 -- src/HttpClient/Plugin/ExceptionThrower.php | 7 -- src/HttpClient/Plugin/History.php | 13 -- src/HttpClient/Util/JsonArray.php | 8 -- src/HttpClient/Util/QueryStringBuilder.php | 12 -- src/ResultPager.php | 48 ------- src/ResultPagerInterface.php | 30 ----- tests/Api/RepositoriesTest.php | 3 - tests/Api/ResourceIterationEventsTest.php | 3 - tests/Api/ResourceLabelEventsTest.php | 3 - tests/Api/ResourceMilestoneEventsTest.php | 3 - tests/Api/ResourceStateEventsTest.php | 3 - tests/Api/ResourceWeightEventsTest.php | 3 - tests/Api/TagsTest.php | 8 -- tests/Api/TestCase.php | 2 - .../Util/QueryStringBuilderTest.php | 3 - 50 files changed, 892 deletions(-) diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index 33cfeb2e..56fbe901 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -61,13 +61,9 @@ public function __construct(Client $client) /** * Send a GET request with query params and return the raw response. * - * @param string $uri - * @param array $params * @param array $headers * * @throws \Http\Client\Exception - * - * @return \Psr\Http\Message\ResponseInterface */ protected function getAsResponse(string $uri, array $params = [], array $headers = []): ResponseInterface { @@ -79,7 +75,6 @@ protected function getAsResponse(string $uri, array $params = [], array $headers } /** - * @param string $uri * @param array $params * @param array $headers * @@ -93,7 +88,6 @@ protected function get(string $uri, array $params = [], array $headers = []) } /** - * @param string $uri * @param array $params * @param array $headers * @param array $files @@ -121,7 +115,6 @@ protected function post(string $uri, array $params = [], array $headers = [], ar } /** - * @param string $uri * @param array $params * @param array $headers * @param array $files @@ -148,7 +141,6 @@ protected function put(string $uri, array $params = [], array $headers = [], arr } /** - * @param string $uri * @param array $params * @param array $headers * @param array $files @@ -175,8 +167,6 @@ protected function patch(string $uri, array $params = [], array $headers = [], a } /** - * @param string $uri - * @param string $file * @param array $headers * @param array $uriParams * @@ -197,7 +187,6 @@ protected function putFile(string $uri, string $file, array $headers = [], array } /** - * @param string $uri * @param array $params * @param array $headers * @@ -218,8 +207,6 @@ protected function delete(string $uri, array $params = [], array $headers = []) /** * @param int|string $uri - * - * @return string */ protected static function encodePath($uri): string { @@ -228,9 +215,6 @@ protected static function encodePath($uri): string /** * @param int|string $id - * @param string $uri - * - * @return string */ protected function getProjectPath($id, string $uri): string { @@ -239,8 +223,6 @@ protected function getProjectPath($id, string $uri): string /** * Create a new OptionsResolver with page and per_page options. - * - * @return OptionsResolver */ protected function createOptionsResolver(): OptionsResolver { @@ -263,11 +245,6 @@ protected function createOptionsResolver(): OptionsResolver /** * Prepare the request URI. - * - * @param string $uri - * @param array $query - * - * @return string */ private static function prepareUri(string $uri, array $query = []): string { @@ -283,8 +260,6 @@ private static function prepareUri(string $uri, array $query = []): string * * @param array $params * @param array $files - * - * @return MultipartStreamBuilder */ private function createMultipartStreamBuilder(array $params = [], array $files = []): MultipartStreamBuilder { @@ -308,10 +283,6 @@ private function createMultipartStreamBuilder(array $params = [], array $files = /** * Prepare the request multipart body. - * - * @param MultipartStreamBuilder $builder - * - * @return StreamInterface */ private static function prepareMultipartBody(MultipartStreamBuilder $builder): StreamInterface { @@ -322,7 +293,6 @@ private static function prepareMultipartBody(MultipartStreamBuilder $builder): S * Add the multipart content type to the headers if one is not already present. * * @param array $headers - * @param MultipartStreamBuilder $builder * * @return array */ @@ -337,8 +307,6 @@ private static function addMultipartContentType(array $headers, MultipartStreamB * Prepare the request JSON body. * * @param array $params - * - * @return string|null */ private static function prepareJsonBody(array $params): ?string { @@ -405,10 +373,6 @@ private static function tryFopen(string $filename, string $mode) /** * Guess the content type of the file if possible. - * - * @param string $file - * - * @return string */ private static function guessFileContentType(string $file): string { diff --git a/src/Api/DeployKeys.php b/src/Api/DeployKeys.php index 1a94e576..a86547a6 100644 --- a/src/Api/DeployKeys.php +++ b/src/Api/DeployKeys.php @@ -17,8 +17,6 @@ class DeployKeys extends AbstractApi { /** - * @param array $parameters - * * @return mixed */ public function all(array $parameters = []) diff --git a/src/Api/Deployments.php b/src/Api/Deployments.php index 9af41697..aea98d18 100644 --- a/src/Api/Deployments.php +++ b/src/Api/Deployments.php @@ -51,7 +51,6 @@ public function all($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $deployment_id * * @return mixed */ diff --git a/src/Api/Environments.php b/src/Api/Environments.php index 09cd632b..05314834 100644 --- a/src/Api/Environments.php +++ b/src/Api/Environments.php @@ -20,7 +20,6 @@ class Environments extends AbstractApi { /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -65,7 +64,6 @@ public function create($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $environment_id * * @return mixed */ @@ -76,7 +74,6 @@ public function remove($project_id, int $environment_id) /** * @param int|string $project_id - * @param int $environment_id * * @return mixed */ @@ -87,7 +84,6 @@ public function stop($project_id, int $environment_id) /** * @param int|string $project_id - * @param int $environment_id * * @return mixed */ diff --git a/src/Api/Groups.php b/src/Api/Groups.php index e742d115..164d7ca7 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -80,15 +80,6 @@ public function show($id) } /** - * @param string $name - * @param string $path - * @param string $description - * @param string $visibility - * @param bool $lfs_enabled - * @param bool $request_access_enabled - * @param int $parent_id - * @param int $shared_runners_minutes_limit - * * @return mixed */ public function create(string $name, string $path, ?string $description = null, string $visibility = 'private', ?bool $lfs_enabled = null, ?bool $request_access_enabled = null, ?int $parent_id = null, ?int $shared_runners_minutes_limit = null) @@ -111,7 +102,6 @@ public function create(string $name, string $path, ?string $description = null, /** * @param int|string $id - * @param array $params * * @return mixed */ @@ -143,7 +133,6 @@ public function transfer($group_id, $project_id) /** * @param int|string $group_id - * @param array $parameters * * @return mixed */ @@ -186,7 +175,6 @@ public function members($group_id, array $parameters = []) /** * @param int|string $group_id - * @param int $user_id * * @return mixed */ @@ -197,7 +185,6 @@ public function member($group_id, int $user_id) /** * @param int|string $group_id - * @param int $user_id * * @return mixed */ @@ -208,9 +195,6 @@ public function allMember($group_id, int $user_id) /** * @param int|string $group_id - * @param int $user_id - * @param int $access_level - * @param array $parameters * * @return mixed */ @@ -236,8 +220,6 @@ public function addMember($group_id, int $user_id, int $access_level, array $par /** * @param int|string $group_id - * @param int $user_id - * @param int $access_level * * @return mixed */ @@ -283,7 +265,6 @@ public function addShare($group_id, array $parameters = []) /** * @param int|string $group_id - * @param int $user_id * * @return mixed */ @@ -543,7 +524,6 @@ public function labels($group_id, array $parameters = []) /** * @param int|string $group_id - * @param array $params * * @return mixed */ @@ -554,8 +534,6 @@ public function addLabel($group_id, array $params) /** * @param int|string $group_id - * @param int $label_id - * @param array $params * * @return mixed */ @@ -566,7 +544,6 @@ public function updateLabel($group_id, int $label_id, array $params) /** * @param int|string $group_id - * @param int $label_id * * @return mixed */ @@ -577,7 +554,6 @@ public function removeLabel($group_id, int $label_id) /** * @param int|string $group_id - * @param array $parameters * * @return mixed */ @@ -590,7 +566,6 @@ public function variables($group_id, array $parameters = []) /** * @param int|string $group_id - * @param string $key * * @return mixed */ @@ -601,9 +576,6 @@ public function variable($group_id, string $key) /** * @param int|string $group_id - * @param string $key - * @param string $value - * @param bool|null $protected * @param array $parameters { * * @var string $masked true or false @@ -636,9 +608,6 @@ public function addVariable($group_id, string $key, string $value, ?bool $protec /** * @param int|string $group_id - * @param string $key - * @param string $value - * @param bool|null $protected * * @return mixed */ @@ -657,7 +626,6 @@ public function updateVariable($group_id, string $key, string $value, ?bool $pro /** * @param int|string $group_id - * @param string $key * * @return mixed */ @@ -913,7 +881,6 @@ private function getSubgroupSearchResolver() /** * @param int|string $group_id - * @param bool|null $active * * @return mixed */ @@ -973,7 +940,6 @@ public function createDeployToken($group_id, array $parameters = []) /** * @param int|string $group_id - * @param int $token_id * * @return mixed */ diff --git a/src/Api/GroupsBoards.php b/src/Api/GroupsBoards.php index 4a6b5232..22add21d 100644 --- a/src/Api/GroupsBoards.php +++ b/src/Api/GroupsBoards.php @@ -18,7 +18,6 @@ class GroupsBoards extends AbstractApi { /** * @param int|string|null $group_id - * @param array $parameters * * @return mixed */ @@ -33,7 +32,6 @@ public function all($group_id = null, array $parameters = []) /** * @param int|string $group_id - * @param int $board_id * * @return mixed */ @@ -44,7 +42,6 @@ public function show($group_id, int $board_id) /** * @param int|string $group_id - * @param array $params * * @return mixed */ @@ -55,8 +52,6 @@ public function create($group_id, array $params) /** * @param int|string $group_id - * @param int $board_id - * @param array $params * * @return mixed */ @@ -67,7 +62,6 @@ public function update($group_id, int $board_id, array $params) /** * @param int|string $group_id - * @param int $board_id * * @return mixed */ @@ -78,7 +72,6 @@ public function remove($group_id, int $board_id) /** * @param int|string $group_id - * @param int $board_id * * @return mixed */ @@ -89,8 +82,6 @@ public function allLists($group_id, int $board_id) /** * @param int|string $group_id - * @param int $board_id - * @param int $list_id * * @return mixed */ @@ -101,8 +92,6 @@ public function showList($group_id, int $board_id, int $list_id) /** * @param int|string $group_id - * @param int $board_id - * @param int $label_id * * @return mixed */ @@ -117,9 +106,6 @@ public function createList($group_id, int $board_id, int $label_id) /** * @param int|string $group_id - * @param int $board_id - * @param int $list_id - * @param int $position * * @return mixed */ @@ -134,8 +120,6 @@ public function updateList($group_id, int $board_id, int $list_id, int $position /** * @param int|string $group_id - * @param int $board_id - * @param int $list_id * * @return mixed */ diff --git a/src/Api/GroupsEpics.php b/src/Api/GroupsEpics.php index ec87cad8..8cd63b4a 100644 --- a/src/Api/GroupsEpics.php +++ b/src/Api/GroupsEpics.php @@ -61,7 +61,6 @@ public function all($group_id, array $parameters = []) /** * @param int|string $group_id - * @param int $epic_id * * @return mixed */ @@ -72,7 +71,6 @@ public function show($group_id, int $epic_id) /** * @param int|string $group_id - * @param array $params * * @return mixed */ @@ -83,8 +81,6 @@ public function create($group_id, array $params) /** * @param int|string $group_id - * @param int $epic_id - * @param array $params * * @return mixed */ @@ -95,7 +91,6 @@ public function update($group_id, int $epic_id, array $params) /** * @param int|string $group_id - * @param int $epic_id * * @return mixed */ @@ -106,7 +101,6 @@ public function remove($group_id, int $epic_id) /** * @param int|string $group_id - * @param int $epic_iid * * @return mixed */ diff --git a/src/Api/GroupsMilestones.php b/src/Api/GroupsMilestones.php index fad1c5d8..b01b0a0a 100644 --- a/src/Api/GroupsMilestones.php +++ b/src/Api/GroupsMilestones.php @@ -72,7 +72,6 @@ public function all($group_id, array $parameters = []) /** * @param int|string $group_id - * @param int $milestone_id * * @return mixed */ @@ -83,7 +82,6 @@ public function show($group_id, int $milestone_id) /** * @param int|string $group_id - * @param array $params * * @return mixed */ @@ -94,8 +92,6 @@ public function create($group_id, array $params) /** * @param int|string $group_id - * @param int $milestone_id - * @param array $params * * @return mixed */ @@ -106,7 +102,6 @@ public function update($group_id, int $milestone_id, array $params) /** * @param int|string $group_id - * @param int $milestone_id * * @return mixed */ @@ -117,7 +112,6 @@ public function remove($group_id, int $milestone_id) /** * @param int|string $group_id - * @param int $milestone_id * * @return mixed */ @@ -128,7 +122,6 @@ public function issues($group_id, int $milestone_id) /** * @param int|string $group_id - * @param int $milestone_id * * @return mixed */ diff --git a/src/Api/IssueBoards.php b/src/Api/IssueBoards.php index d6325a52..095e267f 100644 --- a/src/Api/IssueBoards.php +++ b/src/Api/IssueBoards.php @@ -18,7 +18,6 @@ class IssueBoards extends AbstractApi { /** * @param int|string|null $project_id - * @param array $parameters * * @return mixed */ @@ -33,7 +32,6 @@ public function all($project_id = null, array $parameters = []) /** * @param int|string $project_id - * @param int $board_id * * @return mixed */ @@ -44,7 +42,6 @@ public function show($project_id, int $board_id) /** * @param int|string $project_id - * @param array $params * * @return mixed */ @@ -55,8 +52,6 @@ public function create($project_id, array $params) /** * @param int|string $project_id - * @param int $board_id - * @param array $params * * @return mixed */ @@ -67,7 +62,6 @@ public function update($project_id, int $board_id, array $params) /** * @param int|string $project_id - * @param int $board_id * * @return mixed */ @@ -78,7 +72,6 @@ public function remove($project_id, int $board_id) /** * @param int|string $project_id - * @param int $board_id * * @return mixed */ @@ -89,8 +82,6 @@ public function allLists($project_id, int $board_id) /** * @param int|string $project_id - * @param int $board_id - * @param int $list_id * * @return mixed */ @@ -101,8 +92,6 @@ public function showList($project_id, int $board_id, int $list_id) /** * @param int|string $project_id - * @param int $board_id - * @param int $label_id * * @return mixed */ @@ -117,9 +106,6 @@ public function createList($project_id, int $board_id, int $label_id) /** * @param int|string $project_id - * @param int $board_id - * @param int $list_id - * @param int $position * * @return mixed */ @@ -134,8 +120,6 @@ public function updateList($project_id, int $board_id, int $list_id, int $positi /** * @param int|string $project_id - * @param int $board_id - * @param int $list_id * * @return mixed */ diff --git a/src/Api/IssueLinks.php b/src/Api/IssueLinks.php index c3cd68a5..04d99eca 100644 --- a/src/Api/IssueLinks.php +++ b/src/Api/IssueLinks.php @@ -18,7 +18,6 @@ class IssueLinks extends AbstractApi { /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -29,9 +28,7 @@ public function all($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid * @param int|string $target_project_id - * @param int $target_issue_iid * @param array $parameters { * * @var string $link_type @@ -49,7 +46,6 @@ public function create($project_id, int $issue_iid, $target_project_id, int $tar /** * @param int|string $project_id - * @param int $issue_iid * @param int|string $issue_link_id * @param array $parameters { * diff --git a/src/Api/Issues.php b/src/Api/Issues.php index 717cf984..76127b1b 100644 --- a/src/Api/Issues.php +++ b/src/Api/Issues.php @@ -60,7 +60,6 @@ public function all($project_id = null, array $parameters = []) /** * @param int|string $group_id - * @param array $parameters * * @return mixed */ @@ -74,7 +73,6 @@ public function group($group_id, array $parameters = []) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -85,7 +83,6 @@ public function show($project_id, int $issue_iid) /** * @param int|string $project_id - * @param array $params * * @return mixed */ @@ -96,8 +93,6 @@ public function create($project_id, array $params) /** * @param int|string $project_id - * @param int $issue_iid - * @param array $params * * @return mixed */ @@ -108,8 +103,6 @@ public function update($project_id, int $issue_iid, array $params) /** * @param int|string $project_id - * @param int $issue_iid - * @param array $params * * @return mixed */ @@ -120,7 +113,6 @@ public function reorder($project_id, int $issue_iid, array $params) /** * @param int|string $project_id - * @param int $issue_iid * @param int|string $to_project_id * * @return mixed @@ -134,7 +126,6 @@ public function move($project_id, int $issue_iid, $to_project_id) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -145,7 +136,6 @@ public function remove($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -156,8 +146,6 @@ public function showNotes($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid - * @param int $note_id * * @return mixed */ @@ -168,9 +156,6 @@ public function showNote($project_id, int $issue_iid, int $note_id) /** * @param int|string $project_id - * @param int $issue_iid - * @param string $body - * @param array $params * * @return mixed */ @@ -183,10 +168,6 @@ public function addNote($project_id, int $issue_iid, string $body, array $params /** * @param int|string $project_id - * @param int $issue_iid - * @param int $note_id - * @param string $body - * @param array $params * * @return mixed */ @@ -199,8 +180,6 @@ public function updateNote($project_id, int $issue_iid, int $note_id, string $bo /** * @param int|string $project_id - * @param int $issue_iid - * @param int $note_id * * @return mixed */ @@ -211,7 +190,6 @@ public function removeNote($project_id, int $issue_iid, int $note_id) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -222,8 +200,6 @@ public function showDiscussions($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid - * @param string $discussion_id * * @return mixed */ @@ -234,8 +210,6 @@ public function showDiscussion($project_id, int $issue_iid, string $discussion_i /** * @param int|string $project_id - * @param int $issue_iid - * @param string $body * * @return mixed */ @@ -246,9 +220,6 @@ public function addDiscussion($project_id, int $issue_iid, string $body) /** * @param int|string $project_id - * @param int $issue_iid - * @param string $discussion_id - * @param string $body * * @return mixed */ @@ -259,10 +230,6 @@ public function addDiscussionNote($project_id, int $issue_iid, string $discussio /** * @param int|string $project_id - * @param int $issue_iid - * @param string $discussion_id - * @param int $note_id - * @param string $body * * @return mixed */ @@ -275,9 +242,6 @@ public function updateDiscussionNote($project_id, int $issue_iid, string $discus /** * @param int|string $project_id - * @param int $issue_iid - * @param string $discussion_id - * @param int $note_id * * @return mixed */ @@ -288,8 +252,6 @@ public function removeDiscussionNote($project_id, int $issue_iid, string $discus /** * @param int|string $project_id - * @param int $issue_iid - * @param string $duration * * @return mixed */ @@ -300,7 +262,6 @@ public function setTimeEstimate($project_id, int $issue_iid, string $duration) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -311,8 +272,6 @@ public function resetTimeEstimate($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid - * @param string $duration * * @return mixed */ @@ -323,7 +282,6 @@ public function addSpentTime($project_id, int $issue_iid, string $duration) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -334,7 +292,6 @@ public function resetSpentTime($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -377,7 +334,6 @@ public function unsubscribe($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -388,8 +344,6 @@ public function awardEmoji($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid - * @param int $award_id * * @return mixed */ @@ -400,7 +354,6 @@ public function removeAwardEmoji($project_id, int $issue_iid, int $award_id) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -411,7 +364,6 @@ public function closedByMergeRequests($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -422,7 +374,6 @@ public function relatedMergeRequests($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -433,7 +384,6 @@ public function showParticipants($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -444,8 +394,6 @@ public function showResourceLabelEvents($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid - * @param int $resource_label_event_id * * @return mixed */ @@ -454,9 +402,6 @@ public function showResourceLabelEvent($project_id, int $issue_iid, int $resourc return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/resource_label_events/'.self::encodePath($resource_label_event_id)); } - /** - * @return OptionsResolver - */ protected function createOptionsResolver(): OptionsResolver { $resolver = parent::createOptionsResolver(); diff --git a/src/Api/IssuesStatistics.php b/src/Api/IssuesStatistics.php index 6b485e9c..d57d4a57 100644 --- a/src/Api/IssuesStatistics.php +++ b/src/Api/IssuesStatistics.php @@ -20,8 +20,6 @@ class IssuesStatistics extends AbstractApi { /** - * @param array $parameters - * * @return mixed */ public function all(array $parameters) @@ -31,7 +29,6 @@ public function all(array $parameters) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -42,7 +39,6 @@ public function project($project_id, array $parameters) /** * @param int|string $group_id - * @param array $parameters * * @return mixed */ @@ -51,9 +47,6 @@ public function group($group_id, array $parameters) return $this->get('groups/'.self::encodePath($group_id).'/issues_statistics', $this->createOptionsResolver()->resolve($parameters)); } - /** - * @return OptionsResolver - */ protected function createOptionsResolver(): OptionsResolver { $resolver = new OptionsResolver(); diff --git a/src/Api/Jobs.php b/src/Api/Jobs.php index bd318f89..aeac8919 100644 --- a/src/Api/Jobs.php +++ b/src/Api/Jobs.php @@ -78,7 +78,6 @@ public function all($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $pipeline_id * @param array $parameters { * * @var string|string[] $scope The scope of jobs to show, one or array of: created, pending, running, failed, @@ -99,7 +98,6 @@ public function pipelineJobs($project_id, int $pipeline_id, array $parameters = /** * @param int|string $project_id - * @param int $pipeline_id * @param array $parameters { * * @var string|string[] $scope The scope of bridge jobs to show, one or array of: created, pending, running, failed, @@ -121,7 +119,6 @@ public function pipelineBridges($project_id, int $pipeline_id, array $parameters /** * @param int|string $project_id - * @param int $job_id * * @return mixed */ @@ -132,7 +129,6 @@ public function show($project_id, int $job_id) /** * @param int|string $project_id - * @param int $job_id * * @return StreamInterface */ @@ -143,8 +139,6 @@ public function artifacts($project_id, int $job_id) /** * @param int|string $project_id - * @param string $ref_name - * @param string $job_name * * @return StreamInterface */ @@ -157,9 +151,6 @@ public function artifactsByRefName($project_id, string $ref_name, string $job_na /** * @param int|string $project_id - * @param string $ref_name - * @param string $job_name - * @param string $artifact_path * * @return StreamInterface */ @@ -173,7 +164,6 @@ public function artifactByRefName($project_id, string $ref_name, string $job_nam /** * @param int|string $project_id * @param int $job_id - * @param string $artifact_path * * @return StreamInterface */ @@ -184,7 +174,6 @@ public function artifactByJobId($project_id, $job_id, string $artifact_path) /** * @param int|string $project_id - * @param int $job_id * * @return mixed */ @@ -195,7 +184,6 @@ public function trace($project_id, int $job_id) /** * @param int|string $project_id - * @param int $job_id * * @return mixed */ @@ -206,7 +194,6 @@ public function cancel($project_id, int $job_id) /** * @param int|string $project_id - * @param int $job_id * * @return mixed */ @@ -217,7 +204,6 @@ public function retry($project_id, int $job_id) /** * @param int|string $project_id - * @param int $job_id * * @return mixed */ @@ -228,7 +214,6 @@ public function erase($project_id, int $job_id) /** * @param int|string $project_id - * @param int $job_id * * @return mixed */ @@ -239,7 +224,6 @@ public function keepArtifacts($project_id, int $job_id) /** * @param int|string $project_id - * @param int $job_id * * @return mixed */ @@ -248,9 +232,6 @@ public function play($project_id, int $job_id) return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/play'); } - /** - * @return OptionsResolver - */ protected function createOptionsResolver(): OptionsResolver { $allowedScopeValues = [ diff --git a/src/Api/Keys.php b/src/Api/Keys.php index 59ad6ce4..14b44b45 100644 --- a/src/Api/Keys.php +++ b/src/Api/Keys.php @@ -17,8 +17,6 @@ class Keys extends AbstractApi { /** - * @param int $id - * * @return mixed */ public function show(int $id) diff --git a/src/Api/MergeRequests.php b/src/Api/MergeRequests.php index 2bb8584a..8a511569 100644 --- a/src/Api/MergeRequests.php +++ b/src/Api/MergeRequests.php @@ -155,7 +155,6 @@ public function all($project_id = null, array $parameters = []) /** * @param int|string $project_id - * @param int $mr_iid * @param array $parameters { * * @var bool $include_diverged_commits_count Return the commits behind the target branch @@ -179,9 +178,6 @@ public function show($project_id, int $mr_iid, array $parameters = []) /** * @param int|string $project_id - * @param string $source - * @param string $target - * @param string $title * @param array $parameters { * * @var int $assignee_id the assignee id @@ -207,8 +203,6 @@ public function create($project_id, string $source, string $target, string $titl /** * @param int|string $project_id - * @param int $mr_iid - * @param array $parameters * * @return mixed */ @@ -219,8 +213,6 @@ public function update($project_id, int $mr_iid, array $parameters) /** * @param int|string $project_id - * @param int $mr_iid - * @param array $parameters * * @return mixed */ @@ -231,7 +223,6 @@ public function merge($project_id, int $mr_iid, array $parameters = []) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -242,8 +233,6 @@ public function showNotes($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid - * @param int $note_id * * @return mixed */ @@ -254,9 +243,6 @@ public function showNote($project_id, int $mr_iid, int $note_id) /** * @param int|string $project_id - * @param int $mr_iid - * @param string $body - * @param array $params * * @return mixed */ @@ -269,9 +255,6 @@ public function addNote($project_id, int $mr_iid, string $body, array $params = /** * @param int|string $project_id - * @param int $mr_iid - * @param int $note_id - * @param string $body * * @return mixed */ @@ -284,8 +267,6 @@ public function updateNote($project_id, int $mr_iid, int $note_id, string $body) /** * @param int|string $project_id - * @param int $mr_iid - * @param int $note_id * * @return mixed */ @@ -296,7 +277,6 @@ public function removeNote($project_id, int $mr_iid, int $note_id) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -307,8 +287,6 @@ public function showDiscussions($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid - * @param string $discussion_id * * @return mixed */ @@ -319,8 +297,6 @@ public function showDiscussion($project_id, int $mr_iid, string $discussion_id) /** * @param int|string $project_id - * @param int $mr_iid - * @param array $params * * @return mixed */ @@ -331,9 +307,6 @@ public function addDiscussion($project_id, int $mr_iid, array $params) /** * @param int|string $project_id - * @param int $mr_iid - * @param string $discussion_id - * @param bool $resolved * * @return mixed */ @@ -346,9 +319,6 @@ public function resolveDiscussion($project_id, int $mr_iid, string $discussion_i /** * @param int|string $project_id - * @param int $mr_iid - * @param string $discussion_id - * @param string $body * * @return mixed */ @@ -359,10 +329,6 @@ public function addDiscussionNote($project_id, int $mr_iid, string $discussion_i /** * @param int|string $project_id - * @param int $mr_iid - * @param string $discussion_id - * @param int $note_id - * @param array $params * * @return mixed */ @@ -373,9 +339,6 @@ public function updateDiscussionNote($project_id, int $mr_iid, string $discussio /** * @param int|string $project_id - * @param int $mr_iid - * @param string $discussion_id - * @param int $note_id * * @return mixed */ @@ -386,7 +349,6 @@ public function removeDiscussionNote($project_id, int $mr_iid, string $discussio /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -397,7 +359,6 @@ public function showParticipants($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -408,7 +369,6 @@ public function changes($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -419,7 +379,6 @@ public function commits($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -430,7 +389,6 @@ public function closesIssues($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -441,7 +399,6 @@ public function approvals($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -452,7 +409,6 @@ public function approve($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -463,7 +419,6 @@ public function unapprove($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -474,8 +429,6 @@ public function awardEmoji($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid - * @param int $award_id * * @return mixed */ @@ -486,8 +439,6 @@ public function removeAwardEmoji($project_id, int $mr_iid, int $award_id) /** * @param int|string $project_id - * @param int $mr_iid - * @param array $params * * @return mixed */ @@ -502,7 +453,6 @@ public function rebase($project_id, int $mr_iid, array $params = []) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -513,7 +463,6 @@ public function approvalState($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid * * @return mixed */ @@ -524,9 +473,6 @@ public function levelRules($project_id, int $mr_iid) /** * @param int|string $project_id - * @param int $mr_iid - * @param string $name - * @param int $approvals_required * @param array $parameters * * @return mixed @@ -546,10 +492,6 @@ public function createLevelRule($project_id, int $mr_iid, string $name, int $app /** * @param int|string $project_id - * @param int $mr_iid - * @param int $approval_rule_id - * @param string $name - * @param int $approvals_required * @param array $parameters * * @return mixed @@ -569,8 +511,6 @@ public function updateLevelRule($project_id, int $mr_iid, int $approval_rule_id, /** * @param int|string $project_id - * @param int $mr_iid - * @param int $approval_rule_id * * @return mixed */ diff --git a/src/Api/Milestones.php b/src/Api/Milestones.php index f7b18922..ffef1f2e 100644 --- a/src/Api/Milestones.php +++ b/src/Api/Milestones.php @@ -56,7 +56,6 @@ public function all($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $milestone_id * * @return mixed */ @@ -67,7 +66,6 @@ public function show($project_id, int $milestone_id) /** * @param int|string $project_id - * @param array $params * * @return mixed */ @@ -78,8 +76,6 @@ public function create($project_id, array $params) /** * @param int|string $project_id - * @param int $milestone_id - * @param array $params * * @return mixed */ @@ -90,7 +86,6 @@ public function update($project_id, int $milestone_id, array $params) /** * @param int|string $project_id - * @param int $milestone_id * * @return mixed */ @@ -101,7 +96,6 @@ public function remove($project_id, int $milestone_id) /** * @param int|string $project_id - * @param int $milestone_id * * @return mixed */ @@ -112,7 +106,6 @@ public function issues($project_id, int $milestone_id) /** * @param int|string $project_id - * @param int $milestone_id * * @return mixed */ diff --git a/src/Api/Packages.php b/src/Api/Packages.php index 3e77c031..65fea6d8 100644 --- a/src/Api/Packages.php +++ b/src/Api/Packages.php @@ -65,7 +65,6 @@ public function all($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $package_id * * @return mixed */ @@ -76,7 +75,6 @@ public function show($project_id, int $package_id) /** * @param int|string $project_id - * @param int $package_id * * @return mixed */ @@ -87,7 +85,6 @@ public function allFiles($project_id, int $package_id) /** * @param int|string $project_id - * @param int $package_id * * @return mixed */ @@ -98,8 +95,6 @@ public function remove($project_id, int $package_id) /** * @param int|string $project_id - * @param int $package_id - * @param int $package_file_id * * @return mixed */ @@ -112,10 +107,6 @@ public function removeFile($project_id, int $package_id, int $package_file_id) /** * @param int|string $project_id - * @param string $package_name - * @param string $package_version - * @param string $file - * @param string $status * * @return mixed */ @@ -134,9 +125,6 @@ public function addGenericFile($project_id, string $package_name, string $packag /** * @param int|string $project_id - * @param int $package_id - * - * @return string */ private function getPackagePath($project_id, int $package_id): string { diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 9eb799a3..443d2ce1 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -181,9 +181,6 @@ public function show($project_id, array $parameters = []) } /** - * @param string $name - * @param array $parameters - * * @return mixed */ public function create(string $name, array $parameters = []) @@ -194,10 +191,6 @@ public function create(string $name, array $parameters = []) } /** - * @param int $user_id - * @param string $name - * @param array $parameters - * * @return mixed */ public function createForUser(int $user_id, string $name, array $parameters = []) @@ -209,7 +202,6 @@ public function createForUser(int $user_id, string $name, array $parameters = [] /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -260,7 +252,6 @@ public function triggers($project_id) /** * @param int|string $project_id - * @param int $trigger_id * * @return mixed */ @@ -271,7 +262,6 @@ public function trigger($project_id, int $trigger_id) /** * @param int|string $project_id - * @param string $description * * @return mixed */ @@ -284,7 +274,6 @@ public function createTrigger($project_id, string $description) /** * @param int|string $project_id - * @param int $trigger_id * * @return mixed */ @@ -295,9 +284,6 @@ public function removeTrigger($project_id, int $trigger_id) /** * @param int|string $project_id - * @param string $ref - * @param string $token - * @param array $variables * * @return mixed */ @@ -311,9 +297,6 @@ public function triggerPipeline($project_id, string $ref, string $token, array $ } /** - * @param int $project_id - * @param int $runner_id - * * @return mixed */ public function disableRunner(int $project_id, int $runner_id) @@ -322,9 +305,6 @@ public function disableRunner(int $project_id, int $runner_id) } /** - * @param int $project_id - * @param int $runner_id - * * @return mixed */ public function enableRunner(int $project_id, int $runner_id) @@ -401,7 +381,6 @@ public function pipelines($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $pipeline_id * * @return mixed */ @@ -412,7 +391,6 @@ public function pipeline($project_id, int $pipeline_id) /** * @param int|string $project_id - * @param int $pipeline_id * * @return mixed */ @@ -423,7 +401,6 @@ public function pipelineJobs($project_id, int $pipeline_id) /** * @param int|string $project_id - * @param int $pipeline_id * * @return mixed */ @@ -434,7 +411,6 @@ public function pipelineVariables($project_id, int $pipeline_id) /** * @param int|string $project_id - * @param int $pipeline_id * * @return mixed */ @@ -445,7 +421,6 @@ public function pipelineTestReport($project_id, int $pipeline_id) /** * @param int|string $project_id - * @param int $pipeline_id * * @return mixed */ @@ -456,7 +431,6 @@ public function pipelineTestReportSummary($project_id, int $pipeline_id) /** * @param int|string $project_id - * @param string $commit_ref * @param array|null $variables { * * @var string $key The name of the variable @@ -481,7 +455,6 @@ public function createPipeline($project_id, string $commit_ref, ?array $variable /** * @param int|string $project_id - * @param int $pipeline_id * * @return mixed */ @@ -492,7 +465,6 @@ public function retryPipeline($project_id, int $pipeline_id) /** * @param int|string $project_id - * @param int $pipeline_id * * @return mixed */ @@ -503,7 +475,6 @@ public function cancelPipeline($project_id, int $pipeline_id) /** * @param int|string $project_id - * @param int $pipeline_id * * @return mixed */ @@ -514,7 +485,6 @@ public function deletePipeline($project_id, int $pipeline_id) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -560,7 +530,6 @@ public function members($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $user_id * * @return mixed */ @@ -571,7 +540,6 @@ public function member($project_id, int $user_id) /** * @param int|string $project_id - * @param int $user_id * * @return mixed */ @@ -582,9 +550,6 @@ public function allMember($project_id, int $user_id) /** * @param int|string $project_id - * @param int $user_id - * @param int $access_level - * @param string|null $expires_at * * @return mixed */ @@ -603,9 +568,6 @@ public function addMember($project_id, int $user_id, int $access_level, ?string /** * @param int|string $project_id - * @param int $user_id - * @param int $access_level - * @param string|null $expires_at * * @return mixed */ @@ -623,7 +585,6 @@ public function saveMember($project_id, int $user_id, int $access_level, ?string /** * @param int|string $project_id - * @param int $user_id * * @return mixed */ @@ -634,7 +595,6 @@ public function removeMember($project_id, int $user_id) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -647,7 +607,6 @@ public function hooks($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $hook_id * * @return mixed */ @@ -662,7 +621,6 @@ public function hook($project_id, int $hook_id) * See https://docs.gitlab.com/ee/api/projects.html#get-project-users for more info. * * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -677,7 +635,6 @@ public function users($project_id, array $parameters = []) * See https://docs.gitlab.com/ee/api/issues.html#list-project-issues for more info. * * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -741,7 +698,6 @@ public function iterations($project_id, array $parameters = []) * @see https://docs.gitlab.com/ee/api/discussions.html#list-project-commit-discussion-items * * @param int|string $project_id - * @param string $commit_id * * @return mixed */ @@ -752,8 +708,6 @@ public function getRepositoryCommitDiscussions($project_id, string $commit_id) /** * @param int|string $project_id - * @param string $url - * @param array $parameters * * @return mixed */ @@ -770,8 +724,6 @@ public function addHook($project_id, string $url, array $parameters = []) /** * @param int|string $project_id - * @param int $hook_id - * @param array $parameters * * @return mixed */ @@ -782,7 +734,6 @@ public function updateHook($project_id, int $hook_id, array $parameters) /** * @param int|string $project_id - * @param int $hook_id * * @return mixed */ @@ -814,7 +765,6 @@ public function deployKeys($project_id) /** * @param int|string $project_id - * @param int $key_id * * @return mixed */ @@ -825,9 +775,6 @@ public function deployKey($project_id, int $key_id) /** * @param int|string $project_id - * @param string $title - * @param string $key - * @param bool $canPush * * @return mixed */ @@ -842,7 +789,6 @@ public function addDeployKey($project_id, string $title, string $key, bool $canP /** * @param int|string $project_id - * @param int $key_id * * @return mixed */ @@ -853,7 +799,6 @@ public function deleteDeployKey($project_id, int $key_id) /** * @param int|string $project_id - * @param int $key_id * * @return mixed */ @@ -864,7 +809,6 @@ public function enableDeployKey($project_id, int $key_id) /** * @param int|string $project_id - * @param bool|null $active * * @return mixed */ @@ -924,7 +868,6 @@ public function createDeployToken($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $token_id * * @return mixed */ @@ -1002,7 +945,6 @@ public function labels($project_id, array $parameters = []) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -1013,8 +955,6 @@ public function addLabel($project_id, array $parameters) /** * @param int|string $project_id - * @param int $label_id - * @param array $parameters * * @return mixed */ @@ -1025,7 +965,6 @@ public function updateLabel($project_id, int $label_id, array $parameters) /** * @param int|string $project_id - * @param int $label_id * * @return mixed */ @@ -1190,8 +1129,6 @@ public function removeForkRelation($project_id) /** * @param int|string $project_id - * @param string $service_name - * @param array $parameters * * @return mixed */ @@ -1202,7 +1139,6 @@ public function setService($project_id, string $service_name, array $parameters /** * @param int|string $project_id - * @param string $service_name * * @return mixed */ @@ -1213,7 +1149,6 @@ public function removeService($project_id, string $service_name) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -1226,8 +1161,6 @@ public function variables($project_id, array $parameters = []) /** * @param int|string $project_id - * @param string $key - * @param array $parameters * * @return mixed */ @@ -1242,10 +1175,6 @@ public function variable($project_id, string $key, array $parameters = []) /** * @param int|string $project_id - * @param string $key - * @param string $value - * @param bool|null $protected - * @param string|null $environment_scope * @param array $parameters { * * @var string $variable_type env_var (default) or file @@ -1275,10 +1204,6 @@ public function addVariable($project_id, string $key, string $value, ?bool $prot /** * @param int|string $project_id - * @param string $key - * @param string $value - * @param bool|null $protected - * @param string|null $environment_scope * @param array $parameters { * * @var string $variable_type env_var (default) or file @@ -1307,7 +1232,6 @@ public function updateVariable($project_id, string $key, string $value, ?bool $p /** * @param int|string $project_id - * @param string $key * @param array $parameters { * * @var array $filter { @@ -1328,7 +1252,6 @@ public function removeVariable($project_id, string $key, array $parameters = []) /** * @param int|string $project_id - * @param string $file * * @return mixed */ @@ -1339,7 +1262,6 @@ public function uploadFile($project_id, string $file) /** * @param int|string $project_id - * @param string $file * * @return mixed */ @@ -1350,7 +1272,6 @@ public function uploadAvatar($project_id, string $file) /** * @param int|string $project_id - * @param array $parameters * * @return mixed * @@ -1408,7 +1329,6 @@ public function deployments($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $deployment_id * * @return mixed */ @@ -1419,7 +1339,6 @@ public function deployment($project_id, int $deployment_id) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -1469,7 +1388,6 @@ public function badges($project_id) /** * @param int|string $project_id - * @param int $badge_id * * @return mixed */ @@ -1480,7 +1398,6 @@ public function badge($project_id, int $badge_id) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -1491,7 +1408,6 @@ public function addBadge($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $badge_id * * @return mixed */ @@ -1502,8 +1418,6 @@ public function removeBadge($project_id, int $badge_id) /** * @param int|string $project_id - * @param int $badge_id - * @param array $parameters * * @return mixed */ @@ -1514,7 +1428,6 @@ public function updateBadge($project_id, int $badge_id, array $parameters = []) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -1525,7 +1438,6 @@ public function protectedBranches($project_id, array $parameters = []) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -1536,7 +1448,6 @@ public function addProtectedBranch($project_id, array $parameters = []) /** * @param int|string $project_id - * @param string $branch_name * * @return mixed */ @@ -1547,8 +1458,6 @@ public function deleteProtectedBranch($project_id, string $branch_name) /** * @param int|string $project_id - * @param string $branch_name - * @param array $parameters * * @return mixed */ @@ -1569,7 +1478,6 @@ public function approvalsConfiguration($project_id) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -1590,7 +1498,6 @@ public function approvalsRules($project_id) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -1601,8 +1508,6 @@ public function createApprovalsRule($project_id, array $parameters = []) /** * @param int|string $project_id - * @param int $approval_rule_id - * @param array $parameters * * @return mixed */ @@ -1613,7 +1518,6 @@ public function updateApprovalsRule($project_id, int $approval_rule_id, array $p /** * @param int|string $project_id - * @param int $approval_rule_id * * @return mixed */ @@ -1727,7 +1631,6 @@ public function protectedTags($project_id) /** * @param int|string $project_id - * @param string $tag_name * * @return mixed */ @@ -1738,7 +1641,6 @@ public function protectedTag($project_id, string $tag_name) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -1772,7 +1674,6 @@ public function addProtectedTag($project_id, array $parameters = []) /** * @param int|string $project_id - * @param string $tag_name * * @return mixed */ diff --git a/src/Api/Repositories.php b/src/Api/Repositories.php index 43d466f6..761c280d 100644 --- a/src/Api/Repositories.php +++ b/src/Api/Repositories.php @@ -49,7 +49,6 @@ public function branches($project_id, array $parameters = []) /** * @param int|string $project_id - * @param string $branch * * @return mixed */ @@ -60,8 +59,6 @@ public function branch($project_id, string $branch) /** * @param int|string $project_id - * @param string $branch - * @param string $ref * * @return mixed */ @@ -75,7 +72,6 @@ public function createBranch($project_id, string $branch, string $ref) /** * @param int|string $project_id - * @param string $branch * * @return mixed */ @@ -86,9 +82,6 @@ public function deleteBranch($project_id, string $branch) /** * @param int|string $project_id - * @param string $branch - * @param bool $devPush - * @param bool $devMerge * * @return mixed */ @@ -102,7 +95,6 @@ public function protectBranch($project_id, string $branch, bool $devPush = false /** * @param int|string $project_id - * @param string $branch * * @return mixed */ @@ -113,7 +105,6 @@ public function unprotectBranch($project_id, string $branch) /** * @param int|string $project_id - * @param array $parameters * * @return mixed */ @@ -128,9 +119,6 @@ public function tags($project_id, array $parameters = []) /** * @param int|string $project_id - * @param string $name - * @param string $ref - * @param string|null $message * * @return mixed */ @@ -145,9 +133,6 @@ public function createTag($project_id, string $name, string $ref, ?string $messa /** * @param int|string $project_id - * @param string $tag_name - * @param string $description - * @param string|null $name * * @return mixed */ @@ -163,9 +148,6 @@ public function createRelease($project_id, string $tag_name, string $description /** * @param int|string $project_id - * @param string $tag_name - * @param string $description - * @param string|null $name * * @return mixed */ @@ -246,7 +228,6 @@ public function commits($project_id, array $parameters = []) /** * @param int|string $project_id - * @param string $sha * * @return mixed */ @@ -257,8 +238,6 @@ public function commit($project_id, string $sha) /** * @param int|string $project_id - * @param string $sha - * @param array $parameters * * @return mixed */ @@ -339,8 +318,6 @@ public function createCommit($project_id, array $parameters = []) /** * @param int|string $project_id - * @param string $branch - * @param string $sha * * @return mixed */ @@ -353,8 +330,6 @@ public function revertCommit($project_id, string $branch, string $sha) /** * @param int|string $project_id - * @param string $sha - * @param array $parameters * * @return mixed */ @@ -370,9 +345,6 @@ public function commitComments($project_id, string $sha, array $parameters = []) /** * @param int|string $project_id - * @param string $sha - * @param string $note - * @param array $params * * @return mixed */ @@ -385,8 +357,6 @@ public function createCommitComment($project_id, string $sha, string $note, arra /** * @param int|string $project_id - * @param string $sha - * @param array $params * * @return mixed */ @@ -397,9 +367,6 @@ public function getCommitBuildStatus($project_id, string $sha, array $params = [ /** * @param int|string $project_id - * @param string $sha - * @param string $state - * @param array $params * * @return mixed */ @@ -412,10 +379,6 @@ public function postCommitBuildStatus($project_id, string $sha, string $state, a /** * @param int|string $project_id - * @param string $fromShaOrMaster - * @param string $toShaOrMaster - * @param bool $straight - * @param string|null $fromProjectId * * @return mixed */ @@ -436,7 +399,6 @@ public function compare($project_id, string $fromShaOrMaster, string $toShaOrMas /** * @param int|string $project_id - * @param string $sha * * @return mixed */ @@ -447,7 +409,6 @@ public function diff($project_id, string $sha) /** * @param int|string $project_id - * @param array $params * * @return mixed */ @@ -468,7 +429,6 @@ public function contributors($project_id) /** * @param int|string $project_id - * @param array $params * @param string $format Options: "tar.gz", "zip", "tar.bz2" and "tar" * * @return mixed @@ -480,7 +440,6 @@ public function archive($project_id, array $params = [], string $format = 'tar.g /** * @param int|string $project_id - * @param array $refs * * @return mixed */ @@ -491,8 +450,6 @@ public function mergeBase($project_id, array $refs) /** * @param int|string $project_id - * @param string $sha - * @param array $params * * @return mixed */ @@ -513,9 +470,6 @@ public function cherryPick($project_id, string $sha, array $params = []) return $this->post($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/cherry_pick'), $params); } - /** - * @return OptionsResolver - */ protected function createOptionsResolver(): OptionsResolver { $allowedTypeValues = [ diff --git a/src/Api/RepositoryFiles.php b/src/Api/RepositoryFiles.php index be94b4ee..a41513ee 100644 --- a/src/Api/RepositoryFiles.php +++ b/src/Api/RepositoryFiles.php @@ -20,8 +20,6 @@ class RepositoryFiles extends AbstractApi { /** * @param int|string $project_id - * @param string $file_path - * @param string $ref * * @return mixed */ @@ -34,8 +32,6 @@ public function getFile($project_id, string $file_path, string $ref) /** * @param int|string $project_id - * @param string $file_path - * @param string $ref * * @return mixed */ diff --git a/src/Api/ResourceIterationEvents.php b/src/Api/ResourceIterationEvents.php index 9112882b..e1537ab9 100644 --- a/src/Api/ResourceIterationEvents.php +++ b/src/Api/ResourceIterationEvents.php @@ -18,7 +18,6 @@ class ResourceIterationEvents extends AbstractApi { /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -31,8 +30,6 @@ public function all($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid - * @param int $resource_iteration_event_id * * @return mixed */ diff --git a/src/Api/ResourceLabelEvents.php b/src/Api/ResourceLabelEvents.php index d0d8cd5e..447fd0e6 100644 --- a/src/Api/ResourceLabelEvents.php +++ b/src/Api/ResourceLabelEvents.php @@ -18,7 +18,6 @@ class ResourceLabelEvents extends AbstractApi { /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -31,8 +30,6 @@ public function all($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid - * @param int $resource_label_event_id * * @return mixed */ diff --git a/src/Api/ResourceMilestoneEvents.php b/src/Api/ResourceMilestoneEvents.php index e7f2d19e..7921fee4 100644 --- a/src/Api/ResourceMilestoneEvents.php +++ b/src/Api/ResourceMilestoneEvents.php @@ -18,7 +18,6 @@ class ResourceMilestoneEvents extends AbstractApi { /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -31,8 +30,6 @@ public function all($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid - * @param int $resource_milestone_event_id * * @return mixed */ diff --git a/src/Api/ResourceStateEvents.php b/src/Api/ResourceStateEvents.php index 511d1dce..ae5042cb 100644 --- a/src/Api/ResourceStateEvents.php +++ b/src/Api/ResourceStateEvents.php @@ -18,7 +18,6 @@ class ResourceStateEvents extends AbstractApi { /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -31,8 +30,6 @@ public function all($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid - * @param int $resource_label_event_id * * @return mixed */ diff --git a/src/Api/ResourceWeightEvents.php b/src/Api/ResourceWeightEvents.php index c2bd105a..d689855c 100644 --- a/src/Api/ResourceWeightEvents.php +++ b/src/Api/ResourceWeightEvents.php @@ -18,7 +18,6 @@ class ResourceWeightEvents extends AbstractApi { /** * @param int|string $project_id - * @param int $issue_iid * * @return mixed */ @@ -31,8 +30,6 @@ public function all($project_id, int $issue_iid) /** * @param int|string $project_id - * @param int $issue_iid - * @param int $resource_label_event_id * * @return mixed */ diff --git a/src/Api/Schedules.php b/src/Api/Schedules.php index 7197a432..e6e96f81 100644 --- a/src/Api/Schedules.php +++ b/src/Api/Schedules.php @@ -18,7 +18,6 @@ class Schedules extends AbstractApi { /** * @param int|string $project_id - * @param array $params * * @return mixed */ @@ -29,7 +28,6 @@ public function create($project_id, array $params) /** * @param int|string $project_id - * @param int $schedule_id * * @return mixed */ @@ -50,8 +48,6 @@ public function showAll($project_id) /** * @param int|string $project_id - * @param int $schedule_id - * @param array $params * * @return mixed */ @@ -62,7 +58,6 @@ public function update($project_id, int $schedule_id, array $params) /** * @param int|string $project_id - * @param int $schedule_id * * @return mixed */ @@ -73,8 +68,6 @@ public function remove($project_id, int $schedule_id) /** * @param int|string $project_id - * @param int $schedule_id - * @param array $params * * @return mixed */ @@ -87,9 +80,6 @@ public function addVariable($project_id, int $schedule_id, array $params) /** * @param int|string $project_id - * @param int $schedule_id - * @param string $variable_key - * @param array $params * * @return mixed */ @@ -102,8 +92,6 @@ public function updateVariable($project_id, int $schedule_id, string $variable_k /** * @param int|string $project_id - * @param int $schedule_id - * @param string $variable_key * * @return mixed */ @@ -116,7 +104,6 @@ public function removeVariable($project_id, int $schedule_id, string $variable_k /** * @param int|string $project_id - * @param int $schedule_id * * @return mixed */ @@ -127,7 +114,6 @@ public function takeOwnership($project_id, int $schedule_id) /** * @param int|string $project_id - * @param int $schedule_id * * @return mixed */ diff --git a/src/Api/Snippets.php b/src/Api/Snippets.php index ed36b19f..58df8b7b 100644 --- a/src/Api/Snippets.php +++ b/src/Api/Snippets.php @@ -28,7 +28,6 @@ public function all($project_id) /** * @param int|string $project_id - * @param int $snippet_id * * @return mixed */ @@ -39,10 +38,6 @@ public function show($project_id, int $snippet_id) /** * @param int|string $project_id - * @param string $title - * @param string $filename - * @param string $code - * @param string $visibility * * @return mixed */ @@ -58,8 +53,6 @@ public function create($project_id, string $title, string $filename, string $cod /** * @param int|string $project_id - * @param int $snippet_id - * @param array $params * * @return mixed */ @@ -70,7 +63,6 @@ public function update($project_id, int $snippet_id, array $params) /** * @param int|string $project_id - * @param int $snippet_id * * @return mixed */ @@ -81,7 +73,6 @@ public function content($project_id, int $snippet_id) /** * @param int|string $project_id - * @param int $snippet_id * * @return mixed */ @@ -92,7 +83,6 @@ public function remove($project_id, int $snippet_id) /** * @param int|string $project_id - * @param int $snippet_id * * @return mixed */ @@ -103,8 +93,6 @@ public function showNotes($project_id, int $snippet_id) /** * @param int|string $project_id - * @param int $snippet_id - * @param int $note_id * * @return mixed */ @@ -115,9 +103,6 @@ public function showNote($project_id, int $snippet_id, int $note_id) /** * @param int|string $project_id - * @param int $snippet_id - * @param string $body - * @param array $params * * @return mixed */ @@ -130,9 +115,6 @@ public function addNote($project_id, int $snippet_id, string $body, array $param /** * @param int|string $project_id - * @param int $snippet_id - * @param int $note_id - * @param string $body * * @return mixed */ @@ -145,8 +127,6 @@ public function updateNote($project_id, int $snippet_id, int $note_id, string $b /** * @param int|string $project_id - * @param int $snippet_id - * @param int $note_id * * @return mixed */ @@ -157,7 +137,6 @@ public function removeNote($project_id, int $snippet_id, int $note_id) /** * @param int|string $project_id - * @param int $snippet_id * * @return mixed */ @@ -168,8 +147,6 @@ public function awardEmoji($project_id, int $snippet_id) /** * @param int|string $project_id - * @param int $snippet_id - * @param int $award_id * * @return mixed */ diff --git a/src/Api/SystemHooks.php b/src/Api/SystemHooks.php index fda8c92c..289f2a24 100644 --- a/src/Api/SystemHooks.php +++ b/src/Api/SystemHooks.php @@ -28,7 +28,6 @@ public function all() } /** - * @param string $url * @param array $parameters { * * @var string $token secret token to validate received payloads @@ -51,8 +50,6 @@ public function create(string $url, array $parameters = []) } /** - * @param int $id - * * @return mixed */ public function test(int $id) @@ -61,8 +58,6 @@ public function test(int $id) } /** - * @param int $id - * * @return mixed */ public function remove(int $id) diff --git a/src/Api/Tags.php b/src/Api/Tags.php index f52cd2c0..c82c1147 100644 --- a/src/Api/Tags.php +++ b/src/Api/Tags.php @@ -42,7 +42,6 @@ public function all($project_id, array $parameters = []) /** * @param int|string $project_id - * @param string $tag_name * * @return mixed */ @@ -53,7 +52,6 @@ public function show($project_id, string $tag_name) /** * @param int|string $project_id - * @param array $params * * @return mixed */ @@ -64,7 +62,6 @@ public function create($project_id, array $params = []) /** * @param int|string $project_id - * @param string $tag_name * * @return mixed */ @@ -75,8 +72,6 @@ public function remove($project_id, string $tag_name) /** * @param int|string $project_id - * @param string $tag_name - * @param array $params * * @return mixed */ @@ -87,8 +82,6 @@ public function createRelease($project_id, string $tag_name, array $params = []) /** * @param int|string $project_id - * @param string $tag_name - * @param array $params * * @return mixed */ diff --git a/src/Api/Users.php b/src/Api/Users.php index 94a9b862..e0c5e723 100644 --- a/src/Api/Users.php +++ b/src/Api/Users.php @@ -69,8 +69,6 @@ public function all(array $parameters = []) } /** - * @param int $id - * * @return mixed */ public function show(int $id) @@ -79,7 +77,6 @@ public function show(int $id) } /** - * @param int $id * @param array $parameters { * * @var string $type Filter memberships by type. Can be either Project or Namespace @@ -98,7 +95,6 @@ public function usersMemberships(int $id, array $parameters = []) } /** - * @param int $id * @param array $parameters { * * @var bool $archived limit by archived status @@ -175,7 +171,6 @@ public function usersProjects(int $id, array $parameters = []) } /** - * @param int $id * @param array $parameters { * * @var bool $archived limit by archived status @@ -265,10 +260,6 @@ public function user() } /** - * @param string $email - * @param string $password - * @param array $params - * * @return mixed */ public function create(string $email, string $password, array $params = []) @@ -280,10 +271,6 @@ public function create(string $email, string $password, array $params = []) } /** - * @param int $id - * @param array $params - * @param array $files - * * @return mixed */ public function update(int $id, array $params, array $files = []) @@ -292,7 +279,6 @@ public function update(int $id, array $params, array $files = []) } /** - * @param int $id * @param array $params { * * @var bool $hard_delete If true, contributions that would usually be moved to the ghost user are @@ -307,8 +293,6 @@ public function remove(int $id, array $params = []) } /** - * @param int $id - * * @return mixed */ public function block(int $id) @@ -317,8 +301,6 @@ public function block(int $id) } /** - * @param int $id - * * @return mixed */ public function unblock(int $id) @@ -327,8 +309,6 @@ public function unblock(int $id) } /** - * @param int $id - * * @return mixed */ public function activate(int $id) @@ -337,8 +317,6 @@ public function activate(int $id) } /** - * @param int $id - * * @return mixed */ public function deactivate(int $id) @@ -363,8 +341,6 @@ public function keys() } /** - * @param int $id - * * @return mixed */ public function key(int $id) @@ -373,9 +349,6 @@ public function key(int $id) } /** - * @param string $title - * @param string $key - * * @return mixed */ public function createKey(string $title, string $key) @@ -387,8 +360,6 @@ public function createKey(string $title, string $key) } /** - * @param int $id - * * @return mixed */ public function removeKey(int $id) @@ -397,8 +368,6 @@ public function removeKey(int $id) } /** - * @param int $user_id - * * @return mixed */ public function userKeys(int $user_id) @@ -407,9 +376,6 @@ public function userKeys(int $user_id) } /** - * @param int $user_id - * @param int $key_id - * * @return mixed */ public function userKey(int $user_id, int $key_id) @@ -418,10 +384,6 @@ public function userKey(int $user_id, int $key_id) } /** - * @param int $user_id - * @param string $title - * @param string $key - * * @return mixed */ public function createKeyForUser(int $user_id, string $title, string $key) @@ -433,9 +395,6 @@ public function createKeyForUser(int $user_id, string $title, string $key) } /** - * @param int $user_id - * @param int $key_id - * * @return mixed */ public function removeUserKey(int $user_id, int $key_id) @@ -452,8 +411,6 @@ public function emails() } /** - * @param int $id - * * @return mixed */ public function email(int $id) @@ -462,8 +419,6 @@ public function email(int $id) } /** - * @param int $user_id - * * @return mixed */ public function userEmails(int $user_id) @@ -472,10 +427,6 @@ public function userEmails(int $user_id) } /** - * @param int $user_id - * @param string $email - * @param bool $skip_confirmation - * * @return mixed */ public function createEmailForUser(int $user_id, string $email, bool $skip_confirmation = false) @@ -487,9 +438,6 @@ public function createEmailForUser(int $user_id, string $email, bool $skip_confi } /** - * @param int $user_id - * @param int $email_id - * * @return mixed */ public function removeUserEmail(int $user_id, int $email_id) @@ -498,9 +446,6 @@ public function removeUserEmail(int $user_id, int $email_id) } /** - * @param int $user_id - * @param array $params - * * @return mixed */ public function userImpersonationTokens(int $user_id, array $params = []) @@ -515,9 +460,6 @@ public function userImpersonationTokens(int $user_id, array $params = []) } /** - * @param int $user_id - * @param int $impersonation_token_id - * * @return mixed */ public function userImpersonationToken(int $user_id, int $impersonation_token_id) @@ -526,11 +468,6 @@ public function userImpersonationToken(int $user_id, int $impersonation_token_id } /** - * @param int $user_id - * @param string $name - * @param array $scopes - * @param string|null $expires_at - * * @return mixed */ public function createImpersonationToken(int $user_id, string $name, array $scopes, ?string $expires_at = null) @@ -543,9 +480,6 @@ public function createImpersonationToken(int $user_id, string $name, array $scop } /** - * @param int $user_id - * @param int $impersonation_token_id - * * @return mixed */ public function removeImpersonationToken(int $user_id, int $impersonation_token_id) @@ -554,7 +488,6 @@ public function removeImpersonationToken(int $user_id, int $impersonation_token_ } /** - * @param int $user_id * @param array $parameters { * * @var string $action include only events of a particular action type @@ -596,9 +529,6 @@ public function events(int $user_id, array $parameters = []) /** * Deletes a user’s authentication identity using the provider name associated with that identity. * - * @param int $user_id - * @param string $provider - * * @return mixed */ public function removeUserIdentity(int $user_id, string $provider) diff --git a/src/Api/Wiki.php b/src/Api/Wiki.php index e89a4b14..7dcb0827 100644 --- a/src/Api/Wiki.php +++ b/src/Api/Wiki.php @@ -29,7 +29,6 @@ public function create($project_id, array $params) /** * @param int|string $project_id - * @param string $wiki_slug * * @return mixed */ @@ -58,7 +57,6 @@ public function showAll($project_id, array $params) /** * @param int|string $project_id - * @param string $wiki_slug * @param array $params * * @return mixed @@ -70,7 +68,6 @@ public function update($project_id, string $wiki_slug, array $params) /** * @param int|string $project_id - * @param string $wiki_slug * * @return mixed */ diff --git a/src/Client.php b/src/Client.php index 60a60633..ee4ff8a7 100644 --- a/src/Client.php +++ b/src/Client.php @@ -122,10 +122,6 @@ public function __construct(?Builder $httpClientBuilder = null) /** * Create a Gitlab\Client using an HTTP client. - * - * @param ClientInterface $httpClient - * - * @return Client */ public static function createWithHttpClient(ClientInterface $httpClient): self { @@ -134,265 +130,166 @@ public static function createWithHttpClient(ClientInterface $httpClient): self return new self($builder); } - /** - * @return DeployKeys - */ public function deployKeys(): DeployKeys { return new DeployKeys($this); } - /** - * @return Deployments - */ public function deployments(): Deployments { return new Deployments($this); } - /** - * @return Environments - */ public function environments(): Environments { return new Environments($this); } - /** - * @return Events - */ public function events(): Events { return new Events($this); } - /** - * @return Groups - */ public function groups(): Groups { return new Groups($this); } - /** - * @return GroupsBoards - */ public function groupsBoards(): GroupsBoards { return new GroupsBoards($this); } - /** - * @return GroupsEpics - */ public function groupsEpics(): GroupsEpics { return new GroupsEpics($this); } - /** - * @return GroupsMilestones - */ public function groupsMilestones(): GroupsMilestones { return new GroupsMilestones($this); } - /** - * @return IssueBoards - */ public function issueBoards(): IssueBoards { return new IssueBoards($this); } - /** - * @return IssueLinks - */ public function issueLinks(): IssueLinks { return new IssueLinks($this); } - /** - * @return Issues - */ public function issues(): Issues { return new Issues($this); } - /** - * @return ResourceIterationEvents - */ public function resourceIterationEvents(): ResourceIterationEvents { return new ResourceIterationEvents($this); } - /** - * @return ResourceLabelEvents - */ public function resourceLabelEvents(): ResourceLabelEvents { return new ResourceLabelEvents($this); } - /** - * @return ResourceMilestoneEvents - */ public function resourceMilestoneEvents(): ResourceMilestoneEvents { return new ResourceMilestoneEvents($this); } - /** - * @return ResourceStateEvents - */ public function resourceStateEvents(): ResourceStateEvents { return new ResourceStateEvents($this); } - /** - * @return ResourceWeightEvents - */ public function resourceWeightEvents(): ResourceWeightEvents { return new ResourceWeightEvents($this); } - /** - * @return IssuesStatistics - */ public function issuesStatistics(): IssuesStatistics { return new IssuesStatistics($this); } - /** - * @return Jobs - */ public function jobs(): Jobs { return new Jobs($this); } - /** - * @return Keys - */ public function keys(): Keys { return new Keys($this); } - /** - * @return MergeRequests - */ public function mergeRequests(): MergeRequests { return new MergeRequests($this); } - /** - * @return Milestones - */ public function milestones(): Milestones { return new Milestones($this); } - /** - * @return ProjectNamespaces - */ public function namespaces(): ProjectNamespaces { return new ProjectNamespaces($this); } - /** - * @return Projects - */ public function projects(): Projects { return new Projects($this); } - /** - * @return Repositories - */ public function repositories(): Repositories { return new Repositories($this); } - /** - * @return RepositoryFiles - */ public function repositoryFiles(): RepositoryFiles { return new RepositoryFiles($this); } - /** - * @return Search - */ public function search(): Search { return new Search($this); } - /** - * @return Schedules - */ public function schedules(): Schedules { return new Schedules($this); } - /** - * @return Snippets - */ public function snippets(): Snippets { return new Snippets($this); } - /** - * @return SystemHooks - */ public function systemHooks(): SystemHooks { return new SystemHooks($this); } - /** - * @return Tags - */ public function tags(): Tags { return new Tags($this); } - /** - * @return Users - */ public function users(): Users { return new Users($this); } - /** - * @return Version - */ public function version(): Version { return new Version($this); } - /** - * @return Wiki - */ public function wiki(): Wiki { return new Wiki($this); @@ -403,9 +300,6 @@ public function wiki(): Wiki * * @param string $token Gitlab private token * @param string $authMethod One of the AUTH_* class constants - * @param string|null $sudo - * - * @return void */ public function authenticate(string $token, string $authMethod, ?string $sudo = null): void { @@ -413,11 +307,6 @@ public function authenticate(string $token, string $authMethod, ?string $sudo = $this->getHttpClientBuilder()->addPlugin(new Authentication($authMethod, $token, $sudo)); } - /** - * @param string $url - * - * @return void - */ public function setUrl(string $url): void { $uri = $this->getHttpClientBuilder()->getUriFactory()->createUri($url); @@ -428,8 +317,6 @@ public function setUrl(string $url): void /** * Get the last response. - * - * @return ResponseInterface|null */ public function getLastResponse(): ?ResponseInterface { @@ -438,8 +325,6 @@ public function getLastResponse(): ?ResponseInterface /** * Get the HTTP client. - * - * @return HttpMethodsClientInterface */ public function getHttpClient(): HttpMethodsClientInterface { @@ -448,8 +333,6 @@ public function getHttpClient(): HttpMethodsClientInterface /** * Get the stream factory. - * - * @return StreamFactoryInterface */ public function getStreamFactory(): StreamFactoryInterface { @@ -458,8 +341,6 @@ public function getStreamFactory(): StreamFactoryInterface /** * Get the HTTP client builder. - * - * @return Builder */ protected function getHttpClientBuilder(): Builder { diff --git a/src/HttpClient/Builder.php b/src/HttpClient/Builder.php index a51ad3c4..e94248f5 100644 --- a/src/HttpClient/Builder.php +++ b/src/HttpClient/Builder.php @@ -68,9 +68,6 @@ public function __construct( $this->pluginClient = null; } - /** - * @return HttpMethodsClientInterface - */ public function getHttpClient(): HttpMethodsClientInterface { if (null === $this->pluginClient) { @@ -91,8 +88,6 @@ public function getHttpClient(): HttpMethodsClientInterface /** * Get the request factory. - * - * @return RequestFactoryInterface */ public function getRequestFactory(): RequestFactoryInterface { @@ -101,8 +96,6 @@ public function getRequestFactory(): RequestFactoryInterface /** * Get the stream factory. - * - * @return StreamFactoryInterface */ public function getStreamFactory(): StreamFactoryInterface { @@ -111,8 +104,6 @@ public function getStreamFactory(): StreamFactoryInterface /** * Get the URI factory. - * - * @return UriFactoryInterface */ public function getUriFactory(): UriFactoryInterface { @@ -121,10 +112,6 @@ public function getUriFactory(): UriFactoryInterface /** * Add a new plugin to the end of the plugin chain. - * - * @param Plugin $plugin - * - * @return void */ public function addPlugin(Plugin $plugin): void { @@ -134,10 +121,6 @@ public function addPlugin(Plugin $plugin): void /** * Remove a plugin by its fully qualified class name (FQCN). - * - * @param string $fqcn - * - * @return void */ public function removePlugin(string $fqcn): void { @@ -151,11 +134,6 @@ public function removePlugin(string $fqcn): void /** * Add a cache plugin to cache responses locally. - * - * @param CacheItemPoolInterface $cachePool - * @param array $config - * - * @return void */ public function addCache(CacheItemPoolInterface $cachePool, array $config = []): void { @@ -169,8 +147,6 @@ public function addCache(CacheItemPoolInterface $cachePool, array $config = []): /** * Remove the cache plugin. - * - * @return void */ public function removeCache(): void { diff --git a/src/HttpClient/Message/ResponseMediator.php b/src/HttpClient/Message/ResponseMediator.php index f0560335..466111bd 100644 --- a/src/HttpClient/Message/ResponseMediator.php +++ b/src/HttpClient/Message/ResponseMediator.php @@ -54,8 +54,6 @@ final class ResponseMediator /** * Return the response body as a string or JSON array if content type is JSON. * - * @param ResponseInterface $response - * * @return array|string */ public static function getContent(ResponseInterface $response) @@ -72,8 +70,6 @@ public static function getContent(ResponseInterface $response) /** * Extract pagination URIs from Link header. * - * @param ResponseInterface $response - * * @return array */ public static function getPagination(ResponseInterface $response): array @@ -99,11 +95,6 @@ public static function getPagination(ResponseInterface $response): array /** * Get the value for a single header. - * - * @param ResponseInterface $response - * @param string $name - * - * @return string|null */ private static function getHeader(ResponseInterface $response, string $name): ?string { @@ -114,10 +105,6 @@ private static function getHeader(ResponseInterface $response, string $name): ?s /** * Get the error message from the response if present. - * - * @param ResponseInterface $response - * - * @return string|null */ public static function getErrorMessage(ResponseInterface $response): ?string { @@ -162,11 +149,6 @@ public static function getErrorMessage(ResponseInterface $response): ?string return null; } - /** - * @param array $message - * - * @return string - */ private static function getMessageAsString(array $message): string { $format = '"%s" %s'; diff --git a/src/HttpClient/Plugin/Authentication.php b/src/HttpClient/Plugin/Authentication.php index 512a9776..148a523f 100644 --- a/src/HttpClient/Plugin/Authentication.php +++ b/src/HttpClient/Plugin/Authentication.php @@ -44,10 +44,6 @@ public function __construct(string $method, string $token, ?string $sudo = null) /** * Handle the request and return the response coming from the next callable. * - * @param RequestInterface $request - * @param callable $next - * @param callable $first - * * @return Promise */ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise @@ -62,10 +58,6 @@ public function handleRequest(RequestInterface $request, callable $next, callabl /** * Build the headers to be attached to the request. * - * @param string $method - * @param string $token - * @param string|null $sudo - * * @throws RuntimeException * * @return array diff --git a/src/HttpClient/Plugin/ExceptionThrower.php b/src/HttpClient/Plugin/ExceptionThrower.php index 207ecaaa..d8d76caa 100644 --- a/src/HttpClient/Plugin/ExceptionThrower.php +++ b/src/HttpClient/Plugin/ExceptionThrower.php @@ -38,10 +38,6 @@ final class ExceptionThrower implements Plugin /** * Handle the request and return the response coming from the next callable. * - * @param RequestInterface $request - * @param callable $next - * @param callable $first - * * @return Promise */ public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise @@ -60,9 +56,6 @@ public function handleRequest(RequestInterface $request, callable $next, callabl /** * Create an exception from a status code and error message. * - * @param int $status - * @param string $message - * * @return ErrorException|RuntimeException */ private static function createException(int $status, string $message): ExceptionInterface diff --git a/src/HttpClient/Plugin/History.php b/src/HttpClient/Plugin/History.php index 37a58d89..49fd6eaf 100644 --- a/src/HttpClient/Plugin/History.php +++ b/src/HttpClient/Plugin/History.php @@ -33,9 +33,6 @@ final class History implements Journal */ private $lastResponse; - /** - * @return ResponseInterface|null - */ public function getLastResponse(): ?ResponseInterface { return $this->lastResponse; @@ -43,11 +40,6 @@ public function getLastResponse(): ?ResponseInterface /** * Record a successful call. - * - * @param RequestInterface $request - * @param ResponseInterface $response - * - * @return void */ public function addSuccess(RequestInterface $request, ResponseInterface $response): void { @@ -56,11 +48,6 @@ public function addSuccess(RequestInterface $request, ResponseInterface $respons /** * Record a failed call. - * - * @param RequestInterface $request - * @param ClientExceptionInterface $exception - * - * @return void */ public function addFailure(RequestInterface $request, ClientExceptionInterface $exception): void { diff --git a/src/HttpClient/Util/JsonArray.php b/src/HttpClient/Util/JsonArray.php index 4cc5a321..59a9c49f 100644 --- a/src/HttpClient/Util/JsonArray.php +++ b/src/HttpClient/Util/JsonArray.php @@ -24,11 +24,7 @@ final class JsonArray /** * Decode a JSON string into a PHP array. * - * @param string $json - * * @throws RuntimeException - * - * @return array */ public static function decode(string $json): array { @@ -49,11 +45,7 @@ public static function decode(string $json): array /** * Encode a PHP array into a JSON string. * - * @param array $value - * * @throws RuntimeException - * - * @return string */ public static function encode(array $value): string { diff --git a/src/HttpClient/Util/QueryStringBuilder.php b/src/HttpClient/Util/QueryStringBuilder.php index d762afa5..82a0b59c 100644 --- a/src/HttpClient/Util/QueryStringBuilder.php +++ b/src/HttpClient/Util/QueryStringBuilder.php @@ -24,10 +24,6 @@ final class QueryStringBuilder * * Indexed arrays are encoded using empty squared brackets ([]) unlike * `http_build_query`. - * - * @param array $query - * - * @return string */ public static function build(array $query): string { @@ -41,8 +37,6 @@ public static function build(array $query): string * * @param mixed $query * @param scalar $prefix - * - * @return string */ private static function encode($query, $prefix): string { @@ -61,10 +55,6 @@ private static function encode($query, $prefix): string /** * Tell if the given array is a list. - * - * @param array $query - * - * @return bool */ private static function isList(array $query): bool { @@ -79,8 +69,6 @@ private static function isList(array $query): bool * Encode a value like rawurlencode, but return "0" when false is given. * * @param mixed $value - * - * @return string */ private static function rawurlencode($value): string { diff --git a/src/ResultPager.php b/src/ResultPager.php index f587ed4d..d2ab7ba2 100644 --- a/src/ResultPager.php +++ b/src/ResultPager.php @@ -37,14 +37,8 @@ final class ResultPager implements ResultPagerInterface */ private const PER_PAGE = 50; - /** - * @var Client - */ private readonly Client $client; - /** - * @var int - */ private readonly int $perPage; /** @@ -66,13 +60,7 @@ public function __construct(Client $client, ?int $perPage = null) /** * Fetch a single result from an api call. * - * @param AbstractApi $api - * @param string $method - * @param array $parameters - * * @throws \Http\Client\Exception - * - * @return array */ public function fetch(AbstractApi $api, string $method, array $parameters = []): array { @@ -90,13 +78,7 @@ public function fetch(AbstractApi $api, string $method, array $parameters = []): /** * Fetch all results from an api call. * - * @param AbstractApi $api - * @param string $method - * @param array $parameters - * * @throws \Http\Client\Exception - * - * @return array */ public function fetchAll(AbstractApi $api, string $method, array $parameters = []): array { @@ -106,13 +88,7 @@ public function fetchAll(AbstractApi $api, string $method, array $parameters = [ /** * Lazily fetch all results from an api call. * - * @param AbstractApi $api - * @param string $method - * @param array $parameters - * * @throws \Http\Client\Exception - * - * @return \Generator */ public function fetchAllLazy(AbstractApi $api, string $method, array $parameters = []): Generator { @@ -131,8 +107,6 @@ public function fetchAllLazy(AbstractApi $api, string $method, array $parameters /** * Check to determine the availability of a next page. - * - * @return bool */ public function hasNext(): bool { @@ -143,8 +117,6 @@ public function hasNext(): bool * Fetch the next page. * * @throws \Http\Client\Exception - * - * @return array */ public function fetchNext(): array { @@ -153,8 +125,6 @@ public function fetchNext(): array /** * Check to determine the availability of a previous page. - * - * @return bool */ public function hasPrevious(): bool { @@ -165,8 +135,6 @@ public function hasPrevious(): bool * Fetch the previous page. * * @throws \Http\Client\Exception - * - * @return array */ public function fetchPrevious(): array { @@ -177,8 +145,6 @@ public function fetchPrevious(): array * Fetch the first page. * * @throws \Http\Client\Exception - * - * @return array */ public function fetchFirst(): array { @@ -189,8 +155,6 @@ public function fetchFirst(): array * Fetch the last page. * * @throws \Http\Client\Exception - * - * @return array */ public function fetchLast(): array { @@ -199,8 +163,6 @@ public function fetchLast(): array /** * Refresh the pagination property. - * - * @return void */ private function postFetch(): void { @@ -210,11 +172,7 @@ private function postFetch(): void } /** - * @param string $key - * * @throws \Http\Client\Exception - * - * @return array */ private function get(string $key): array { @@ -237,12 +195,6 @@ private function get(string $key): array return $content; } - /** - * @param \Gitlab\Api\AbstractApi $api - * @param int $perPage - * - * @return \Gitlab\Api\AbstractApi - */ private static function bindPerPage(AbstractApi $api, int $perPage): AbstractApi { /** @var Closure(AbstractApi): AbstractApi */ diff --git a/src/ResultPagerInterface.php b/src/ResultPagerInterface.php index f88782cc..445455e0 100644 --- a/src/ResultPagerInterface.php +++ b/src/ResultPagerInterface.php @@ -29,46 +29,26 @@ interface ResultPagerInterface /** * Fetch a single result from an api call. * - * @param AbstractApi $api - * @param string $method - * @param array $parameters - * * @throws \Http\Client\Exception - * - * @return array */ public function fetch(AbstractApi $api, string $method, array $parameters = []): array; /** * Fetch all results from an api call. * - * @param AbstractApi $api - * @param string $method - * @param array $parameters - * * @throws \Http\Client\Exception - * - * @return array */ public function fetchAll(AbstractApi $api, string $method, array $parameters = []): array; /** * Lazily fetch all results from an api call. * - * @param AbstractApi $api - * @param string $method - * @param array $parameters - * * @throws \Http\Client\Exception - * - * @return \Generator */ public function fetchAllLazy(AbstractApi $api, string $method, array $parameters = []): Generator; /** * Check to determine the availability of a next page. - * - * @return bool */ public function hasNext(): bool; @@ -76,15 +56,11 @@ public function hasNext(): bool; * Fetch the next page. * * @throws \Http\Client\Exception - * - * @return array */ public function fetchNext(): array; /** * Check to determine the availability of a previous page. - * - * @return bool */ public function hasPrevious(): bool; @@ -92,8 +68,6 @@ public function hasPrevious(): bool; * Fetch the previous page. * * @throws \Http\Client\Exception - * - * @return array */ public function fetchPrevious(): array; @@ -101,8 +75,6 @@ public function fetchPrevious(): array; * Fetch the first page. * * @throws \Http\Client\Exception - * - * @return array */ public function fetchFirst(): array; @@ -110,8 +82,6 @@ public function fetchFirst(): array; * Fetch the last page. * * @throws \Http\Client\Exception - * - * @return array */ public function fetchLast(): array; } diff --git a/tests/Api/RepositoriesTest.php b/tests/Api/RepositoriesTest.php index 67e9ceb8..d674dc43 100644 --- a/tests/Api/RepositoriesTest.php +++ b/tests/Api/RepositoriesTest.php @@ -365,9 +365,6 @@ public function shouldGetCommitRefs(): void * @test * * @dataProvider dataGetCommitRefsWithParams - * - * @param string $type - * @param array $expectedArray */ public function shouldGetCommitRefsWithParams(string $type, array $expectedArray): void { diff --git a/tests/Api/ResourceIterationEventsTest.php b/tests/Api/ResourceIterationEventsTest.php index f7b8e06f..dc89965a 100644 --- a/tests/Api/ResourceIterationEventsTest.php +++ b/tests/Api/ResourceIterationEventsTest.php @@ -131,9 +131,6 @@ public function shouldShowEvent(): void $this->assertEquals($expectedArray, $api->show(1, 253, 142)); } - /** - * @return string - */ protected function getApiClass(): string { return ResourceIterationEvents::class; diff --git a/tests/Api/ResourceLabelEventsTest.php b/tests/Api/ResourceLabelEventsTest.php index d65b25ec..47cee1a7 100644 --- a/tests/Api/ResourceLabelEventsTest.php +++ b/tests/Api/ResourceLabelEventsTest.php @@ -113,9 +113,6 @@ public function shouldShowEvent(): void $this->assertEquals($expectedArray, $api->show(1, 253, 142)); } - /** - * @return string - */ protected function getApiClass(): string { return ResourceLabelEvents::class; diff --git a/tests/Api/ResourceMilestoneEventsTest.php b/tests/Api/ResourceMilestoneEventsTest.php index 7b3699e6..a7918d04 100644 --- a/tests/Api/ResourceMilestoneEventsTest.php +++ b/tests/Api/ResourceMilestoneEventsTest.php @@ -134,9 +134,6 @@ public function shouldShowEvent(): void $this->assertEquals($expectedArray, $api->show(1, 253, 142)); } - /** - * @return string - */ protected function getApiClass(): string { return ResourceMilestoneEvents::class; diff --git a/tests/Api/ResourceStateEventsTest.php b/tests/Api/ResourceStateEventsTest.php index f3a5a119..7fd3a0bf 100644 --- a/tests/Api/ResourceStateEventsTest.php +++ b/tests/Api/ResourceStateEventsTest.php @@ -95,9 +95,6 @@ public function shouldShowEvent(): void $this->assertEquals($expectedArray, $api->show(1, 11, 142)); } - /** - * @return string - */ protected function getApiClass(): string { return ResourceStateEvents::class; diff --git a/tests/Api/ResourceWeightEventsTest.php b/tests/Api/ResourceWeightEventsTest.php index 4d712a4a..52f07b7e 100644 --- a/tests/Api/ResourceWeightEventsTest.php +++ b/tests/Api/ResourceWeightEventsTest.php @@ -92,9 +92,6 @@ public function shouldShowEvent(): void $this->assertEquals($expectedArray, $api->show(1, 253, 142)); } - /** - * @return string - */ protected function getApiClass(): string { return ResourceWeightEvents::class; diff --git a/tests/Api/TagsTest.php b/tests/Api/TagsTest.php index 91f675e9..4b5f4421 100644 --- a/tests/Api/TagsTest.php +++ b/tests/Api/TagsTest.php @@ -98,10 +98,6 @@ public function shouldRemoveTag(): void * @test * * @dataProvider releaseDataProvider - * - * @param string $releaseName - * @param string $description - * @param array $expectedResult */ public function shouldCreateRelease(string $releaseName, string $description, array $expectedResult): void { @@ -122,10 +118,6 @@ public function shouldCreateRelease(string $releaseName, string $description, ar * @test * * @dataProvider releaseDataProvider - * - * @param string $releaseName - * @param string $description - * @param array $expectedResult */ public function shouldUpdateRelease(string $releaseName, string $description, array $expectedResult): void { diff --git a/tests/Api/TestCase.php b/tests/Api/TestCase.php index 7234af3c..ca5240ac 100644 --- a/tests/Api/TestCase.php +++ b/tests/Api/TestCase.php @@ -26,8 +26,6 @@ abstract class TestCase extends BaseTestCase abstract protected function getApiClass(); /** - * @param array $methods - * * @return \PHPUnit\Framework\MockObject\MockObject */ protected function getApiMock(array $methods = []) diff --git a/tests/HttpClient/Util/QueryStringBuilderTest.php b/tests/HttpClient/Util/QueryStringBuilderTest.php index ddcc5cb0..c9ba33bf 100644 --- a/tests/HttpClient/Util/QueryStringBuilderTest.php +++ b/tests/HttpClient/Util/QueryStringBuilderTest.php @@ -22,9 +22,6 @@ class QueryStringBuilderTest extends TestCase { /** * @dataProvider queryStringProvider - * - * @param array $query - * @param string $expected */ public function testBuild(array $query, string $expected): void { From 4033f5a46f2f02eddf196bc29d4791284b02fce9 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 16:53:53 +0000 Subject: [PATCH 097/117] Move union types inline --- src/Api/AbstractApi.php | 4 +- src/Api/Deployments.php | 4 +- src/Api/Environments.php | 10 +- src/Api/Groups.php | 62 +++---- src/Api/GroupsBoards.php | 20 +-- src/Api/GroupsEpics.php | 12 +- src/Api/GroupsMilestones.php | 14 +- src/Api/IssueBoards.php | 20 +-- src/Api/IssueLinks.php | 6 +- src/Api/Issues.php | 66 ++++---- src/Api/IssuesStatistics.php | 4 +- src/Api/Jobs.php | 28 +-- src/Api/MergeRequests.php | 64 +++---- src/Api/Milestones.php | 14 +- src/Api/Packages.php | 14 +- src/Api/ProjectNamespaces.php | 2 +- src/Api/Projects.php | 188 ++++++++++----------- src/Api/Repositories.php | 54 +++--- src/Api/RepositoryFiles.php | 10 +- src/Api/ResourceIterationEvents.php | 4 +- src/Api/ResourceLabelEvents.php | 4 +- src/Api/ResourceMilestoneEvents.php | 4 +- src/Api/ResourceStateEvents.php | 4 +- src/Api/ResourceWeightEvents.php | 4 +- src/Api/Schedules.php | 20 +-- src/Api/Snippets.php | 26 +-- src/Api/Tags.php | 12 +- src/Api/Wiki.php | 10 +- src/HttpClient/Util/QueryStringBuilder.php | 4 +- 29 files changed, 344 insertions(+), 344 deletions(-) diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index 56fbe901..e6675efb 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -208,7 +208,7 @@ protected function delete(string $uri, array $params = [], array $headers = []) /** * @param int|string $uri */ - protected static function encodePath($uri): string + protected static function encodePath(int|string $uri): string { return \rawurlencode((string) $uri); } @@ -216,7 +216,7 @@ protected static function encodePath($uri): string /** * @param int|string $id */ - protected function getProjectPath($id, string $uri): string + protected function getProjectPath(int|string $id, string $uri): string { return 'projects/'.self::encodePath($id).'/'.$uri; } diff --git a/src/Api/Deployments.php b/src/Api/Deployments.php index aea98d18..3da55267 100644 --- a/src/Api/Deployments.php +++ b/src/Api/Deployments.php @@ -31,7 +31,7 @@ class Deployments extends AbstractApi * * @return mixed */ - public function all($project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('order_by') @@ -54,7 +54,7 @@ public function all($project_id, array $parameters = []) * * @return mixed */ - public function show($project_id, int $deployment_id) + public function show(int|string $project_id, int $deployment_id) { return $this->get($this->getProjectPath($project_id, 'deployments/'.$deployment_id)); } diff --git a/src/Api/Environments.php b/src/Api/Environments.php index 05314834..eb6d5b4a 100644 --- a/src/Api/Environments.php +++ b/src/Api/Environments.php @@ -23,7 +23,7 @@ class Environments extends AbstractApi * * @return mixed */ - public function all($project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('name') @@ -48,7 +48,7 @@ public function all($project_id, array $parameters = []) * * @return mixed */ - public function create($project_id, array $parameters = []) + public function create(int|string $project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setDefined('name') @@ -67,7 +67,7 @@ public function create($project_id, array $parameters = []) * * @return mixed */ - public function remove($project_id, int $environment_id) + public function remove(int|string $project_id, int $environment_id) { return $this->delete($this->getProjectPath($project_id, 'environments/'.$environment_id)); } @@ -77,7 +77,7 @@ public function remove($project_id, int $environment_id) * * @return mixed */ - public function stop($project_id, int $environment_id) + public function stop(int|string $project_id, int $environment_id) { return $this->post($this->getProjectPath($project_id, 'environments/'.self::encodePath($environment_id).'/stop')); } @@ -87,7 +87,7 @@ public function stop($project_id, int $environment_id) * * @return mixed */ - public function show($project_id, int $environment_id) + public function show(int|string $project_id, int $environment_id) { return $this->get($this->getProjectPath($project_id, 'environments/'.self::encodePath($environment_id))); } diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 164d7ca7..f5c5b928 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -74,7 +74,7 @@ public function all(array $parameters = []) * * @return mixed */ - public function show($id) + public function show(int|string $id) { return $this->get('groups/'.self::encodePath($id)); } @@ -105,7 +105,7 @@ public function create(string $name, string $path, ?string $description = null, * * @return mixed */ - public function update($id, array $params) + public function update(int|string $id, array $params) { return $this->put('groups/'.self::encodePath($id), $params); } @@ -115,7 +115,7 @@ public function update($id, array $params) * * @return mixed */ - public function remove($group_id) + public function remove(int|string $group_id) { return $this->delete('groups/'.self::encodePath($group_id)); } @@ -126,7 +126,7 @@ public function remove($group_id) * * @return mixed */ - public function transfer($group_id, $project_id) + public function transfer(int|string $group_id, int|string $project_id) { return $this->post('groups/'.self::encodePath($group_id).'/projects/'.self::encodePath($project_id)); } @@ -136,7 +136,7 @@ public function transfer($group_id, $project_id) * * @return mixed */ - public function allMembers($group_id, array $parameters = []) + public function allMembers(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('query'); @@ -159,7 +159,7 @@ public function allMembers($group_id, array $parameters = []) * * @return mixed */ - public function members($group_id, array $parameters = []) + public function members(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('query'); @@ -178,7 +178,7 @@ public function members($group_id, array $parameters = []) * * @return mixed */ - public function member($group_id, int $user_id) + public function member(int|string $group_id, int $user_id) { return $this->get('groups/'.self::encodePath($group_id).'/members/'.self::encodePath($user_id)); } @@ -188,7 +188,7 @@ public function member($group_id, int $user_id) * * @return mixed */ - public function allMember($group_id, int $user_id) + public function allMember(int|string $group_id, int $user_id) { return $this->get('groups/'.self::encodePath($group_id).'/members/all/'.self::encodePath($user_id)); } @@ -198,7 +198,7 @@ public function allMember($group_id, int $user_id) * * @return mixed */ - public function addMember($group_id, int $user_id, int $access_level, array $parameters = []) + public function addMember(int|string $group_id, int $user_id, int $access_level, array $parameters = []) { $dateNormalizer = function (OptionsResolver $optionsResolver, \DateTimeInterface $date): string { return $date->format('Y-m-d'); @@ -223,7 +223,7 @@ public function addMember($group_id, int $user_id, int $access_level, array $par * * @return mixed */ - public function saveMember($group_id, int $user_id, int $access_level) + public function saveMember(int|string $group_id, int $user_id, int $access_level) { return $this->put('groups/'.self::encodePath($group_id).'/members/'.self::encodePath($user_id), [ 'access_level' => $access_level, @@ -240,7 +240,7 @@ public function saveMember($group_id, int $user_id, int $access_level) * * @return mixed */ - public function addShare($group_id, array $parameters = []) + public function addShare(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -268,7 +268,7 @@ public function addShare($group_id, array $parameters = []) * * @return mixed */ - public function removeMember($group_id, int $user_id) + public function removeMember(int|string $group_id, int $user_id) { return $this->delete('groups/'.self::encodePath($group_id).'/members/'.self::encodePath($user_id)); } @@ -295,7 +295,7 @@ public function removeMember($group_id, int $user_id) * * @return mixed */ - public function projects($id, array $parameters = []) + public function projects(int|string $id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -367,7 +367,7 @@ public function projects($id, array $parameters = []) * * @return mixed */ - public function subgroups($group_id, array $parameters = []) + public function subgroups(int|string $group_id, array $parameters = []) { $resolver = $this->getSubgroupSearchResolver(); @@ -408,7 +408,7 @@ public function subgroups($group_id, array $parameters = []) * * @return mixed */ - public function issues($group_id, array $parameters = []) + public function issues(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -500,7 +500,7 @@ public function issues($group_id, array $parameters = []) * * @return mixed */ - public function labels($group_id, array $parameters = []) + public function labels(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -527,7 +527,7 @@ public function labels($group_id, array $parameters = []) * * @return mixed */ - public function addLabel($group_id, array $params) + public function addLabel(int|string $group_id, array $params) { return $this->post('groups/'.self::encodePath($group_id).'/labels', $params); } @@ -537,7 +537,7 @@ public function addLabel($group_id, array $params) * * @return mixed */ - public function updateLabel($group_id, int $label_id, array $params) + public function updateLabel(int|string $group_id, int $label_id, array $params) { return $this->put('groups/'.self::encodePath($group_id).'/labels/'.self::encodePath($label_id), $params); } @@ -547,7 +547,7 @@ public function updateLabel($group_id, int $label_id, array $params) * * @return mixed */ - public function removeLabel($group_id, int $label_id) + public function removeLabel(int|string $group_id, int $label_id) { return $this->delete('groups/'.self::encodePath($group_id).'/labels/'.self::encodePath($label_id)); } @@ -557,7 +557,7 @@ public function removeLabel($group_id, int $label_id) * * @return mixed */ - public function variables($group_id, array $parameters = []) + public function variables(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -569,7 +569,7 @@ public function variables($group_id, array $parameters = []) * * @return mixed */ - public function variable($group_id, string $key) + public function variable(int|string $group_id, string $key) { return $this->get('groups/'.self::encodePath($group_id).'/variables/'.self::encodePath($key)); } @@ -584,7 +584,7 @@ public function variable($group_id, string $key) * * @return mixed */ - public function addVariable($group_id, string $key, string $value, ?bool $protected = null, array $parameters = []) + public function addVariable(int|string $group_id, string $key, string $value, ?bool $protected = null, array $parameters = []) { $payload = [ 'key' => $key, @@ -611,7 +611,7 @@ public function addVariable($group_id, string $key, string $value, ?bool $protec * * @return mixed */ - public function updateVariable($group_id, string $key, string $value, ?bool $protected = null) + public function updateVariable(int|string $group_id, string $key, string $value, ?bool $protected = null) { $payload = [ 'value' => $value, @@ -629,7 +629,7 @@ public function updateVariable($group_id, string $key, string $value, ?bool $pro * * @return mixed */ - public function removeVariable($group_id, string $key) + public function removeVariable(int|string $group_id, string $key) { return $this->delete('groups/'.self::encodePath($group_id).'/variables/'.self::encodePath($key)); } @@ -654,7 +654,7 @@ public function removeVariable($group_id, string $key) * * @return mixed */ - public function mergeRequests($group_id, array $parameters = []) + public function mergeRequests(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -748,7 +748,7 @@ public function mergeRequests($group_id, array $parameters = []) * * @return mixed */ - public function iterations($group_id, array $parameters = []) + public function iterations(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -787,7 +787,7 @@ public function iterations($group_id, array $parameters = []) * * @return mixed */ - public function packages($group_id, array $parameters = []) + public function packages(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -884,7 +884,7 @@ private function getSubgroupSearchResolver() * * @return mixed */ - public function deployTokens($group_id, ?bool $active = null) + public function deployTokens(int|string $group_id, ?bool $active = null) { return $this->get('groups/'.self::encodePath($group_id).'/deploy_tokens', (null !== $active) ? ['active' => $active] : []); } @@ -901,7 +901,7 @@ public function deployTokens($group_id, ?bool $active = null) * * @return mixed */ - public function createDeployToken($group_id, array $parameters = []) + public function createDeployToken(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -943,7 +943,7 @@ public function createDeployToken($group_id, array $parameters = []) * * @return mixed */ - public function deleteDeployToken($group_id, int $token_id) + public function deleteDeployToken(int|string $group_id, int $token_id) { return $this->delete('groups/'.self::encodePath($group_id).'/deploy_tokens/'.self::encodePath($token_id)); } @@ -965,7 +965,7 @@ public function deleteDeployToken($group_id, int $token_id) * * @return mixed */ - public function search($id, array $parameters = []) + public function search(int|string $id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { diff --git a/src/Api/GroupsBoards.php b/src/Api/GroupsBoards.php index 22add21d..6cf6b03f 100644 --- a/src/Api/GroupsBoards.php +++ b/src/Api/GroupsBoards.php @@ -21,7 +21,7 @@ class GroupsBoards extends AbstractApi * * @return mixed */ - public function all($group_id = null, array $parameters = []) + public function all(int|string|null $group_id = null, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -35,7 +35,7 @@ public function all($group_id = null, array $parameters = []) * * @return mixed */ - public function show($group_id, int $board_id) + public function show(int|string $group_id, int $board_id) { return $this->get('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id)); } @@ -45,7 +45,7 @@ public function show($group_id, int $board_id) * * @return mixed */ - public function create($group_id, array $params) + public function create(int|string $group_id, array $params) { return $this->post('groups/'.self::encodePath($group_id).'/boards', $params); } @@ -55,7 +55,7 @@ public function create($group_id, array $params) * * @return mixed */ - public function update($group_id, int $board_id, array $params) + public function update(int|string $group_id, int $board_id, array $params) { return $this->put('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id), $params); } @@ -65,7 +65,7 @@ public function update($group_id, int $board_id, array $params) * * @return mixed */ - public function remove($group_id, int $board_id) + public function remove(int|string $group_id, int $board_id) { return $this->delete('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id)); } @@ -75,7 +75,7 @@ public function remove($group_id, int $board_id) * * @return mixed */ - public function allLists($group_id, int $board_id) + public function allLists(int|string $group_id, int $board_id) { return $this->get('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists'); } @@ -85,7 +85,7 @@ public function allLists($group_id, int $board_id) * * @return mixed */ - public function showList($group_id, int $board_id, int $list_id) + public function showList(int|string $group_id, int $board_id, int $list_id) { return $this->get('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id)); } @@ -95,7 +95,7 @@ public function showList($group_id, int $board_id, int $list_id) * * @return mixed */ - public function createList($group_id, int $board_id, int $label_id) + public function createList(int|string $group_id, int $board_id, int $label_id) { $params = [ 'label_id' => $label_id, @@ -109,7 +109,7 @@ public function createList($group_id, int $board_id, int $label_id) * * @return mixed */ - public function updateList($group_id, int $board_id, int $list_id, int $position) + public function updateList(int|string $group_id, int $board_id, int $list_id, int $position) { $params = [ 'position' => $position, @@ -123,7 +123,7 @@ public function updateList($group_id, int $board_id, int $list_id, int $position * * @return mixed */ - public function deleteList($group_id, int $board_id, int $list_id) + public function deleteList(int|string $group_id, int $board_id, int $list_id) { return $this->delete('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id)); } diff --git a/src/Api/GroupsEpics.php b/src/Api/GroupsEpics.php index 8cd63b4a..8f139808 100644 --- a/src/Api/GroupsEpics.php +++ b/src/Api/GroupsEpics.php @@ -42,7 +42,7 @@ class GroupsEpics extends AbstractApi * * @return mixed */ - public function all($group_id, array $parameters = []) + public function all(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('iids') @@ -64,7 +64,7 @@ public function all($group_id, array $parameters = []) * * @return mixed */ - public function show($group_id, int $epic_id) + public function show(int|string $group_id, int $epic_id) { return $this->get('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_id)); } @@ -74,7 +74,7 @@ public function show($group_id, int $epic_id) * * @return mixed */ - public function create($group_id, array $params) + public function create(int|string $group_id, array $params) { return $this->post('groups/'.self::encodePath($group_id).'/epics', $params); } @@ -84,7 +84,7 @@ public function create($group_id, array $params) * * @return mixed */ - public function update($group_id, int $epic_id, array $params) + public function update(int|string $group_id, int $epic_id, array $params) { return $this->put('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_id), $params); } @@ -94,7 +94,7 @@ public function update($group_id, int $epic_id, array $params) * * @return mixed */ - public function remove($group_id, int $epic_id) + public function remove(int|string $group_id, int $epic_id) { return $this->delete('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_id)); } @@ -104,7 +104,7 @@ public function remove($group_id, int $epic_id) * * @return mixed */ - public function issues($group_id, int $epic_iid) + public function issues(int|string $group_id, int $epic_iid) { return $this->get('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_iid).'/issues'); } diff --git a/src/Api/GroupsMilestones.php b/src/Api/GroupsMilestones.php index b01b0a0a..5d8c7b83 100644 --- a/src/Api/GroupsMilestones.php +++ b/src/Api/GroupsMilestones.php @@ -41,7 +41,7 @@ class GroupsMilestones extends AbstractApi * * @return mixed */ - public function all($group_id, array $parameters = []) + public function all(int|string $group_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -75,7 +75,7 @@ public function all($group_id, array $parameters = []) * * @return mixed */ - public function show($group_id, int $milestone_id) + public function show(int|string $group_id, int $milestone_id) { return $this->get('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id)); } @@ -85,7 +85,7 @@ public function show($group_id, int $milestone_id) * * @return mixed */ - public function create($group_id, array $params) + public function create(int|string $group_id, array $params) { return $this->post('groups/'.self::encodePath($group_id).'/milestones', $params); } @@ -95,7 +95,7 @@ public function create($group_id, array $params) * * @return mixed */ - public function update($group_id, int $milestone_id, array $params) + public function update(int|string $group_id, int $milestone_id, array $params) { return $this->put('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id), $params); } @@ -105,7 +105,7 @@ public function update($group_id, int $milestone_id, array $params) * * @return mixed */ - public function remove($group_id, int $milestone_id) + public function remove(int|string $group_id, int $milestone_id) { return $this->delete('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id)); } @@ -115,7 +115,7 @@ public function remove($group_id, int $milestone_id) * * @return mixed */ - public function issues($group_id, int $milestone_id) + public function issues(int|string $group_id, int $milestone_id) { return $this->get('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id).'/issues'); } @@ -125,7 +125,7 @@ public function issues($group_id, int $milestone_id) * * @return mixed */ - public function mergeRequests($group_id, int $milestone_id) + public function mergeRequests(int|string $group_id, int $milestone_id) { return $this->get('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id).'/merge_requests'); } diff --git a/src/Api/IssueBoards.php b/src/Api/IssueBoards.php index 095e267f..9367364f 100644 --- a/src/Api/IssueBoards.php +++ b/src/Api/IssueBoards.php @@ -21,7 +21,7 @@ class IssueBoards extends AbstractApi * * @return mixed */ - public function all($project_id = null, array $parameters = []) + public function all(int|string|null $project_id = null, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -35,7 +35,7 @@ public function all($project_id = null, array $parameters = []) * * @return mixed */ - public function show($project_id, int $board_id) + public function show(int|string $project_id, int $board_id) { return $this->get($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id))); } @@ -45,7 +45,7 @@ public function show($project_id, int $board_id) * * @return mixed */ - public function create($project_id, array $params) + public function create(int|string $project_id, array $params) { return $this->post($this->getProjectPath($project_id, 'boards'), $params); } @@ -55,7 +55,7 @@ public function create($project_id, array $params) * * @return mixed */ - public function update($project_id, int $board_id, array $params) + public function update(int|string $project_id, int $board_id, array $params) { return $this->put($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id)), $params); } @@ -65,7 +65,7 @@ public function update($project_id, int $board_id, array $params) * * @return mixed */ - public function remove($project_id, int $board_id) + public function remove(int|string $project_id, int $board_id) { return $this->delete($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id))); } @@ -75,7 +75,7 @@ public function remove($project_id, int $board_id) * * @return mixed */ - public function allLists($project_id, int $board_id) + public function allLists(int|string $project_id, int $board_id) { return $this->get($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists')); } @@ -85,7 +85,7 @@ public function allLists($project_id, int $board_id) * * @return mixed */ - public function showList($project_id, int $board_id, int $list_id) + public function showList(int|string $project_id, int $board_id, int $list_id) { return $this->get($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id))); } @@ -95,7 +95,7 @@ public function showList($project_id, int $board_id, int $list_id) * * @return mixed */ - public function createList($project_id, int $board_id, int $label_id) + public function createList(int|string $project_id, int $board_id, int $label_id) { $params = [ 'label_id' => $label_id, @@ -109,7 +109,7 @@ public function createList($project_id, int $board_id, int $label_id) * * @return mixed */ - public function updateList($project_id, int $board_id, int $list_id, int $position) + public function updateList(int|string $project_id, int $board_id, int $list_id, int $position) { $params = [ 'position' => $position, @@ -123,7 +123,7 @@ public function updateList($project_id, int $board_id, int $list_id, int $positi * * @return mixed */ - public function deleteList($project_id, int $board_id, int $list_id) + public function deleteList(int|string $project_id, int $board_id, int $list_id) { return $this->delete($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id))); } diff --git a/src/Api/IssueLinks.php b/src/Api/IssueLinks.php index 04d99eca..07f308c1 100644 --- a/src/Api/IssueLinks.php +++ b/src/Api/IssueLinks.php @@ -21,7 +21,7 @@ class IssueLinks extends AbstractApi * * @return mixed */ - public function all($project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/links'); } @@ -36,7 +36,7 @@ public function all($project_id, int $issue_iid) * * @return mixed */ - public function create($project_id, int $issue_iid, $target_project_id, int $target_issue_iid, array $parameters = []) + public function create(int|string $project_id, int $issue_iid, int|string $target_project_id, int $target_issue_iid, array $parameters = []) { $parameters['target_project_id'] = $target_project_id; $parameters['target_issue_iid'] = $target_issue_iid; @@ -54,7 +54,7 @@ public function create($project_id, int $issue_iid, $target_project_id, int $tar * * @return mixed */ - public function remove($project_id, int $issue_iid, $issue_link_id, array $parameters = []) + public function remove(int|string $project_id, int $issue_iid, int|string $issue_link_id, array $parameters = []) { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/links/'.self::encodePath($issue_link_id), $parameters); } diff --git a/src/Api/Issues.php b/src/Api/Issues.php index 76127b1b..6a85ead7 100644 --- a/src/Api/Issues.php +++ b/src/Api/Issues.php @@ -51,7 +51,7 @@ class Issues extends AbstractApi * * @return mixed */ - public function all($project_id = null, array $parameters = []) + public function all(int|string|null $project_id = null, array $parameters = []) { $path = null === $project_id ? 'issues' : $this->getProjectPath($project_id, 'issues'); @@ -63,7 +63,7 @@ public function all($project_id = null, array $parameters = []) * * @return mixed */ - public function group($group_id, array $parameters = []) + public function group(int|string $group_id, array $parameters = []) { return $this->get( 'groups/'.self::encodePath($group_id).'/issues', @@ -76,7 +76,7 @@ public function group($group_id, array $parameters = []) * * @return mixed */ - public function show($project_id, int $issue_iid) + public function show(int|string $project_id, int $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid))); } @@ -86,7 +86,7 @@ public function show($project_id, int $issue_iid) * * @return mixed */ - public function create($project_id, array $params) + public function create(int|string $project_id, array $params) { return $this->post($this->getProjectPath($project_id, 'issues'), $params); } @@ -96,7 +96,7 @@ public function create($project_id, array $params) * * @return mixed */ - public function update($project_id, int $issue_iid, array $params) + public function update(int|string $project_id, int $issue_iid, array $params) { return $this->put($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)), $params); } @@ -106,7 +106,7 @@ public function update($project_id, int $issue_iid, array $params) * * @return mixed */ - public function reorder($project_id, int $issue_iid, array $params) + public function reorder(int|string $project_id, int $issue_iid, array $params) { return $this->put($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/reorder', $params); } @@ -117,7 +117,7 @@ public function reorder($project_id, int $issue_iid, array $params) * * @return mixed */ - public function move($project_id, int $issue_iid, $to_project_id) + public function move(int|string $project_id, int $issue_iid, int|string $to_project_id) { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/move', [ 'to_project_id' => $to_project_id, @@ -129,7 +129,7 @@ public function move($project_id, int $issue_iid, $to_project_id) * * @return mixed */ - public function remove($project_id, int $issue_iid) + public function remove(int|string $project_id, int $issue_iid) { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid))); } @@ -139,7 +139,7 @@ public function remove($project_id, int $issue_iid) * * @return mixed */ - public function showNotes($project_id, int $issue_iid) + public function showNotes(int|string $project_id, int $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes')); } @@ -149,7 +149,7 @@ public function showNotes($project_id, int $issue_iid) * * @return mixed */ - public function showNote($project_id, int $issue_iid, int $note_id) + public function showNote(int|string $project_id, int $issue_iid, int $note_id) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes/'.self::encodePath($note_id))); } @@ -159,7 +159,7 @@ public function showNote($project_id, int $issue_iid, int $note_id) * * @return mixed */ - public function addNote($project_id, int $issue_iid, string $body, array $params = []) + public function addNote(int|string $project_id, int $issue_iid, string $body, array $params = []) { $params['body'] = $body; @@ -171,7 +171,7 @@ public function addNote($project_id, int $issue_iid, string $body, array $params * * @return mixed */ - public function updateNote($project_id, int $issue_iid, int $note_id, string $body, array $params = []) + public function updateNote(int|string $project_id, int $issue_iid, int $note_id, string $body, array $params = []) { $params['body'] = $body; @@ -183,7 +183,7 @@ public function updateNote($project_id, int $issue_iid, int $note_id, string $bo * * @return mixed */ - public function removeNote($project_id, int $issue_iid, int $note_id) + public function removeNote(int|string $project_id, int $issue_iid, int $note_id) { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes/'.self::encodePath($note_id))); } @@ -193,7 +193,7 @@ public function removeNote($project_id, int $issue_iid, int $note_id) * * @return mixed */ - public function showDiscussions($project_id, int $issue_iid) + public function showDiscussions(int|string $project_id, int $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/discussions'); } @@ -203,7 +203,7 @@ public function showDiscussions($project_id, int $issue_iid) * * @return mixed */ - public function showDiscussion($project_id, int $issue_iid, string $discussion_id) + public function showDiscussion(int|string $project_id, int $issue_iid, string $discussion_id) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/discussions/'.self::encodePath($discussion_id)); } @@ -213,7 +213,7 @@ public function showDiscussion($project_id, int $issue_iid, string $discussion_i * * @return mixed */ - public function addDiscussion($project_id, int $issue_iid, string $body) + public function addDiscussion(int|string $project_id, int $issue_iid, string $body) { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions'), ['body' => $body]); } @@ -223,7 +223,7 @@ public function addDiscussion($project_id, int $issue_iid, string $body) * * @return mixed */ - public function addDiscussionNote($project_id, int $issue_iid, string $discussion_id, string $body) + public function addDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, string $body) { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions/'.self::encodePath($discussion_id).'/notes'), ['body' => $body]); } @@ -233,7 +233,7 @@ public function addDiscussionNote($project_id, int $issue_iid, string $discussio * * @return mixed */ - public function updateDiscussionNote($project_id, int $issue_iid, string $discussion_id, int $note_id, string $body) + public function updateDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, int $note_id, string $body) { return $this->put($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id)), [ 'body' => $body, @@ -245,7 +245,7 @@ public function updateDiscussionNote($project_id, int $issue_iid, string $discus * * @return mixed */ - public function removeDiscussionNote($project_id, int $issue_iid, string $discussion_id, int $note_id) + public function removeDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, int $note_id) { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id))); } @@ -255,7 +255,7 @@ public function removeDiscussionNote($project_id, int $issue_iid, string $discus * * @return mixed */ - public function setTimeEstimate($project_id, int $issue_iid, string $duration) + public function setTimeEstimate(int|string $project_id, int $issue_iid, string $duration) { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/time_estimate'), ['duration' => $duration]); } @@ -265,7 +265,7 @@ public function setTimeEstimate($project_id, int $issue_iid, string $duration) * * @return mixed */ - public function resetTimeEstimate($project_id, int $issue_iid) + public function resetTimeEstimate(int|string $project_id, int $issue_iid) { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/reset_time_estimate')); } @@ -275,7 +275,7 @@ public function resetTimeEstimate($project_id, int $issue_iid) * * @return mixed */ - public function addSpentTime($project_id, int $issue_iid, string $duration) + public function addSpentTime(int|string $project_id, int $issue_iid, string $duration) { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/add_spent_time'), ['duration' => $duration]); } @@ -285,7 +285,7 @@ public function addSpentTime($project_id, int $issue_iid, string $duration) * * @return mixed */ - public function resetSpentTime($project_id, int $issue_iid) + public function resetSpentTime(int|string $project_id, int $issue_iid) { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/reset_spent_time')); } @@ -295,7 +295,7 @@ public function resetSpentTime($project_id, int $issue_iid) * * @return mixed */ - public function getTimeStats($project_id, int $issue_iid) + public function getTimeStats(int|string $project_id, int $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/time_stats')); } @@ -311,7 +311,7 @@ public function getTimeStats($project_id, int $issue_iid) * * @return mixed */ - public function subscribe($project_id, int $issue_iid) + public function subscribe(int|string $project_id, int $issue_iid) { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/subscribe')); } @@ -327,7 +327,7 @@ public function subscribe($project_id, int $issue_iid) * * @return mixed */ - public function unsubscribe($project_id, int $issue_iid) + public function unsubscribe(int|string $project_id, int $issue_iid) { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/unsubscribe')); } @@ -337,7 +337,7 @@ public function unsubscribe($project_id, int $issue_iid) * * @return mixed */ - public function awardEmoji($project_id, int $issue_iid) + public function awardEmoji(int|string $project_id, int $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/award_emoji')); } @@ -347,7 +347,7 @@ public function awardEmoji($project_id, int $issue_iid) * * @return mixed */ - public function removeAwardEmoji($project_id, int $issue_iid, int $award_id) + public function removeAwardEmoji(int|string $project_id, int $issue_iid, int $award_id) { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/award_emoji/'.self::encodePath($award_id))); } @@ -357,7 +357,7 @@ public function removeAwardEmoji($project_id, int $issue_iid, int $award_id) * * @return mixed */ - public function closedByMergeRequests($project_id, int $issue_iid) + public function closedByMergeRequests(int|string $project_id, int $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/closed_by'); } @@ -367,7 +367,7 @@ public function closedByMergeRequests($project_id, int $issue_iid) * * @return mixed */ - public function relatedMergeRequests($project_id, int $issue_iid) + public function relatedMergeRequests(int|string $project_id, int $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/related_merge_requests')); } @@ -377,7 +377,7 @@ public function relatedMergeRequests($project_id, int $issue_iid) * * @return mixed */ - public function showParticipants($project_id, int $issue_iid) + public function showParticipants(int|string $project_id, int $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/participants'); } @@ -387,7 +387,7 @@ public function showParticipants($project_id, int $issue_iid) * * @return mixed */ - public function showResourceLabelEvents($project_id, int $issue_iid) + public function showResourceLabelEvents(int|string $project_id, int $issue_iid) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/resource_label_events'); } @@ -397,7 +397,7 @@ public function showResourceLabelEvents($project_id, int $issue_iid) * * @return mixed */ - public function showResourceLabelEvent($project_id, int $issue_iid, int $resource_label_event_id) + public function showResourceLabelEvent(int|string $project_id, int $issue_iid, int $resource_label_event_id) { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/resource_label_events/'.self::encodePath($resource_label_event_id)); } diff --git a/src/Api/IssuesStatistics.php b/src/Api/IssuesStatistics.php index d57d4a57..aa234b05 100644 --- a/src/Api/IssuesStatistics.php +++ b/src/Api/IssuesStatistics.php @@ -32,7 +32,7 @@ public function all(array $parameters) * * @return mixed */ - public function project($project_id, array $parameters) + public function project(int|string $project_id, array $parameters) { return $this->get($this->getProjectPath($project_id, 'issues_statistics'), $this->createOptionsResolver()->resolve($parameters)); } @@ -42,7 +42,7 @@ public function project($project_id, array $parameters) * * @return mixed */ - public function group($group_id, array $parameters) + public function group(int|string $group_id, array $parameters) { return $this->get('groups/'.self::encodePath($group_id).'/issues_statistics', $this->createOptionsResolver()->resolve($parameters)); } diff --git a/src/Api/Jobs.php b/src/Api/Jobs.php index aeac8919..a8e5d247 100644 --- a/src/Api/Jobs.php +++ b/src/Api/Jobs.php @@ -69,7 +69,7 @@ class Jobs extends AbstractApi * * @return mixed */ - public function all($project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -86,7 +86,7 @@ public function all($project_id, array $parameters = []) * * @return mixed */ - public function pipelineJobs($project_id, int $pipeline_id, array $parameters = []) + public function pipelineJobs(int|string $project_id, int $pipeline_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -107,7 +107,7 @@ public function pipelineJobs($project_id, int $pipeline_id, array $parameters = * * @return mixed */ - public function pipelineBridges($project_id, int $pipeline_id, array $parameters = []) + public function pipelineBridges(int|string $project_id, int $pipeline_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -122,7 +122,7 @@ public function pipelineBridges($project_id, int $pipeline_id, array $parameters * * @return mixed */ - public function show($project_id, int $job_id) + public function show(int|string $project_id, int $job_id) { return $this->get('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id)); } @@ -132,7 +132,7 @@ public function show($project_id, int $job_id) * * @return StreamInterface */ - public function artifacts($project_id, int $job_id) + public function artifacts(int|string $project_id, int $job_id) { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/artifacts')->getBody(); } @@ -142,7 +142,7 @@ public function artifacts($project_id, int $job_id) * * @return StreamInterface */ - public function artifactsByRefName($project_id, string $ref_name, string $job_name) + public function artifactsByRefName(int|string $project_id, string $ref_name, string $job_name) { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/download', [ 'job' => $job_name, @@ -154,7 +154,7 @@ public function artifactsByRefName($project_id, string $ref_name, string $job_na * * @return StreamInterface */ - public function artifactByRefName($project_id, string $ref_name, string $job_name, string $artifact_path) + public function artifactByRefName(int|string $project_id, string $ref_name, string $job_name, string $artifact_path) { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/raw/'.self::encodePath($artifact_path), [ 'job' => $job_name, @@ -167,7 +167,7 @@ public function artifactByRefName($project_id, string $ref_name, string $job_nam * * @return StreamInterface */ - public function artifactByJobId($project_id, $job_id, string $artifact_path) + public function artifactByJobId(int|string $project_id, int $job_id, string $artifact_path) { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/artifacts/'.self::encodePath($artifact_path))->getBody(); } @@ -177,7 +177,7 @@ public function artifactByJobId($project_id, $job_id, string $artifact_path) * * @return mixed */ - public function trace($project_id, int $job_id) + public function trace(int|string $project_id, int $job_id) { return $this->get('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/trace'); } @@ -187,7 +187,7 @@ public function trace($project_id, int $job_id) * * @return mixed */ - public function cancel($project_id, int $job_id) + public function cancel(int|string $project_id, int $job_id) { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/cancel'); } @@ -197,7 +197,7 @@ public function cancel($project_id, int $job_id) * * @return mixed */ - public function retry($project_id, int $job_id) + public function retry(int|string $project_id, int $job_id) { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/retry'); } @@ -207,7 +207,7 @@ public function retry($project_id, int $job_id) * * @return mixed */ - public function erase($project_id, int $job_id) + public function erase(int|string $project_id, int $job_id) { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/erase'); } @@ -217,7 +217,7 @@ public function erase($project_id, int $job_id) * * @return mixed */ - public function keepArtifacts($project_id, int $job_id) + public function keepArtifacts(int|string $project_id, int $job_id) { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/artifacts/keep'); } @@ -227,7 +227,7 @@ public function keepArtifacts($project_id, int $job_id) * * @return mixed */ - public function play($project_id, int $job_id) + public function play(int|string $project_id, int $job_id) { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/play'); } diff --git a/src/Api/MergeRequests.php b/src/Api/MergeRequests.php index 8a511569..1b1e9a92 100644 --- a/src/Api/MergeRequests.php +++ b/src/Api/MergeRequests.php @@ -70,7 +70,7 @@ class MergeRequests extends AbstractApi * * @return mixed */ - public function all($project_id = null, array $parameters = []) + public function all(int|string|null $project_id = null, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -163,7 +163,7 @@ public function all($project_id = null, array $parameters = []) * * @return mixed */ - public function show($project_id, int $mr_iid, array $parameters = []) + public function show(int|string $project_id, int $mr_iid, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('include_diverged_commits_count') @@ -187,7 +187,7 @@ public function show($project_id, int $mr_iid, array $parameters = []) * * @return mixed */ - public function create($project_id, string $source, string $target, string $title, array $parameters = []) + public function create(int|string $project_id, string $source, string $target, string $title, array $parameters = []) { $baseParams = [ 'source_branch' => $source, @@ -206,7 +206,7 @@ public function create($project_id, string $source, string $target, string $titl * * @return mixed */ - public function update($project_id, int $mr_iid, array $parameters) + public function update(int|string $project_id, int $mr_iid, array $parameters) { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)), $parameters); } @@ -216,7 +216,7 @@ public function update($project_id, int $mr_iid, array $parameters) * * @return mixed */ - public function merge($project_id, int $mr_iid, array $parameters = []) + public function merge(int|string $project_id, int $mr_iid, array $parameters = []) { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/merge'), $parameters); } @@ -226,7 +226,7 @@ public function merge($project_id, int $mr_iid, array $parameters = []) * * @return mixed */ - public function showNotes($project_id, int $mr_iid) + public function showNotes(int|string $project_id, int $mr_iid) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes')); } @@ -236,7 +236,7 @@ public function showNotes($project_id, int $mr_iid) * * @return mixed */ - public function showNote($project_id, int $mr_iid, int $note_id) + public function showNote(int|string $project_id, int $mr_iid, int $note_id) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id))); } @@ -246,7 +246,7 @@ public function showNote($project_id, int $mr_iid, int $note_id) * * @return mixed */ - public function addNote($project_id, int $mr_iid, string $body, array $params = []) + public function addNote(int|string $project_id, int $mr_iid, string $body, array $params = []) { $params['body'] = $body; @@ -258,7 +258,7 @@ public function addNote($project_id, int $mr_iid, string $body, array $params = * * @return mixed */ - public function updateNote($project_id, int $mr_iid, int $note_id, string $body) + public function updateNote(int|string $project_id, int $mr_iid, int $note_id, string $body) { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id)), [ 'body' => $body, @@ -270,7 +270,7 @@ public function updateNote($project_id, int $mr_iid, int $note_id, string $body) * * @return mixed */ - public function removeNote($project_id, int $mr_iid, int $note_id) + public function removeNote(int|string $project_id, int $mr_iid, int $note_id) { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id))); } @@ -280,7 +280,7 @@ public function removeNote($project_id, int $mr_iid, int $note_id) * * @return mixed */ - public function showDiscussions($project_id, int $mr_iid) + public function showDiscussions(int|string $project_id, int $mr_iid) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/discussions'); } @@ -290,7 +290,7 @@ public function showDiscussions($project_id, int $mr_iid) * * @return mixed */ - public function showDiscussion($project_id, int $mr_iid, string $discussion_id) + public function showDiscussion(int|string $project_id, int $mr_iid, string $discussion_id) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/discussions/'.self::encodePath($discussion_id)); } @@ -300,7 +300,7 @@ public function showDiscussion($project_id, int $mr_iid, string $discussion_id) * * @return mixed */ - public function addDiscussion($project_id, int $mr_iid, array $params) + public function addDiscussion(int|string $project_id, int $mr_iid, array $params) { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions'), $params); } @@ -310,7 +310,7 @@ public function addDiscussion($project_id, int $mr_iid, array $params) * * @return mixed */ - public function resolveDiscussion($project_id, int $mr_iid, string $discussion_id, bool $resolved = true) + public function resolveDiscussion(int|string $project_id, int $mr_iid, string $discussion_id, bool $resolved = true) { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id)), [ 'resolved' => $resolved, @@ -322,7 +322,7 @@ public function resolveDiscussion($project_id, int $mr_iid, string $discussion_i * * @return mixed */ - public function addDiscussionNote($project_id, int $mr_iid, string $discussion_id, string $body) + public function addDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, string $body) { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes'), ['body' => $body]); } @@ -332,7 +332,7 @@ public function addDiscussionNote($project_id, int $mr_iid, string $discussion_i * * @return mixed */ - public function updateDiscussionNote($project_id, int $mr_iid, string $discussion_id, int $note_id, array $params) + public function updateDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, int $note_id, array $params) { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id)), $params); } @@ -342,7 +342,7 @@ public function updateDiscussionNote($project_id, int $mr_iid, string $discussio * * @return mixed */ - public function removeDiscussionNote($project_id, int $mr_iid, string $discussion_id, int $note_id) + public function removeDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, int $note_id) { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id))); } @@ -352,7 +352,7 @@ public function removeDiscussionNote($project_id, int $mr_iid, string $discussio * * @return mixed */ - public function showParticipants($project_id, int $mr_iid) + public function showParticipants(int|string $project_id, int $mr_iid) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/participants'); } @@ -362,7 +362,7 @@ public function showParticipants($project_id, int $mr_iid) * * @return mixed */ - public function changes($project_id, int $mr_iid) + public function changes(int|string $project_id, int $mr_iid) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/changes')); } @@ -372,7 +372,7 @@ public function changes($project_id, int $mr_iid) * * @return mixed */ - public function commits($project_id, int $mr_iid) + public function commits(int|string $project_id, int $mr_iid) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/commits')); } @@ -382,7 +382,7 @@ public function commits($project_id, int $mr_iid) * * @return mixed */ - public function closesIssues($project_id, int $mr_iid) + public function closesIssues(int|string $project_id, int $mr_iid) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/closes_issues')); } @@ -392,7 +392,7 @@ public function closesIssues($project_id, int $mr_iid) * * @return mixed */ - public function approvals($project_id, int $mr_iid) + public function approvals(int|string $project_id, int $mr_iid) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approvals')); } @@ -402,7 +402,7 @@ public function approvals($project_id, int $mr_iid) * * @return mixed */ - public function approve($project_id, int $mr_iid) + public function approve(int|string $project_id, int $mr_iid) { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approve')); } @@ -412,7 +412,7 @@ public function approve($project_id, int $mr_iid) * * @return mixed */ - public function unapprove($project_id, int $mr_iid) + public function unapprove(int|string $project_id, int $mr_iid) { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/unapprove')); } @@ -422,7 +422,7 @@ public function unapprove($project_id, int $mr_iid) * * @return mixed */ - public function awardEmoji($project_id, int $mr_iid) + public function awardEmoji(int|string $project_id, int $mr_iid) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji')); } @@ -432,7 +432,7 @@ public function awardEmoji($project_id, int $mr_iid) * * @return mixed */ - public function removeAwardEmoji($project_id, int $mr_iid, int $award_id) + public function removeAwardEmoji(int|string $project_id, int $mr_iid, int $award_id) { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji/'.self::encodePath($award_id))); } @@ -442,7 +442,7 @@ public function removeAwardEmoji($project_id, int $mr_iid, int $award_id) * * @return mixed */ - public function rebase($project_id, int $mr_iid, array $params = []) + public function rebase(int|string $project_id, int $mr_iid, array $params = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('skip_ci') @@ -456,7 +456,7 @@ public function rebase($project_id, int $mr_iid, array $params = []) * * @return mixed */ - public function approvalState($project_id, int $mr_iid) + public function approvalState(int|string $project_id, int $mr_iid) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_state')); } @@ -466,7 +466,7 @@ public function approvalState($project_id, int $mr_iid) * * @return mixed */ - public function levelRules($project_id, int $mr_iid) + public function levelRules(int|string $project_id, int $mr_iid) { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_rules')); } @@ -477,7 +477,7 @@ public function levelRules($project_id, int $mr_iid) * * @return mixed */ - public function createLevelRule($project_id, int $mr_iid, string $name, int $approvals_required, array $parameters = []) + public function createLevelRule(int|string $project_id, int $mr_iid, string $name, int $approvals_required, array $parameters = []) { $baseParam = [ 'name' => $name, @@ -496,7 +496,7 @@ public function createLevelRule($project_id, int $mr_iid, string $name, int $app * * @return mixed */ - public function updateLevelRule($project_id, int $mr_iid, int $approval_rule_id, string $name, int $approvals_required, array $parameters = []) + public function updateLevelRule(int|string $project_id, int $mr_iid, int $approval_rule_id, string $name, int $approvals_required, array $parameters = []) { $baseParam = [ 'name' => $name, @@ -514,7 +514,7 @@ public function updateLevelRule($project_id, int $mr_iid, int $approval_rule_id, * * @return mixed */ - public function deleteLevelRule($project_id, int $mr_iid, int $approval_rule_id) + public function deleteLevelRule(int|string $project_id, int $mr_iid, int $approval_rule_id) { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_rules/'.self::encodePath($approval_rule_id))); } diff --git a/src/Api/Milestones.php b/src/Api/Milestones.php index ffef1f2e..054cb6d1 100644 --- a/src/Api/Milestones.php +++ b/src/Api/Milestones.php @@ -37,7 +37,7 @@ class Milestones extends AbstractApi * * @return mixed */ - public function all($project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('iids') @@ -59,7 +59,7 @@ public function all($project_id, array $parameters = []) * * @return mixed */ - public function show($project_id, int $milestone_id) + public function show(int|string $project_id, int $milestone_id) { return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id))); } @@ -69,7 +69,7 @@ public function show($project_id, int $milestone_id) * * @return mixed */ - public function create($project_id, array $params) + public function create(int|string $project_id, array $params) { return $this->post($this->getProjectPath($project_id, 'milestones'), $params); } @@ -79,7 +79,7 @@ public function create($project_id, array $params) * * @return mixed */ - public function update($project_id, int $milestone_id, array $params) + public function update(int|string $project_id, int $milestone_id, array $params) { return $this->put($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id)), $params); } @@ -89,7 +89,7 @@ public function update($project_id, int $milestone_id, array $params) * * @return mixed */ - public function remove($project_id, int $milestone_id) + public function remove(int|string $project_id, int $milestone_id) { return $this->delete($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id))); } @@ -99,7 +99,7 @@ public function remove($project_id, int $milestone_id) * * @return mixed */ - public function issues($project_id, int $milestone_id) + public function issues(int|string $project_id, int $milestone_id) { return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id).'/issues')); } @@ -109,7 +109,7 @@ public function issues($project_id, int $milestone_id) * * @return mixed */ - public function mergeRequests($project_id, int $milestone_id) + public function mergeRequests(int|string $project_id, int $milestone_id) { return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id).'/merge_requests')); } diff --git a/src/Api/Packages.php b/src/Api/Packages.php index 65fea6d8..85e2a1b9 100644 --- a/src/Api/Packages.php +++ b/src/Api/Packages.php @@ -36,7 +36,7 @@ class Packages extends AbstractApi * * @return mixed */ - public function all($project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -68,7 +68,7 @@ public function all($project_id, array $parameters = []) * * @return mixed */ - public function show($project_id, int $package_id) + public function show(int|string $project_id, int $package_id) { return $this->get($this->getPackagePath($project_id, $package_id)); } @@ -78,7 +78,7 @@ public function show($project_id, int $package_id) * * @return mixed */ - public function allFiles($project_id, int $package_id) + public function allFiles(int|string $project_id, int $package_id) { return $this->get($this->getPackagePath($project_id, $package_id).'/package_files'); } @@ -88,7 +88,7 @@ public function allFiles($project_id, int $package_id) * * @return mixed */ - public function remove($project_id, int $package_id) + public function remove(int|string $project_id, int $package_id) { return $this->delete($this->getPackagePath($project_id, $package_id)); } @@ -98,7 +98,7 @@ public function remove($project_id, int $package_id) * * @return mixed */ - public function removeFile($project_id, int $package_id, int $package_file_id) + public function removeFile(int|string $project_id, int $package_id, int $package_file_id) { return $this->delete( $this->getPackagePath($project_id, $package_id).'/package_files/'.self::encodePath($package_file_id) @@ -110,7 +110,7 @@ public function removeFile($project_id, int $package_id, int $package_file_id) * * @return mixed */ - public function addGenericFile($project_id, string $package_name, string $package_version, string $file, string $status = 'default') + public function addGenericFile(int|string $project_id, string $package_name, string $package_version, string $file, string $status = 'default') { return $this->putFile( $this->getProjectPath( @@ -126,7 +126,7 @@ public function addGenericFile($project_id, string $package_name, string $packag /** * @param int|string $project_id */ - private function getPackagePath($project_id, int $package_id): string + private function getPackagePath(int|string $project_id, int $package_id): string { return $this->getProjectPath($project_id, 'packages/'.self::encodePath($package_id)); } diff --git a/src/Api/ProjectNamespaces.php b/src/Api/ProjectNamespaces.php index ac29800d..4d0228fb 100644 --- a/src/Api/ProjectNamespaces.php +++ b/src/Api/ProjectNamespaces.php @@ -37,7 +37,7 @@ public function all(array $parameters = []) * * @return mixed */ - public function show($namespace_id) + public function show(int|string $namespace_id) { return $this->get('namespaces/'.self::encodePath($namespace_id)); } diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 443d2ce1..3b195438 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -162,7 +162,7 @@ public function all(array $parameters = []) * * @return mixed */ - public function show($project_id, array $parameters = []) + public function show(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): bool { @@ -205,7 +205,7 @@ public function createForUser(int $user_id, string $name, array $parameters = [] * * @return mixed */ - public function update($project_id, array $parameters) + public function update(int|string $project_id, array $parameters) { return $this->put('projects/'.self::encodePath($project_id), $parameters); } @@ -215,7 +215,7 @@ public function update($project_id, array $parameters) * * @return mixed */ - public function remove($project_id) + public function remove(int|string $project_id) { return $this->delete('projects/'.self::encodePath($project_id)); } @@ -225,7 +225,7 @@ public function remove($project_id) * * @return mixed */ - public function archive($project_id) + public function archive(int|string $project_id) { return $this->post('projects/'.self::encodePath($project_id).'/archive'); } @@ -235,7 +235,7 @@ public function archive($project_id) * * @return mixed */ - public function unarchive($project_id) + public function unarchive(int|string $project_id) { return $this->post('projects/'.self::encodePath($project_id).'/unarchive'); } @@ -245,7 +245,7 @@ public function unarchive($project_id) * * @return mixed */ - public function triggers($project_id) + public function triggers(int|string $project_id) { return $this->get('projects/'.self::encodePath($project_id).'/triggers'); } @@ -255,7 +255,7 @@ public function triggers($project_id) * * @return mixed */ - public function trigger($project_id, int $trigger_id) + public function trigger(int|string $project_id, int $trigger_id) { return $this->get($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); } @@ -265,7 +265,7 @@ public function trigger($project_id, int $trigger_id) * * @return mixed */ - public function createTrigger($project_id, string $description) + public function createTrigger(int|string $project_id, string $description) { return $this->post($this->getProjectPath($project_id, 'triggers'), [ 'description' => $description, @@ -277,7 +277,7 @@ public function createTrigger($project_id, string $description) * * @return mixed */ - public function removeTrigger($project_id, int $trigger_id) + public function removeTrigger(int|string $project_id, int $trigger_id) { return $this->delete($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); } @@ -287,7 +287,7 @@ public function removeTrigger($project_id, int $trigger_id) * * @return mixed */ - public function triggerPipeline($project_id, string $ref, string $token, array $variables = []) + public function triggerPipeline(int|string $project_id, string $ref, string $token, array $variables = []) { return $this->post($this->getProjectPath($project_id, 'trigger/pipeline'), [ 'ref' => $ref, @@ -334,7 +334,7 @@ public function enableRunner(int $project_id, int $runner_id) * * @return mixed */ - public function pipelines($project_id, array $parameters = []) + public function pipelines(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -384,7 +384,7 @@ public function pipelines($project_id, array $parameters = []) * * @return mixed */ - public function pipeline($project_id, int $pipeline_id) + public function pipeline(int|string $project_id, int $pipeline_id) { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id))); } @@ -394,7 +394,7 @@ public function pipeline($project_id, int $pipeline_id) * * @return mixed */ - public function pipelineJobs($project_id, int $pipeline_id) + public function pipelineJobs(int|string $project_id, int $pipeline_id) { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/jobs')); } @@ -404,7 +404,7 @@ public function pipelineJobs($project_id, int $pipeline_id) * * @return mixed */ - public function pipelineVariables($project_id, int $pipeline_id) + public function pipelineVariables(int|string $project_id, int $pipeline_id) { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/variables')); } @@ -414,7 +414,7 @@ public function pipelineVariables($project_id, int $pipeline_id) * * @return mixed */ - public function pipelineTestReport($project_id, int $pipeline_id) + public function pipelineTestReport(int|string $project_id, int $pipeline_id) { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report')); } @@ -424,7 +424,7 @@ public function pipelineTestReport($project_id, int $pipeline_id) * * @return mixed */ - public function pipelineTestReportSummary($project_id, int $pipeline_id) + public function pipelineTestReportSummary(int|string $project_id, int $pipeline_id) { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report_summary')); } @@ -440,7 +440,7 @@ public function pipelineTestReportSummary($project_id, int $pipeline_id) * * @return mixed */ - public function createPipeline($project_id, string $commit_ref, ?array $variables = null) + public function createPipeline(int|string $project_id, string $commit_ref, ?array $variables = null) { $parameters = []; @@ -458,7 +458,7 @@ public function createPipeline($project_id, string $commit_ref, ?array $variable * * @return mixed */ - public function retryPipeline($project_id, int $pipeline_id) + public function retryPipeline(int|string $project_id, int $pipeline_id) { return $this->post($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id)).'/retry'); } @@ -468,7 +468,7 @@ public function retryPipeline($project_id, int $pipeline_id) * * @return mixed */ - public function cancelPipeline($project_id, int $pipeline_id) + public function cancelPipeline(int|string $project_id, int $pipeline_id) { return $this->post($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id)).'/cancel'); } @@ -478,7 +478,7 @@ public function cancelPipeline($project_id, int $pipeline_id) * * @return mixed */ - public function deletePipeline($project_id, int $pipeline_id) + public function deletePipeline(int|string $project_id, int $pipeline_id) { return $this->delete($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id))); } @@ -488,7 +488,7 @@ public function deletePipeline($project_id, int $pipeline_id) * * @return mixed */ - public function allMembers($project_id, array $parameters = []) + public function allMembers(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('query'); @@ -511,7 +511,7 @@ public function allMembers($project_id, array $parameters = []) * * @return mixed */ - public function members($project_id, array $parameters = []) + public function members(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -533,7 +533,7 @@ public function members($project_id, array $parameters = []) * * @return mixed */ - public function member($project_id, int $user_id) + public function member(int|string $project_id, int $user_id) { return $this->get($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id))); } @@ -543,7 +543,7 @@ public function member($project_id, int $user_id) * * @return mixed */ - public function allMember($project_id, int $user_id) + public function allMember(int|string $project_id, int $user_id) { return $this->get($this->getProjectPath($project_id, 'members/all/'.self::encodePath($user_id))); } @@ -553,7 +553,7 @@ public function allMember($project_id, int $user_id) * * @return mixed */ - public function addMember($project_id, int $user_id, int $access_level, ?string $expires_at = null) + public function addMember(int|string $project_id, int $user_id, int $access_level, ?string $expires_at = null) { $params = [ 'user_id' => $user_id, @@ -571,7 +571,7 @@ public function addMember($project_id, int $user_id, int $access_level, ?string * * @return mixed */ - public function saveMember($project_id, int $user_id, int $access_level, ?string $expires_at = null) + public function saveMember(int|string $project_id, int $user_id, int $access_level, ?string $expires_at = null) { $params = [ 'access_level' => $access_level, @@ -588,7 +588,7 @@ public function saveMember($project_id, int $user_id, int $access_level, ?string * * @return mixed */ - public function removeMember($project_id, int $user_id) + public function removeMember(int|string $project_id, int $user_id) { return $this->delete($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id))); } @@ -598,7 +598,7 @@ public function removeMember($project_id, int $user_id) * * @return mixed */ - public function hooks($project_id, array $parameters = []) + public function hooks(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -610,7 +610,7 @@ public function hooks($project_id, array $parameters = []) * * @return mixed */ - public function hook($project_id, int $hook_id) + public function hook(int|string $project_id, int $hook_id) { return $this->get($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id))); } @@ -624,7 +624,7 @@ public function hook($project_id, int $hook_id) * * @return mixed */ - public function users($project_id, array $parameters = []) + public function users(int|string $project_id, array $parameters = []) { return $this->get($this->getProjectPath($project_id, 'users'), $parameters); } @@ -638,7 +638,7 @@ public function users($project_id, array $parameters = []) * * @return mixed */ - public function issues($project_id, array $parameters = []) + public function issues(int|string $project_id, array $parameters = []) { return $this->get($this->getProjectPath($project_id, 'issues'), $parameters); } @@ -652,7 +652,7 @@ public function issues($project_id, array $parameters = []) * * @return mixed */ - public function boards($project_id) + public function boards(int|string $project_id) { return $this->get($this->getProjectPath($project_id, 'boards')); } @@ -669,7 +669,7 @@ public function boards($project_id) * * @return mixed */ - public function iterations($project_id, array $parameters = []) + public function iterations(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -701,7 +701,7 @@ public function iterations($project_id, array $parameters = []) * * @return mixed */ - public function getRepositoryCommitDiscussions($project_id, string $commit_id) + public function getRepositoryCommitDiscussions(int|string $project_id, string $commit_id) { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($commit_id)).'/discussions'); } @@ -711,7 +711,7 @@ public function getRepositoryCommitDiscussions($project_id, string $commit_id) * * @return mixed */ - public function addHook($project_id, string $url, array $parameters = []) + public function addHook(int|string $project_id, string $url, array $parameters = []) { if (0 === \count($parameters)) { $parameters = ['push_events' => true]; @@ -727,7 +727,7 @@ public function addHook($project_id, string $url, array $parameters = []) * * @return mixed */ - public function updateHook($project_id, int $hook_id, array $parameters) + public function updateHook(int|string $project_id, int $hook_id, array $parameters) { return $this->put($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id)), $parameters); } @@ -737,7 +737,7 @@ public function updateHook($project_id, int $hook_id, array $parameters) * * @return mixed */ - public function removeHook($project_id, int $hook_id) + public function removeHook(int|string $project_id, int $hook_id) { return $this->delete($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id))); } @@ -748,7 +748,7 @@ public function removeHook($project_id, int $hook_id) * * @return mixed */ - public function transfer($project_id, $namespace) + public function transfer(int|string $project_id, mixed $namespace) { return $this->put($this->getProjectPath($project_id, 'transfer'), ['namespace' => $namespace]); } @@ -758,7 +758,7 @@ public function transfer($project_id, $namespace) * * @return mixed */ - public function deployKeys($project_id) + public function deployKeys(int|string $project_id) { return $this->get($this->getProjectPath($project_id, 'deploy_keys')); } @@ -768,7 +768,7 @@ public function deployKeys($project_id) * * @return mixed */ - public function deployKey($project_id, int $key_id) + public function deployKey(int|string $project_id, int $key_id) { return $this->get($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id))); } @@ -778,7 +778,7 @@ public function deployKey($project_id, int $key_id) * * @return mixed */ - public function addDeployKey($project_id, string $title, string $key, bool $canPush = false) + public function addDeployKey(int|string $project_id, string $title, string $key, bool $canPush = false) { return $this->post($this->getProjectPath($project_id, 'deploy_keys'), [ 'title' => $title, @@ -792,7 +792,7 @@ public function addDeployKey($project_id, string $title, string $key, bool $canP * * @return mixed */ - public function deleteDeployKey($project_id, int $key_id) + public function deleteDeployKey(int|string $project_id, int $key_id) { return $this->delete($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id))); } @@ -802,7 +802,7 @@ public function deleteDeployKey($project_id, int $key_id) * * @return mixed */ - public function enableDeployKey($project_id, int $key_id) + public function enableDeployKey(int|string $project_id, int $key_id) { return $this->post($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id).'/enable')); } @@ -812,7 +812,7 @@ public function enableDeployKey($project_id, int $key_id) * * @return mixed */ - public function deployTokens($project_id, ?bool $active = null) + public function deployTokens(int|string $project_id, ?bool $active = null) { return $this->get($this->getProjectPath($project_id, 'deploy_tokens'), (null !== $active) ? ['active' => $active] : []); } @@ -829,7 +829,7 @@ public function deployTokens($project_id, ?bool $active = null) * * @return mixed */ - public function createDeployToken($project_id, array $parameters = []) + public function createDeployToken(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -871,7 +871,7 @@ public function createDeployToken($project_id, array $parameters = []) * * @return mixed */ - public function deleteDeployToken($project_id, int $token_id) + public function deleteDeployToken(int|string $project_id, int $token_id) { return $this->delete($this->getProjectPath($project_id, 'deploy_tokens/'.self::encodePath($token_id))); } @@ -889,7 +889,7 @@ public function deleteDeployToken($project_id, int $token_id) * * @return mixed */ - public function events($project_id, array $parameters = []) + public function events(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -927,7 +927,7 @@ public function events($project_id, array $parameters = []) * * @return mixed */ - public function labels($project_id, array $parameters = []) + public function labels(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -948,7 +948,7 @@ public function labels($project_id, array $parameters = []) * * @return mixed */ - public function addLabel($project_id, array $parameters) + public function addLabel(int|string $project_id, array $parameters) { return $this->post($this->getProjectPath($project_id, 'labels'), $parameters); } @@ -958,7 +958,7 @@ public function addLabel($project_id, array $parameters) * * @return mixed */ - public function updateLabel($project_id, int $label_id, array $parameters) + public function updateLabel(int|string $project_id, int $label_id, array $parameters) { return $this->put($this->getProjectPath($project_id, 'labels/'.self::encodePath($label_id)), $parameters); } @@ -968,7 +968,7 @@ public function updateLabel($project_id, int $label_id, array $parameters) * * @return mixed */ - public function removeLabel($project_id, int $label_id) + public function removeLabel(int|string $project_id, int $label_id) { return $this->delete($this->getProjectPath($project_id, 'labels/'.self::encodePath($label_id))); } @@ -980,7 +980,7 @@ public function removeLabel($project_id, int $label_id) * * @return mixed */ - public function languages($project_id) + public function languages(int|string $project_id) { return $this->get($this->getProjectPath($project_id, 'languages')); } @@ -1011,7 +1011,7 @@ public function languages($project_id) * * @return mixed */ - public function forks($project_id, array $parameters = []) + public function forks(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -1096,7 +1096,7 @@ public function forks($project_id, array $parameters = []) * * @return mixed */ - public function fork($project_id, array $parameters = []) + public function fork(int|string $project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setDefined(['namespace', 'path', 'name']); @@ -1112,7 +1112,7 @@ public function fork($project_id, array $parameters = []) * * @return mixed */ - public function createForkRelation($project_id, $forked_project_id) + public function createForkRelation(int|string $project_id, int|string $forked_project_id) { return $this->post($this->getProjectPath($project_id, 'fork/'.self::encodePath($forked_project_id))); } @@ -1122,7 +1122,7 @@ public function createForkRelation($project_id, $forked_project_id) * * @return mixed */ - public function removeForkRelation($project_id) + public function removeForkRelation(int|string $project_id) { return $this->delete($this->getProjectPath($project_id, 'fork')); } @@ -1132,7 +1132,7 @@ public function removeForkRelation($project_id) * * @return mixed */ - public function setService($project_id, string $service_name, array $parameters = []) + public function setService(int|string $project_id, string $service_name, array $parameters = []) { return $this->put($this->getProjectPath($project_id, 'services/'.self::encodePath($service_name)), $parameters); } @@ -1142,7 +1142,7 @@ public function setService($project_id, string $service_name, array $parameters * * @return mixed */ - public function removeService($project_id, string $service_name) + public function removeService(int|string $project_id, string $service_name) { return $this->delete($this->getProjectPath($project_id, 'services/'.self::encodePath($service_name))); } @@ -1152,7 +1152,7 @@ public function removeService($project_id, string $service_name) * * @return mixed */ - public function variables($project_id, array $parameters = []) + public function variables(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -1164,7 +1164,7 @@ public function variables($project_id, array $parameters = []) * * @return mixed */ - public function variable($project_id, string $key, array $parameters = []) + public function variable(int|string $project_id, string $key, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('filter') @@ -1182,7 +1182,7 @@ public function variable($project_id, string $key, array $parameters = []) * * @return mixed */ - public function addVariable($project_id, string $key, string $value, ?bool $protected = null, ?string $environment_scope = null, array $parameters = []) + public function addVariable(int|string $project_id, string $key, string $value, ?bool $protected = null, ?string $environment_scope = null, array $parameters = []) { $payload = [ 'key' => $key, @@ -1211,7 +1211,7 @@ public function addVariable($project_id, string $key, string $value, ?bool $prot * * @return mixed */ - public function updateVariable($project_id, string $key, string $value, ?bool $protected = null, ?string $environment_scope = null, array $parameters = []) + public function updateVariable(int|string $project_id, string $key, string $value, ?bool $protected = null, ?string $environment_scope = null, array $parameters = []) { $payload = [ 'value' => $value, @@ -1241,7 +1241,7 @@ public function updateVariable($project_id, string $key, string $value, ?bool $p * * @return mixed */ - public function removeVariable($project_id, string $key, array $parameters = []) + public function removeVariable(int|string $project_id, string $key, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setDefined('filter') @@ -1255,7 +1255,7 @@ public function removeVariable($project_id, string $key, array $parameters = []) * * @return mixed */ - public function uploadFile($project_id, string $file) + public function uploadFile(int|string $project_id, string $file) { return $this->post($this->getProjectPath($project_id, 'uploads'), [], [], ['file' => $file]); } @@ -1265,7 +1265,7 @@ public function uploadFile($project_id, string $file) * * @return mixed */ - public function uploadAvatar($project_id, string $file) + public function uploadAvatar(int|string $project_id, string $file) { return $this->put('projects/'.self::encodePath($project_id), [], [], ['avatar' => $file]); } @@ -1277,7 +1277,7 @@ public function uploadAvatar($project_id, string $file) * * @see https://docs.gitlab.com/ee/api/deployments.html#list-project-deployments */ - public function deployments($project_id, array $parameters = []) + public function deployments(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -1332,7 +1332,7 @@ public function deployments($project_id, array $parameters = []) * * @return mixed */ - public function deployment($project_id, int $deployment_id) + public function deployment(int|string $project_id, int $deployment_id) { return $this->get($this->getProjectPath($project_id, 'deployments/'.self::encodePath($deployment_id))); } @@ -1342,7 +1342,7 @@ public function deployment($project_id, int $deployment_id) * * @return mixed */ - public function addShare($project_id, array $parameters = []) + public function addShare(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -1371,7 +1371,7 @@ public function addShare($project_id, array $parameters = []) * * @return mixed */ - public function removeShare($project_id, $group_id) + public function removeShare(int|string $project_id, int|string $group_id) { return $this->delete($this->getProjectPath($project_id, 'share/'.$group_id)); } @@ -1381,7 +1381,7 @@ public function removeShare($project_id, $group_id) * * @return mixed */ - public function badges($project_id) + public function badges(int|string $project_id) { return $this->get($this->getProjectPath($project_id, 'badges')); } @@ -1391,7 +1391,7 @@ public function badges($project_id) * * @return mixed */ - public function badge($project_id, int $badge_id) + public function badge(int|string $project_id, int $badge_id) { return $this->get($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id))); } @@ -1401,7 +1401,7 @@ public function badge($project_id, int $badge_id) * * @return mixed */ - public function addBadge($project_id, array $parameters = []) + public function addBadge(int|string $project_id, array $parameters = []) { return $this->post($this->getProjectPath($project_id, 'badges'), $parameters); } @@ -1411,7 +1411,7 @@ public function addBadge($project_id, array $parameters = []) * * @return mixed */ - public function removeBadge($project_id, int $badge_id) + public function removeBadge(int|string $project_id, int $badge_id) { return $this->delete($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id))); } @@ -1421,7 +1421,7 @@ public function removeBadge($project_id, int $badge_id) * * @return mixed */ - public function updateBadge($project_id, int $badge_id, array $parameters = []) + public function updateBadge(int|string $project_id, int $badge_id, array $parameters = []) { return $this->put($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id)), $parameters); } @@ -1431,7 +1431,7 @@ public function updateBadge($project_id, int $badge_id, array $parameters = []) * * @return mixed */ - public function protectedBranches($project_id, array $parameters = []) + public function protectedBranches(int|string $project_id, array $parameters = []) { return $this->get('projects/'.self::encodePath($project_id).'/protected_branches'); } @@ -1441,7 +1441,7 @@ public function protectedBranches($project_id, array $parameters = []) * * @return mixed */ - public function addProtectedBranch($project_id, array $parameters = []) + public function addProtectedBranch(int|string $project_id, array $parameters = []) { return $this->post($this->getProjectPath($project_id, 'protected_branches'), $parameters); } @@ -1451,7 +1451,7 @@ public function addProtectedBranch($project_id, array $parameters = []) * * @return mixed */ - public function deleteProtectedBranch($project_id, string $branch_name) + public function deleteProtectedBranch(int|string $project_id, string $branch_name) { return $this->delete($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name))); } @@ -1461,7 +1461,7 @@ public function deleteProtectedBranch($project_id, string $branch_name) * * @return mixed */ - public function updateProtectedBranch($project_id, string $branch_name, array $parameters = []) + public function updateProtectedBranch(int|string $project_id, string $branch_name, array $parameters = []) { return $this->patch($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name)), $parameters); } @@ -1471,7 +1471,7 @@ public function updateProtectedBranch($project_id, string $branch_name, array $p * * @return mixed */ - public function approvalsConfiguration($project_id) + public function approvalsConfiguration(int|string $project_id) { return $this->get('projects/'.self::encodePath($project_id).'/approvals'); } @@ -1481,7 +1481,7 @@ public function approvalsConfiguration($project_id) * * @return mixed */ - public function updateApprovalsConfiguration($project_id, array $parameters = []) + public function updateApprovalsConfiguration(int|string $project_id, array $parameters = []) { return $this->post('projects/'.self::encodePath($project_id).'/approvals', $parameters); } @@ -1491,7 +1491,7 @@ public function updateApprovalsConfiguration($project_id, array $parameters = [] * * @return mixed */ - public function approvalsRules($project_id) + public function approvalsRules(int|string $project_id) { return $this->get('projects/'.self::encodePath($project_id).'/approval_rules'); } @@ -1501,7 +1501,7 @@ public function approvalsRules($project_id) * * @return mixed */ - public function createApprovalsRule($project_id, array $parameters = []) + public function createApprovalsRule(int|string $project_id, array $parameters = []) { return $this->post('projects/'.self::encodePath($project_id).'/approval_rules/', $parameters); } @@ -1511,7 +1511,7 @@ public function createApprovalsRule($project_id, array $parameters = []) * * @return mixed */ - public function updateApprovalsRule($project_id, int $approval_rule_id, array $parameters = []) + public function updateApprovalsRule(int|string $project_id, int $approval_rule_id, array $parameters = []) { return $this->put('projects/'.self::encodePath($project_id).'/approval_rules/'.self::encodePath($approval_rule_id), $parameters); } @@ -1521,7 +1521,7 @@ public function updateApprovalsRule($project_id, int $approval_rule_id, array $p * * @return mixed */ - public function deleteApprovalsRule($project_id, int $approval_rule_id) + public function deleteApprovalsRule(int|string $project_id, int $approval_rule_id) { return $this->delete('projects/'.self::encodePath($project_id).'/approval_rules/'.self::encodePath($approval_rule_id)); } @@ -1531,7 +1531,7 @@ public function deleteApprovalsRule($project_id, int $approval_rule_id) * * @return mixed */ - public function deleteAllMergedBranches($project_id) + public function deleteAllMergedBranches(int|string $project_id) { return $this->delete($this->getProjectPath($project_id, 'repository/merged_branches')); } @@ -1541,7 +1541,7 @@ public function deleteAllMergedBranches($project_id) * * @return mixed */ - public function projectAccessTokens($project_id) + public function projectAccessTokens(int|string $project_id) { return $this->get($this->getProjectPath($project_id, 'access_tokens')); } @@ -1552,7 +1552,7 @@ public function projectAccessTokens($project_id) * * @return mixed */ - public function projectAccessToken($project_id, $token_id) + public function projectAccessToken(int|string $project_id, int|string $token_id) { return $this->get($this->getProjectPath($project_id, 'access_tokens/'.self::encodePath($token_id))); } @@ -1569,7 +1569,7 @@ public function projectAccessToken($project_id, $token_id) * * @return mixed */ - public function createProjectAccessToken($project_id, array $parameters = []) + public function createProjectAccessToken(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -1614,7 +1614,7 @@ public function createProjectAccessToken($project_id, array $parameters = []) * * @return mixed */ - public function deleteProjectAccessToken($project_id, $token_id) + public function deleteProjectAccessToken(int|string $project_id, int|string $token_id) { return $this->delete($this->getProjectPath($project_id, 'access_tokens/'.$token_id)); } @@ -1624,7 +1624,7 @@ public function deleteProjectAccessToken($project_id, $token_id) * * @return mixed */ - public function protectedTags($project_id) + public function protectedTags(int|string $project_id) { return $this->get('projects/'.self::encodePath($project_id).'/protected_tags'); } @@ -1634,7 +1634,7 @@ public function protectedTags($project_id) * * @return mixed */ - public function protectedTag($project_id, string $tag_name) + public function protectedTag(int|string $project_id, string $tag_name) { return $this->get('projects/'.self::encodePath($project_id).'/protected_tags/'.self::encodePath($tag_name)); } @@ -1644,7 +1644,7 @@ public function protectedTag($project_id, string $tag_name) * * @return mixed */ - public function addProtectedTag($project_id, array $parameters = []) + public function addProtectedTag(int|string $project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setDefined('name') @@ -1677,7 +1677,7 @@ public function addProtectedTag($project_id, array $parameters = []) * * @return mixed */ - public function deleteProtectedTag($project_id, string $tag_name) + public function deleteProtectedTag(int|string $project_id, string $tag_name) { return $this->delete($this->getProjectPath($project_id, 'protected_tags/'.self::encodePath($tag_name))); } @@ -1700,7 +1700,7 @@ public function deleteProtectedTag($project_id, string $tag_name) * * @return mixed */ - public function search($id, array $parameters = []) + public function search(int|string $id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { diff --git a/src/Api/Repositories.php b/src/Api/Repositories.php index 761c280d..61981135 100644 --- a/src/Api/Repositories.php +++ b/src/Api/Repositories.php @@ -38,7 +38,7 @@ class Repositories extends AbstractApi * * @return mixed */ - public function branches($project_id, array $parameters = []) + public function branches(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('search') @@ -52,7 +52,7 @@ public function branches($project_id, array $parameters = []) * * @return mixed */ - public function branch($project_id, string $branch) + public function branch(int|string $project_id, string $branch) { return $this->get($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch))); } @@ -62,7 +62,7 @@ public function branch($project_id, string $branch) * * @return mixed */ - public function createBranch($project_id, string $branch, string $ref) + public function createBranch(int|string $project_id, string $branch, string $ref) { return $this->post($this->getProjectPath($project_id, 'repository/branches'), [ 'branch' => $branch, @@ -75,7 +75,7 @@ public function createBranch($project_id, string $branch, string $ref) * * @return mixed */ - public function deleteBranch($project_id, string $branch) + public function deleteBranch(int|string $project_id, string $branch) { return $this->delete($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch))); } @@ -85,7 +85,7 @@ public function deleteBranch($project_id, string $branch) * * @return mixed */ - public function protectBranch($project_id, string $branch, bool $devPush = false, bool $devMerge = false) + public function protectBranch(int|string $project_id, string $branch, bool $devPush = false, bool $devMerge = false) { return $this->put($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch).'/protect'), [ 'developers_can_push' => $devPush, @@ -98,7 +98,7 @@ public function protectBranch($project_id, string $branch, bool $devPush = false * * @return mixed */ - public function unprotectBranch($project_id, string $branch) + public function unprotectBranch(int|string $project_id, string $branch) { return $this->put($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch).'/unprotect')); } @@ -108,7 +108,7 @@ public function unprotectBranch($project_id, string $branch) * * @return mixed */ - public function tags($project_id, array $parameters = []) + public function tags(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('search') @@ -122,7 +122,7 @@ public function tags($project_id, array $parameters = []) * * @return mixed */ - public function createTag($project_id, string $name, string $ref, ?string $message = null) + public function createTag(int|string $project_id, string $name, string $ref, ?string $message = null) { return $this->post($this->getProjectPath($project_id, 'repository/tags'), [ 'tag_name' => $name, @@ -136,7 +136,7 @@ public function createTag($project_id, string $name, string $ref, ?string $messa * * @return mixed */ - public function createRelease($project_id, string $tag_name, string $description, ?string $name = null) + public function createRelease(int|string $project_id, string $tag_name, string $description, ?string $name = null) { return $this->post($this->getProjectPath($project_id, 'releases'), \array_filter([ 'id' => $project_id, @@ -151,7 +151,7 @@ public function createRelease($project_id, string $tag_name, string $description * * @return mixed */ - public function updateRelease($project_id, string $tag_name, string $description, ?string $name = null) + public function updateRelease(int|string $project_id, string $tag_name, string $description, ?string $name = null) { return $this->put($this->getProjectPath($project_id, 'releases/'.self::encodePath($tag_name)), \array_filter([ 'id' => $project_id, @@ -166,7 +166,7 @@ public function updateRelease($project_id, string $tag_name, string $description * * @return mixed */ - public function releases($project_id) + public function releases(int|string $project_id) { $resolver = $this->createOptionsResolver(); @@ -186,7 +186,7 @@ public function releases($project_id) * * @return mixed */ - public function commits($project_id, array $parameters = []) + public function commits(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $options, \DateTimeInterface $value): string { @@ -231,7 +231,7 @@ public function commits($project_id, array $parameters = []) * * @return mixed */ - public function commit($project_id, string $sha) + public function commit(int|string $project_id, string $sha) { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha))); } @@ -241,7 +241,7 @@ public function commit($project_id, string $sha) * * @return mixed */ - public function commitRefs($project_id, string $sha, array $parameters = []) + public function commitRefs(int|string $project_id, string $sha, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -271,7 +271,7 @@ public function commitRefs($project_id, string $sha, array $parameters = []) * * @return mixed */ - public function createCommit($project_id, array $parameters = []) + public function createCommit(int|string $project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setDefined('branch') @@ -321,7 +321,7 @@ public function createCommit($project_id, array $parameters = []) * * @return mixed */ - public function revertCommit($project_id, string $branch, string $sha) + public function revertCommit(int|string $project_id, string $branch, string $sha) { return $this->post($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/revert'), [ 'branch' => $branch, @@ -333,7 +333,7 @@ public function revertCommit($project_id, string $branch, string $sha) * * @return mixed */ - public function commitComments($project_id, string $sha, array $parameters = []) + public function commitComments(int|string $project_id, string $sha, array $parameters = []) { $resolver = $this->createOptionsResolver(); @@ -348,7 +348,7 @@ public function commitComments($project_id, string $sha, array $parameters = []) * * @return mixed */ - public function createCommitComment($project_id, string $sha, string $note, array $params = []) + public function createCommitComment(int|string $project_id, string $sha, string $note, array $params = []) { $params['note'] = $note; @@ -360,7 +360,7 @@ public function createCommitComment($project_id, string $sha, string $note, arra * * @return mixed */ - public function getCommitBuildStatus($project_id, string $sha, array $params = []) + public function getCommitBuildStatus(int|string $project_id, string $sha, array $params = []) { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/statuses'), $params); } @@ -370,7 +370,7 @@ public function getCommitBuildStatus($project_id, string $sha, array $params = [ * * @return mixed */ - public function postCommitBuildStatus($project_id, string $sha, string $state, array $params = []) + public function postCommitBuildStatus(int|string $project_id, string $sha, string $state, array $params = []) { $params['state'] = $state; @@ -382,7 +382,7 @@ public function postCommitBuildStatus($project_id, string $sha, string $state, a * * @return mixed */ - public function compare($project_id, string $fromShaOrMaster, string $toShaOrMaster, bool $straight = false, ?string $fromProjectId = null) + public function compare(int|string $project_id, string $fromShaOrMaster, string $toShaOrMaster, bool $straight = false, ?string $fromProjectId = null) { $params = [ 'from' => $fromShaOrMaster, @@ -402,7 +402,7 @@ public function compare($project_id, string $fromShaOrMaster, string $toShaOrMas * * @return mixed */ - public function diff($project_id, string $sha) + public function diff(int|string $project_id, string $sha) { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/diff')); } @@ -412,7 +412,7 @@ public function diff($project_id, string $sha) * * @return mixed */ - public function tree($project_id, array $params = []) + public function tree(int|string $project_id, array $params = []) { return $this->get($this->getProjectPath($project_id, 'repository/tree'), $params); } @@ -422,7 +422,7 @@ public function tree($project_id, array $params = []) * * @return mixed */ - public function contributors($project_id) + public function contributors(int|string $project_id) { return $this->get($this->getProjectPath($project_id, 'repository/contributors')); } @@ -433,7 +433,7 @@ public function contributors($project_id) * * @return mixed */ - public function archive($project_id, array $params = [], string $format = 'tar.gz') + public function archive(int|string $project_id, array $params = [], string $format = 'tar.gz') { return $this->get($this->getProjectPath($project_id, 'repository/archive.'.$format), $params); } @@ -443,7 +443,7 @@ public function archive($project_id, array $params = [], string $format = 'tar.g * * @return mixed */ - public function mergeBase($project_id, array $refs) + public function mergeBase(int|string $project_id, array $refs) { return $this->get($this->getProjectPath($project_id, 'repository/merge_base'), ['refs' => $refs]); } @@ -453,7 +453,7 @@ public function mergeBase($project_id, array $refs) * * @return mixed */ - public function cherryPick($project_id, string $sha, array $params = []) + public function cherryPick(int|string $project_id, string $sha, array $params = []) { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { diff --git a/src/Api/RepositoryFiles.php b/src/Api/RepositoryFiles.php index a41513ee..4913208c 100644 --- a/src/Api/RepositoryFiles.php +++ b/src/Api/RepositoryFiles.php @@ -23,7 +23,7 @@ class RepositoryFiles extends AbstractApi * * @return mixed */ - public function getFile($project_id, string $file_path, string $ref) + public function getFile(int|string $project_id, string $file_path, string $ref) { return $this->get($this->getProjectPath($project_id, 'repository/files/'.self::encodePath($file_path)), [ 'ref' => $ref, @@ -35,7 +35,7 @@ public function getFile($project_id, string $file_path, string $ref) * * @return mixed */ - public function getRawFile($project_id, string $file_path, string $ref) + public function getRawFile(int|string $project_id, string $file_path, string $ref) { return $this->get($this->getProjectPath($project_id, 'repository/files/'.self::encodePath($file_path).'/raw'), [ 'ref' => $ref, @@ -58,7 +58,7 @@ public function getRawFile($project_id, string $file_path, string $ref) * * @return mixed */ - public function createFile($project_id, array $parameters = []) + public function createFile(int|string $project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); @@ -94,7 +94,7 @@ public function createFile($project_id, array $parameters = []) * * @return mixed */ - public function updateFile($project_id, array $parameters = []) + public function updateFile(int|string $project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); @@ -128,7 +128,7 @@ public function updateFile($project_id, array $parameters = []) * * @return mixed */ - public function deleteFile($project_id, array $parameters = []) + public function deleteFile(int|string $project_id, array $parameters = []) { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); diff --git a/src/Api/ResourceIterationEvents.php b/src/Api/ResourceIterationEvents.php index e1537ab9..21028f0f 100644 --- a/src/Api/ResourceIterationEvents.php +++ b/src/Api/ResourceIterationEvents.php @@ -21,7 +21,7 @@ class ResourceIterationEvents extends AbstractApi * * @return mixed */ - public function all($project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid) { $path = 'issues/'.self::encodePath($issue_iid).'/resource_iteration_events'; @@ -33,7 +33,7 @@ public function all($project_id, int $issue_iid) * * @return mixed */ - public function show($project_id, int $issue_iid, int $resource_iteration_event_id) + public function show(int|string $project_id, int $issue_iid, int $resource_iteration_event_id) { $path = 'issues/'.self::encodePath($issue_iid).'/resource_iteration_events/'; $path .= self::encodePath($resource_iteration_event_id); diff --git a/src/Api/ResourceLabelEvents.php b/src/Api/ResourceLabelEvents.php index 447fd0e6..446c227b 100644 --- a/src/Api/ResourceLabelEvents.php +++ b/src/Api/ResourceLabelEvents.php @@ -21,7 +21,7 @@ class ResourceLabelEvents extends AbstractApi * * @return mixed */ - public function all($project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid) { $path = 'issues/'.self::encodePath($issue_iid).'/resource_label_events'; @@ -33,7 +33,7 @@ public function all($project_id, int $issue_iid) * * @return mixed */ - public function show($project_id, int $issue_iid, int $resource_label_event_id) + public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id) { $path = 'issues/'.self::encodePath($issue_iid).'/resource_label_events/'; $path .= self::encodePath($resource_label_event_id); diff --git a/src/Api/ResourceMilestoneEvents.php b/src/Api/ResourceMilestoneEvents.php index 7921fee4..7c5ad3a2 100644 --- a/src/Api/ResourceMilestoneEvents.php +++ b/src/Api/ResourceMilestoneEvents.php @@ -21,7 +21,7 @@ class ResourceMilestoneEvents extends AbstractApi * * @return mixed */ - public function all($project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid) { $path = 'issues/'.self::encodePath($issue_iid).'/resource_milestone_events'; @@ -33,7 +33,7 @@ public function all($project_id, int $issue_iid) * * @return mixed */ - public function show($project_id, int $issue_iid, int $resource_milestone_event_id) + public function show(int|string $project_id, int $issue_iid, int $resource_milestone_event_id) { $path = 'issues/'.self::encodePath($issue_iid).'/resource_milestone_events/'; $path .= self::encodePath($resource_milestone_event_id); diff --git a/src/Api/ResourceStateEvents.php b/src/Api/ResourceStateEvents.php index ae5042cb..29d817c8 100644 --- a/src/Api/ResourceStateEvents.php +++ b/src/Api/ResourceStateEvents.php @@ -21,7 +21,7 @@ class ResourceStateEvents extends AbstractApi * * @return mixed */ - public function all($project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid) { $path = 'issues/'.self::encodePath($issue_iid).'/resource_state_events'; @@ -33,7 +33,7 @@ public function all($project_id, int $issue_iid) * * @return mixed */ - public function show($project_id, int $issue_iid, int $resource_label_event_id) + public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id) { $path = 'issues/'.self::encodePath($issue_iid).'/resource_state_events/'; $path .= self::encodePath($resource_label_event_id); diff --git a/src/Api/ResourceWeightEvents.php b/src/Api/ResourceWeightEvents.php index d689855c..34e617a7 100644 --- a/src/Api/ResourceWeightEvents.php +++ b/src/Api/ResourceWeightEvents.php @@ -21,7 +21,7 @@ class ResourceWeightEvents extends AbstractApi * * @return mixed */ - public function all($project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid) { $path = 'issues/'.self::encodePath($issue_iid).'/resource_weight_events'; @@ -33,7 +33,7 @@ public function all($project_id, int $issue_iid) * * @return mixed */ - public function show($project_id, int $issue_iid, int $resource_label_event_id) + public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id) { $path = 'issues/'.self::encodePath($issue_iid).'/resource_weight_events/'; $path .= self::encodePath($resource_label_event_id); diff --git a/src/Api/Schedules.php b/src/Api/Schedules.php index e6e96f81..c0b5dd26 100644 --- a/src/Api/Schedules.php +++ b/src/Api/Schedules.php @@ -21,7 +21,7 @@ class Schedules extends AbstractApi * * @return mixed */ - public function create($project_id, array $params) + public function create(int|string $project_id, array $params) { return $this->post($this->getProjectPath($project_id, 'pipeline_schedules'), $params); } @@ -31,7 +31,7 @@ public function create($project_id, array $params) * * @return mixed */ - public function show($project_id, int $schedule_id) + public function show(int|string $project_id, int $schedule_id) { return $this->get($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id))); } @@ -41,7 +41,7 @@ public function show($project_id, int $schedule_id) * * @return mixed */ - public function showAll($project_id) + public function showAll(int|string $project_id) { return $this->get($this->getProjectPath($project_id, 'pipeline_schedules')); } @@ -51,7 +51,7 @@ public function showAll($project_id) * * @return mixed */ - public function update($project_id, int $schedule_id, array $params) + public function update(int|string $project_id, int $schedule_id, array $params) { return $this->put($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)), $params); } @@ -61,7 +61,7 @@ public function update($project_id, int $schedule_id, array $params) * * @return mixed */ - public function remove($project_id, int $schedule_id) + public function remove(int|string $project_id, int $schedule_id) { return $this->delete($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id))); } @@ -71,7 +71,7 @@ public function remove($project_id, int $schedule_id) * * @return mixed */ - public function addVariable($project_id, int $schedule_id, array $params) + public function addVariable(int|string $project_id, int $schedule_id, array $params) { $path = 'pipeline_schedules/'.self::encodePath($schedule_id).'/variables'; @@ -83,7 +83,7 @@ public function addVariable($project_id, int $schedule_id, array $params) * * @return mixed */ - public function updateVariable($project_id, int $schedule_id, string $variable_key, array $params) + public function updateVariable(int|string $project_id, int $schedule_id, string $variable_key, array $params) { $path = 'pipeline_schedules/'.self::encodePath($schedule_id).'/variables/'.self::encodePath($variable_key); @@ -95,7 +95,7 @@ public function updateVariable($project_id, int $schedule_id, string $variable_k * * @return mixed */ - public function removeVariable($project_id, int $schedule_id, string $variable_key) + public function removeVariable(int|string $project_id, int $schedule_id, string $variable_key) { $path = 'pipeline_schedules/'.self::encodePath($schedule_id).'/variables/'.self::encodePath($variable_key); @@ -107,7 +107,7 @@ public function removeVariable($project_id, int $schedule_id, string $variable_k * * @return mixed */ - public function takeOwnership($project_id, int $schedule_id) + public function takeOwnership(int|string $project_id, int $schedule_id) { return $this->post($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)).'/take_ownership'); } @@ -117,7 +117,7 @@ public function takeOwnership($project_id, int $schedule_id) * * @return mixed */ - public function play($project_id, int $schedule_id) + public function play(int|string $project_id, int $schedule_id) { return $this->post($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)).'/play'); } diff --git a/src/Api/Snippets.php b/src/Api/Snippets.php index 58df8b7b..72679081 100644 --- a/src/Api/Snippets.php +++ b/src/Api/Snippets.php @@ -21,7 +21,7 @@ class Snippets extends AbstractApi * * @return mixed */ - public function all($project_id) + public function all(int|string $project_id) { return $this->get($this->getProjectPath($project_id, 'snippets')); } @@ -31,7 +31,7 @@ public function all($project_id) * * @return mixed */ - public function show($project_id, int $snippet_id) + public function show(int|string $project_id, int $snippet_id) { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id))); } @@ -41,7 +41,7 @@ public function show($project_id, int $snippet_id) * * @return mixed */ - public function create($project_id, string $title, string $filename, string $code, string $visibility) + public function create(int|string $project_id, string $title, string $filename, string $code, string $visibility) { return $this->post($this->getProjectPath($project_id, 'snippets'), [ 'title' => $title, @@ -56,7 +56,7 @@ public function create($project_id, string $title, string $filename, string $cod * * @return mixed */ - public function update($project_id, int $snippet_id, array $params) + public function update(int|string $project_id, int $snippet_id, array $params) { return $this->put($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id)), $params); } @@ -66,7 +66,7 @@ public function update($project_id, int $snippet_id, array $params) * * @return mixed */ - public function content($project_id, int $snippet_id) + public function content(int|string $project_id, int $snippet_id) { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/raw')); } @@ -76,7 +76,7 @@ public function content($project_id, int $snippet_id) * * @return mixed */ - public function remove($project_id, int $snippet_id) + public function remove(int|string $project_id, int $snippet_id) { return $this->delete($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id))); } @@ -86,7 +86,7 @@ public function remove($project_id, int $snippet_id) * * @return mixed */ - public function showNotes($project_id, int $snippet_id) + public function showNotes(int|string $project_id, int $snippet_id) { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes')); } @@ -96,7 +96,7 @@ public function showNotes($project_id, int $snippet_id) * * @return mixed */ - public function showNote($project_id, int $snippet_id, int $note_id) + public function showNote(int|string $project_id, int $snippet_id, int $note_id) { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes/'.self::encodePath($note_id))); } @@ -106,7 +106,7 @@ public function showNote($project_id, int $snippet_id, int $note_id) * * @return mixed */ - public function addNote($project_id, int $snippet_id, string $body, array $params = []) + public function addNote(int|string $project_id, int $snippet_id, string $body, array $params = []) { $params['body'] = $body; @@ -118,7 +118,7 @@ public function addNote($project_id, int $snippet_id, string $body, array $param * * @return mixed */ - public function updateNote($project_id, int $snippet_id, int $note_id, string $body) + public function updateNote(int|string $project_id, int $snippet_id, int $note_id, string $body) { return $this->put($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes/'.self::encodePath($note_id)), [ 'body' => $body, @@ -130,7 +130,7 @@ public function updateNote($project_id, int $snippet_id, int $note_id, string $b * * @return mixed */ - public function removeNote($project_id, int $snippet_id, int $note_id) + public function removeNote(int|string $project_id, int $snippet_id, int $note_id) { return $this->delete($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes/'.self::encodePath($note_id))); } @@ -140,7 +140,7 @@ public function removeNote($project_id, int $snippet_id, int $note_id) * * @return mixed */ - public function awardEmoji($project_id, int $snippet_id) + public function awardEmoji(int|string $project_id, int $snippet_id) { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/award_emoji')); } @@ -150,7 +150,7 @@ public function awardEmoji($project_id, int $snippet_id) * * @return mixed */ - public function removeAwardEmoji($project_id, int $snippet_id, int $award_id) + public function removeAwardEmoji(int|string $project_id, int $snippet_id, int $award_id) { return $this->delete($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/award_emoji/'.self::encodePath($award_id))); } diff --git a/src/Api/Tags.php b/src/Api/Tags.php index c82c1147..edd0063c 100644 --- a/src/Api/Tags.php +++ b/src/Api/Tags.php @@ -28,7 +28,7 @@ class Tags extends AbstractApi * * @return mixed */ - public function all($project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('order_by') @@ -45,7 +45,7 @@ public function all($project_id, array $parameters = []) * * @return mixed */ - public function show($project_id, string $tag_name) + public function show(int|string $project_id, string $tag_name) { return $this->get($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name))); } @@ -55,7 +55,7 @@ public function show($project_id, string $tag_name) * * @return mixed */ - public function create($project_id, array $params = []) + public function create(int|string $project_id, array $params = []) { return $this->post($this->getProjectPath($project_id, 'repository/tags'), $params); } @@ -65,7 +65,7 @@ public function create($project_id, array $params = []) * * @return mixed */ - public function remove($project_id, string $tag_name) + public function remove(int|string $project_id, string $tag_name) { return $this->delete($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name))); } @@ -75,7 +75,7 @@ public function remove($project_id, string $tag_name) * * @return mixed */ - public function createRelease($project_id, string $tag_name, array $params = []) + public function createRelease(int|string $project_id, string $tag_name, array $params = []) { return $this->post($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name).'/release'), $params); } @@ -85,7 +85,7 @@ public function createRelease($project_id, string $tag_name, array $params = []) * * @return mixed */ - public function updateRelease($project_id, string $tag_name, array $params = []) + public function updateRelease(int|string $project_id, string $tag_name, array $params = []) { return $this->put($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name).'/release'), $params); } diff --git a/src/Api/Wiki.php b/src/Api/Wiki.php index 7dcb0827..18ef7269 100644 --- a/src/Api/Wiki.php +++ b/src/Api/Wiki.php @@ -22,7 +22,7 @@ class Wiki extends AbstractApi * * @return mixed */ - public function create($project_id, array $params) + public function create(int|string $project_id, array $params) { return $this->post($this->getProjectPath($project_id, 'wikis'), $params); } @@ -32,7 +32,7 @@ public function create($project_id, array $params) * * @return mixed */ - public function show($project_id, string $wiki_slug) + public function show(int|string $project_id, string $wiki_slug) { return $this->get($this->getProjectPath($project_id, 'wikis/'.self::encodePath($wiki_slug))); } @@ -46,7 +46,7 @@ public function show($project_id, string $wiki_slug) * * @return mixed */ - public function showAll($project_id, array $params) + public function showAll(int|string $project_id, array $params) { $resolver = $this->createOptionsResolver(); $resolver->setDefined('with_content') @@ -61,7 +61,7 @@ public function showAll($project_id, array $params) * * @return mixed */ - public function update($project_id, string $wiki_slug, array $params) + public function update(int|string $project_id, string $wiki_slug, array $params) { return $this->put($this->getProjectPath($project_id, 'wikis/'.self::encodePath($wiki_slug)), $params); } @@ -71,7 +71,7 @@ public function update($project_id, string $wiki_slug, array $params) * * @return mixed */ - public function remove($project_id, string $wiki_slug) + public function remove(int|string $project_id, string $wiki_slug) { return $this->delete($this->getProjectPath($project_id, 'wikis/'.self::encodePath($wiki_slug))); } diff --git a/src/HttpClient/Util/QueryStringBuilder.php b/src/HttpClient/Util/QueryStringBuilder.php index 82a0b59c..1f0898e1 100644 --- a/src/HttpClient/Util/QueryStringBuilder.php +++ b/src/HttpClient/Util/QueryStringBuilder.php @@ -38,7 +38,7 @@ public static function build(array $query): string * @param mixed $query * @param scalar $prefix */ - private static function encode($query, $prefix): string + private static function encode(mixed $query, scalar $prefix): string { if (!\is_array($query)) { return self::rawurlencode($prefix).'='.self::rawurlencode($query); @@ -70,7 +70,7 @@ private static function isList(array $query): bool * * @param mixed $value */ - private static function rawurlencode($value): string + private static function rawurlencode(mixed $value): string { if (false === $value) { return '0'; From ac2860f83ac9c8e4674df4fb59214be07ff8e9eb Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 23 Feb 2025 16:54:04 +0000 Subject: [PATCH 098/117] Apply fixes from StyleCI --- src/Api/AbstractApi.php | 6 - src/Api/Deployments.php | 3 - src/Api/Environments.php | 9 -- src/Api/Groups.php | 51 ------ src/Api/GroupsBoards.php | 20 --- src/Api/GroupsEpics.php | 11 -- src/Api/GroupsMilestones.php | 13 -- src/Api/IssueBoards.php | 20 --- src/Api/IssueLinks.php | 6 - src/Api/Issues.php | 62 ------- src/Api/IssuesStatistics.php | 4 - src/Api/Jobs.php | 26 --- src/Api/MergeRequests.php | 59 ------- src/Api/Milestones.php | 13 -- src/Api/Packages.php | 14 -- src/Api/ProjectNamespaces.php | 2 - src/Api/Projects.php | 178 --------------------- src/Api/Repositories.php | 50 ------ src/Api/RepositoryFiles.php | 7 - src/Api/ResourceIterationEvents.php | 4 - src/Api/ResourceLabelEvents.php | 4 - src/Api/ResourceMilestoneEvents.php | 4 - src/Api/ResourceStateEvents.php | 4 - src/Api/ResourceWeightEvents.php | 4 - src/Api/Schedules.php | 20 --- src/Api/Snippets.php | 26 --- src/Api/Tags.php | 11 -- src/Api/Wiki.php | 7 - src/HttpClient/Util/QueryStringBuilder.php | 5 - 29 files changed, 643 deletions(-) diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index e6675efb..8a98e4c5 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -205,17 +205,11 @@ protected function delete(string $uri, array $params = [], array $headers = []) return ResponseMediator::getContent($response); } - /** - * @param int|string $uri - */ protected static function encodePath(int|string $uri): string { return \rawurlencode((string) $uri); } - /** - * @param int|string $id - */ protected function getProjectPath(int|string $id, string $uri): string { return 'projects/'.self::encodePath($id).'/'.$uri; diff --git a/src/Api/Deployments.php b/src/Api/Deployments.php index 3da55267..7987f4da 100644 --- a/src/Api/Deployments.php +++ b/src/Api/Deployments.php @@ -17,7 +17,6 @@ class Deployments extends AbstractApi { /** - * @param int|string $project_id * @param array $parameters { * * @var string $order_by Return deployments ordered by id, iid, created_at, updated_at, @@ -50,8 +49,6 @@ public function all(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $deployment_id) diff --git a/src/Api/Environments.php b/src/Api/Environments.php index eb6d5b4a..22cab930 100644 --- a/src/Api/Environments.php +++ b/src/Api/Environments.php @@ -19,8 +19,6 @@ class Environments extends AbstractApi { /** - * @param int|string $project_id - * * @return mixed */ public function all(int|string $project_id, array $parameters = []) @@ -38,7 +36,6 @@ public function all(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id * @param array $parameters { * * @var string $name The name of the environment @@ -63,8 +60,6 @@ public function create(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function remove(int|string $project_id, int $environment_id) @@ -73,8 +68,6 @@ public function remove(int|string $project_id, int $environment_id) } /** - * @param int|string $project_id - * * @return mixed */ public function stop(int|string $project_id, int $environment_id) @@ -83,8 +76,6 @@ public function stop(int|string $project_id, int $environment_id) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $environment_id) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index f5c5b928..0128cf6d 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -70,8 +70,6 @@ public function all(array $parameters = []) } /** - * @param int|string $id - * * @return mixed */ public function show(int|string $id) @@ -101,8 +99,6 @@ public function create(string $name, string $path, ?string $description = null, } /** - * @param int|string $id - * * @return mixed */ public function update(int|string $id, array $params) @@ -111,8 +107,6 @@ public function update(int|string $id, array $params) } /** - * @param int|string $group_id - * * @return mixed */ public function remove(int|string $group_id) @@ -121,9 +115,6 @@ public function remove(int|string $group_id) } /** - * @param int|string $group_id - * @param int|string $project_id - * * @return mixed */ public function transfer(int|string $group_id, int|string $project_id) @@ -132,8 +123,6 @@ public function transfer(int|string $group_id, int|string $project_id) } /** - * @param int|string $group_id - * * @return mixed */ public function allMembers(int|string $group_id, array $parameters = []) @@ -151,7 +140,6 @@ public function allMembers(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id * @param array $parameters { * * @var string $query A query string to search for members. @@ -174,8 +162,6 @@ public function members(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id - * * @return mixed */ public function member(int|string $group_id, int $user_id) @@ -184,8 +170,6 @@ public function member(int|string $group_id, int $user_id) } /** - * @param int|string $group_id - * * @return mixed */ public function allMember(int|string $group_id, int $user_id) @@ -194,8 +178,6 @@ public function allMember(int|string $group_id, int $user_id) } /** - * @param int|string $group_id - * * @return mixed */ public function addMember(int|string $group_id, int $user_id, int $access_level, array $parameters = []) @@ -219,8 +201,6 @@ public function addMember(int|string $group_id, int $user_id, int $access_level, } /** - * @param int|string $group_id - * * @return mixed */ public function saveMember(int|string $group_id, int $user_id, int $access_level) @@ -231,7 +211,6 @@ public function saveMember(int|string $group_id, int $user_id, int $access_level } /** - * @param int|string $group_id * @param array $parameters { * * @var int $group_access the access level to grant the group @@ -264,8 +243,6 @@ public function addShare(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id - * * @return mixed */ public function removeMember(int|string $group_id, int $user_id) @@ -274,7 +251,6 @@ public function removeMember(int|string $group_id, int $user_id) } /** - * @param int|string $id * @param array $parameters { * * @var bool $archived limit by archived status @@ -353,7 +329,6 @@ public function projects(int|string $id, array $parameters = []) } /** - * @param int|string $group_id * @param array $parameters { * * @var int[] $skip_groups skip the group IDs passes @@ -375,7 +350,6 @@ public function subgroups(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id * @param array $parameters { * * @var string $assignee_id Return issues assigned to the given user id. Mutually exclusive with assignee_username. @@ -488,7 +462,6 @@ public function issues(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id * @param array $parameters { * * @var bool $with_counts Whether or not to include issue and merge request counts. Defaults to false. @@ -523,8 +496,6 @@ public function labels(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id - * * @return mixed */ public function addLabel(int|string $group_id, array $params) @@ -533,8 +504,6 @@ public function addLabel(int|string $group_id, array $params) } /** - * @param int|string $group_id - * * @return mixed */ public function updateLabel(int|string $group_id, int $label_id, array $params) @@ -543,8 +512,6 @@ public function updateLabel(int|string $group_id, int $label_id, array $params) } /** - * @param int|string $group_id - * * @return mixed */ public function removeLabel(int|string $group_id, int $label_id) @@ -553,8 +520,6 @@ public function removeLabel(int|string $group_id, int $label_id) } /** - * @param int|string $group_id - * * @return mixed */ public function variables(int|string $group_id, array $parameters = []) @@ -565,8 +530,6 @@ public function variables(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id - * * @return mixed */ public function variable(int|string $group_id, string $key) @@ -575,7 +538,6 @@ public function variable(int|string $group_id, string $key) } /** - * @param int|string $group_id * @param array $parameters { * * @var string $masked true or false @@ -607,8 +569,6 @@ public function addVariable(int|string $group_id, string $key, string $value, ?b } /** - * @param int|string $group_id - * * @return mixed */ public function updateVariable(int|string $group_id, string $key, string $value, ?bool $protected = null) @@ -625,8 +585,6 @@ public function updateVariable(int|string $group_id, string $key, string $value, } /** - * @param int|string $group_id - * * @return mixed */ public function removeVariable(int|string $group_id, string $key) @@ -635,7 +593,6 @@ public function removeVariable(int|string $group_id, string $key) } /** - * @param int|string $group_id * @param array $parameters { * * @var int[] $iids return the request having the given iid @@ -737,7 +694,6 @@ public function mergeRequests(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id * @param array $parameters { * * @var string $state Return opened, upcoming, current (previously started), closed, or all iterations. @@ -768,7 +724,6 @@ public function iterations(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id * @param array $parameters { * * @var bool $exclude_subgroups if the parameter is included as true, packages from projects from subgroups @@ -880,8 +835,6 @@ private function getSubgroupSearchResolver() } /** - * @param int|string $group_id - * * @return mixed */ public function deployTokens(int|string $group_id, ?bool $active = null) @@ -890,7 +843,6 @@ public function deployTokens(int|string $group_id, ?bool $active = null) } /** - * @param int|string $group_id * @param array $parameters { * * @var string $name the name of the deploy token @@ -939,8 +891,6 @@ public function createDeployToken(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id - * * @return mixed */ public function deleteDeployToken(int|string $group_id, int $token_id) @@ -949,7 +899,6 @@ public function deleteDeployToken(int|string $group_id, int $token_id) } /** - * @param int|string $id * @param array $parameters { * * @var string $scope The scope to search in diff --git a/src/Api/GroupsBoards.php b/src/Api/GroupsBoards.php index 6cf6b03f..bc52d73d 100644 --- a/src/Api/GroupsBoards.php +++ b/src/Api/GroupsBoards.php @@ -17,8 +17,6 @@ class GroupsBoards extends AbstractApi { /** - * @param int|string|null $group_id - * * @return mixed */ public function all(int|string|null $group_id = null, array $parameters = []) @@ -31,8 +29,6 @@ public function all(int|string|null $group_id = null, array $parameters = []) } /** - * @param int|string $group_id - * * @return mixed */ public function show(int|string $group_id, int $board_id) @@ -41,8 +37,6 @@ public function show(int|string $group_id, int $board_id) } /** - * @param int|string $group_id - * * @return mixed */ public function create(int|string $group_id, array $params) @@ -51,8 +45,6 @@ public function create(int|string $group_id, array $params) } /** - * @param int|string $group_id - * * @return mixed */ public function update(int|string $group_id, int $board_id, array $params) @@ -61,8 +53,6 @@ public function update(int|string $group_id, int $board_id, array $params) } /** - * @param int|string $group_id - * * @return mixed */ public function remove(int|string $group_id, int $board_id) @@ -71,8 +61,6 @@ public function remove(int|string $group_id, int $board_id) } /** - * @param int|string $group_id - * * @return mixed */ public function allLists(int|string $group_id, int $board_id) @@ -81,8 +69,6 @@ public function allLists(int|string $group_id, int $board_id) } /** - * @param int|string $group_id - * * @return mixed */ public function showList(int|string $group_id, int $board_id, int $list_id) @@ -91,8 +77,6 @@ public function showList(int|string $group_id, int $board_id, int $list_id) } /** - * @param int|string $group_id - * * @return mixed */ public function createList(int|string $group_id, int $board_id, int $label_id) @@ -105,8 +89,6 @@ public function createList(int|string $group_id, int $board_id, int $label_id) } /** - * @param int|string $group_id - * * @return mixed */ public function updateList(int|string $group_id, int $board_id, int $list_id, int $position) @@ -119,8 +101,6 @@ public function updateList(int|string $group_id, int $board_id, int $list_id, in } /** - * @param int|string $group_id - * * @return mixed */ public function deleteList(int|string $group_id, int $board_id, int $list_id) diff --git a/src/Api/GroupsEpics.php b/src/Api/GroupsEpics.php index 8f139808..9200ba5a 100644 --- a/src/Api/GroupsEpics.php +++ b/src/Api/GroupsEpics.php @@ -32,7 +32,6 @@ class GroupsEpics extends AbstractApi public const STATE_CLOSED = 'closed'; /** - * @param int|string $group_id * @param array $parameters { * * @var int[] $iids return only the epics having the given iids @@ -60,8 +59,6 @@ public function all(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id - * * @return mixed */ public function show(int|string $group_id, int $epic_id) @@ -70,8 +67,6 @@ public function show(int|string $group_id, int $epic_id) } /** - * @param int|string $group_id - * * @return mixed */ public function create(int|string $group_id, array $params) @@ -80,8 +75,6 @@ public function create(int|string $group_id, array $params) } /** - * @param int|string $group_id - * * @return mixed */ public function update(int|string $group_id, int $epic_id, array $params) @@ -90,8 +83,6 @@ public function update(int|string $group_id, int $epic_id, array $params) } /** - * @param int|string $group_id - * * @return mixed */ public function remove(int|string $group_id, int $epic_id) @@ -100,8 +91,6 @@ public function remove(int|string $group_id, int $epic_id) } /** - * @param int|string $group_id - * * @return mixed */ public function issues(int|string $group_id, int $epic_iid) diff --git a/src/Api/GroupsMilestones.php b/src/Api/GroupsMilestones.php index 5d8c7b83..47b03687 100644 --- a/src/Api/GroupsMilestones.php +++ b/src/Api/GroupsMilestones.php @@ -29,7 +29,6 @@ class GroupsMilestones extends AbstractApi public const STATE_CLOSED = 'closed'; /** - * @param int|string $group_id * @param array $parameters { * * @var int[] $iids return only the milestones having the given iids @@ -71,8 +70,6 @@ public function all(int|string $group_id, array $parameters = []) } /** - * @param int|string $group_id - * * @return mixed */ public function show(int|string $group_id, int $milestone_id) @@ -81,8 +78,6 @@ public function show(int|string $group_id, int $milestone_id) } /** - * @param int|string $group_id - * * @return mixed */ public function create(int|string $group_id, array $params) @@ -91,8 +86,6 @@ public function create(int|string $group_id, array $params) } /** - * @param int|string $group_id - * * @return mixed */ public function update(int|string $group_id, int $milestone_id, array $params) @@ -101,8 +94,6 @@ public function update(int|string $group_id, int $milestone_id, array $params) } /** - * @param int|string $group_id - * * @return mixed */ public function remove(int|string $group_id, int $milestone_id) @@ -111,8 +102,6 @@ public function remove(int|string $group_id, int $milestone_id) } /** - * @param int|string $group_id - * * @return mixed */ public function issues(int|string $group_id, int $milestone_id) @@ -121,8 +110,6 @@ public function issues(int|string $group_id, int $milestone_id) } /** - * @param int|string $group_id - * * @return mixed */ public function mergeRequests(int|string $group_id, int $milestone_id) diff --git a/src/Api/IssueBoards.php b/src/Api/IssueBoards.php index 9367364f..38d07f8b 100644 --- a/src/Api/IssueBoards.php +++ b/src/Api/IssueBoards.php @@ -17,8 +17,6 @@ class IssueBoards extends AbstractApi { /** - * @param int|string|null $project_id - * * @return mixed */ public function all(int|string|null $project_id = null, array $parameters = []) @@ -31,8 +29,6 @@ public function all(int|string|null $project_id = null, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $board_id) @@ -41,8 +37,6 @@ public function show(int|string $project_id, int $board_id) } /** - * @param int|string $project_id - * * @return mixed */ public function create(int|string $project_id, array $params) @@ -51,8 +45,6 @@ public function create(int|string $project_id, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function update(int|string $project_id, int $board_id, array $params) @@ -61,8 +53,6 @@ public function update(int|string $project_id, int $board_id, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function remove(int|string $project_id, int $board_id) @@ -71,8 +61,6 @@ public function remove(int|string $project_id, int $board_id) } /** - * @param int|string $project_id - * * @return mixed */ public function allLists(int|string $project_id, int $board_id) @@ -81,8 +69,6 @@ public function allLists(int|string $project_id, int $board_id) } /** - * @param int|string $project_id - * * @return mixed */ public function showList(int|string $project_id, int $board_id, int $list_id) @@ -91,8 +77,6 @@ public function showList(int|string $project_id, int $board_id, int $list_id) } /** - * @param int|string $project_id - * * @return mixed */ public function createList(int|string $project_id, int $board_id, int $label_id) @@ -105,8 +89,6 @@ public function createList(int|string $project_id, int $board_id, int $label_id) } /** - * @param int|string $project_id - * * @return mixed */ public function updateList(int|string $project_id, int $board_id, int $list_id, int $position) @@ -119,8 +101,6 @@ public function updateList(int|string $project_id, int $board_id, int $list_id, } /** - * @param int|string $project_id - * * @return mixed */ public function deleteList(int|string $project_id, int $board_id, int $list_id) diff --git a/src/Api/IssueLinks.php b/src/Api/IssueLinks.php index 07f308c1..ea08f882 100644 --- a/src/Api/IssueLinks.php +++ b/src/Api/IssueLinks.php @@ -17,8 +17,6 @@ class IssueLinks extends AbstractApi { /** - * @param int|string $project_id - * * @return mixed */ public function all(int|string $project_id, int $issue_iid) @@ -27,8 +25,6 @@ public function all(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * @param int|string $target_project_id * @param array $parameters { * * @var string $link_type @@ -45,8 +41,6 @@ public function create(int|string $project_id, int $issue_iid, int|string $targe } /** - * @param int|string $project_id - * @param int|string $issue_link_id * @param array $parameters { * * @var string $link_type diff --git a/src/Api/Issues.php b/src/Api/Issues.php index 6a85ead7..eab1cd1f 100644 --- a/src/Api/Issues.php +++ b/src/Api/Issues.php @@ -30,7 +30,6 @@ class Issues extends AbstractApi public const STATE_CLOSED = 'closed'; /** - * @param int|string|null $project_id * @param array $parameters { * * @var string $state return all issues or just those that are opened or closed @@ -59,8 +58,6 @@ public function all(int|string|null $project_id = null, array $parameters = []) } /** - * @param int|string $group_id - * * @return mixed */ public function group(int|string $group_id, array $parameters = []) @@ -72,8 +69,6 @@ public function group(int|string $group_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $issue_iid) @@ -82,8 +77,6 @@ public function show(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function create(int|string $project_id, array $params) @@ -92,8 +85,6 @@ public function create(int|string $project_id, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function update(int|string $project_id, int $issue_iid, array $params) @@ -102,8 +93,6 @@ public function update(int|string $project_id, int $issue_iid, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function reorder(int|string $project_id, int $issue_iid, array $params) @@ -112,9 +101,6 @@ public function reorder(int|string $project_id, int $issue_iid, array $params) } /** - * @param int|string $project_id - * @param int|string $to_project_id - * * @return mixed */ public function move(int|string $project_id, int $issue_iid, int|string $to_project_id) @@ -125,8 +111,6 @@ public function move(int|string $project_id, int $issue_iid, int|string $to_proj } /** - * @param int|string $project_id - * * @return mixed */ public function remove(int|string $project_id, int $issue_iid) @@ -135,8 +119,6 @@ public function remove(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function showNotes(int|string $project_id, int $issue_iid) @@ -145,8 +127,6 @@ public function showNotes(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function showNote(int|string $project_id, int $issue_iid, int $note_id) @@ -155,8 +135,6 @@ public function showNote(int|string $project_id, int $issue_iid, int $note_id) } /** - * @param int|string $project_id - * * @return mixed */ public function addNote(int|string $project_id, int $issue_iid, string $body, array $params = []) @@ -167,8 +145,6 @@ public function addNote(int|string $project_id, int $issue_iid, string $body, ar } /** - * @param int|string $project_id - * * @return mixed */ public function updateNote(int|string $project_id, int $issue_iid, int $note_id, string $body, array $params = []) @@ -179,8 +155,6 @@ public function updateNote(int|string $project_id, int $issue_iid, int $note_id, } /** - * @param int|string $project_id - * * @return mixed */ public function removeNote(int|string $project_id, int $issue_iid, int $note_id) @@ -189,8 +163,6 @@ public function removeNote(int|string $project_id, int $issue_iid, int $note_id) } /** - * @param int|string $project_id - * * @return mixed */ public function showDiscussions(int|string $project_id, int $issue_iid) @@ -199,8 +171,6 @@ public function showDiscussions(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function showDiscussion(int|string $project_id, int $issue_iid, string $discussion_id) @@ -209,8 +179,6 @@ public function showDiscussion(int|string $project_id, int $issue_iid, string $d } /** - * @param int|string $project_id - * * @return mixed */ public function addDiscussion(int|string $project_id, int $issue_iid, string $body) @@ -219,8 +187,6 @@ public function addDiscussion(int|string $project_id, int $issue_iid, string $bo } /** - * @param int|string $project_id - * * @return mixed */ public function addDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, string $body) @@ -229,8 +195,6 @@ public function addDiscussionNote(int|string $project_id, int $issue_iid, string } /** - * @param int|string $project_id - * * @return mixed */ public function updateDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, int $note_id, string $body) @@ -241,8 +205,6 @@ public function updateDiscussionNote(int|string $project_id, int $issue_iid, str } /** - * @param int|string $project_id - * * @return mixed */ public function removeDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, int $note_id) @@ -251,8 +213,6 @@ public function removeDiscussionNote(int|string $project_id, int $issue_iid, str } /** - * @param int|string $project_id - * * @return mixed */ public function setTimeEstimate(int|string $project_id, int $issue_iid, string $duration) @@ -261,8 +221,6 @@ public function setTimeEstimate(int|string $project_id, int $issue_iid, string $ } /** - * @param int|string $project_id - * * @return mixed */ public function resetTimeEstimate(int|string $project_id, int $issue_iid) @@ -271,8 +229,6 @@ public function resetTimeEstimate(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function addSpentTime(int|string $project_id, int $issue_iid, string $duration) @@ -281,8 +237,6 @@ public function addSpentTime(int|string $project_id, int $issue_iid, string $dur } /** - * @param int|string $project_id - * * @return mixed */ public function resetSpentTime(int|string $project_id, int $issue_iid) @@ -291,8 +245,6 @@ public function resetSpentTime(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function getTimeStats(int|string $project_id, int $issue_iid) @@ -333,8 +285,6 @@ public function unsubscribe(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function awardEmoji(int|string $project_id, int $issue_iid) @@ -343,8 +293,6 @@ public function awardEmoji(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function removeAwardEmoji(int|string $project_id, int $issue_iid, int $award_id) @@ -353,8 +301,6 @@ public function removeAwardEmoji(int|string $project_id, int $issue_iid, int $aw } /** - * @param int|string $project_id - * * @return mixed */ public function closedByMergeRequests(int|string $project_id, int $issue_iid) @@ -363,8 +309,6 @@ public function closedByMergeRequests(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function relatedMergeRequests(int|string $project_id, int $issue_iid) @@ -373,8 +317,6 @@ public function relatedMergeRequests(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function showParticipants(int|string $project_id, int $issue_iid) @@ -383,8 +325,6 @@ public function showParticipants(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function showResourceLabelEvents(int|string $project_id, int $issue_iid) @@ -393,8 +333,6 @@ public function showResourceLabelEvents(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function showResourceLabelEvent(int|string $project_id, int $issue_iid, int $resource_label_event_id) diff --git a/src/Api/IssuesStatistics.php b/src/Api/IssuesStatistics.php index aa234b05..864eb0b3 100644 --- a/src/Api/IssuesStatistics.php +++ b/src/Api/IssuesStatistics.php @@ -28,8 +28,6 @@ public function all(array $parameters) } /** - * @param int|string $project_id - * * @return mixed */ public function project(int|string $project_id, array $parameters) @@ -38,8 +36,6 @@ public function project(int|string $project_id, array $parameters) } /** - * @param int|string $group_id - * * @return mixed */ public function group(int|string $group_id, array $parameters) diff --git a/src/Api/Jobs.php b/src/Api/Jobs.php index a8e5d247..5db61af6 100644 --- a/src/Api/Jobs.php +++ b/src/Api/Jobs.php @@ -60,7 +60,6 @@ class Jobs extends AbstractApi public const SCOPE_MANUAL = 'manual'; /** - * @param int|string $project_id * @param array $parameters { * * @var string|string[] $scope The scope of jobs to show, one or array of: created, pending, running, failed, @@ -77,7 +76,6 @@ public function all(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id * @param array $parameters { * * @var string|string[] $scope The scope of jobs to show, one or array of: created, pending, running, failed, @@ -97,7 +95,6 @@ public function pipelineJobs(int|string $project_id, int $pipeline_id, array $pa } /** - * @param int|string $project_id * @param array $parameters { * * @var string|string[] $scope The scope of bridge jobs to show, one or array of: created, pending, running, failed, @@ -118,8 +115,6 @@ public function pipelineBridges(int|string $project_id, int $pipeline_id, array } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $job_id) @@ -128,8 +123,6 @@ public function show(int|string $project_id, int $job_id) } /** - * @param int|string $project_id - * * @return StreamInterface */ public function artifacts(int|string $project_id, int $job_id) @@ -138,8 +131,6 @@ public function artifacts(int|string $project_id, int $job_id) } /** - * @param int|string $project_id - * * @return StreamInterface */ public function artifactsByRefName(int|string $project_id, string $ref_name, string $job_name) @@ -150,8 +141,6 @@ public function artifactsByRefName(int|string $project_id, string $ref_name, str } /** - * @param int|string $project_id - * * @return StreamInterface */ public function artifactByRefName(int|string $project_id, string $ref_name, string $job_name, string $artifact_path) @@ -162,9 +151,6 @@ public function artifactByRefName(int|string $project_id, string $ref_name, stri } /** - * @param int|string $project_id - * @param int $job_id - * * @return StreamInterface */ public function artifactByJobId(int|string $project_id, int $job_id, string $artifact_path) @@ -173,8 +159,6 @@ public function artifactByJobId(int|string $project_id, int $job_id, string $art } /** - * @param int|string $project_id - * * @return mixed */ public function trace(int|string $project_id, int $job_id) @@ -183,8 +167,6 @@ public function trace(int|string $project_id, int $job_id) } /** - * @param int|string $project_id - * * @return mixed */ public function cancel(int|string $project_id, int $job_id) @@ -193,8 +175,6 @@ public function cancel(int|string $project_id, int $job_id) } /** - * @param int|string $project_id - * * @return mixed */ public function retry(int|string $project_id, int $job_id) @@ -203,8 +183,6 @@ public function retry(int|string $project_id, int $job_id) } /** - * @param int|string $project_id - * * @return mixed */ public function erase(int|string $project_id, int $job_id) @@ -213,8 +191,6 @@ public function erase(int|string $project_id, int $job_id) } /** - * @param int|string $project_id - * * @return mixed */ public function keepArtifacts(int|string $project_id, int $job_id) @@ -223,8 +199,6 @@ public function keepArtifacts(int|string $project_id, int $job_id) } /** - * @param int|string $project_id - * * @return mixed */ public function play(int|string $project_id, int $job_id) diff --git a/src/Api/MergeRequests.php b/src/Api/MergeRequests.php index 1b1e9a92..09d9954b 100644 --- a/src/Api/MergeRequests.php +++ b/src/Api/MergeRequests.php @@ -46,7 +46,6 @@ class MergeRequests extends AbstractApi public const STATE_LOCKED = 'locked'; /** - * @param int|string|null $project_id * @param array $parameters { * * @var int[] $iids return the request having the given iid @@ -154,7 +153,6 @@ public function all(int|string|null $project_id = null, array $parameters = []) } /** - * @param int|string $project_id * @param array $parameters { * * @var bool $include_diverged_commits_count Return the commits behind the target branch @@ -177,7 +175,6 @@ public function show(int|string $project_id, int $mr_iid, array $parameters = [] } /** - * @param int|string $project_id * @param array $parameters { * * @var int $assignee_id the assignee id @@ -202,8 +199,6 @@ public function create(int|string $project_id, string $source, string $target, s } /** - * @param int|string $project_id - * * @return mixed */ public function update(int|string $project_id, int $mr_iid, array $parameters) @@ -212,8 +207,6 @@ public function update(int|string $project_id, int $mr_iid, array $parameters) } /** - * @param int|string $project_id - * * @return mixed */ public function merge(int|string $project_id, int $mr_iid, array $parameters = []) @@ -222,8 +215,6 @@ public function merge(int|string $project_id, int $mr_iid, array $parameters = [ } /** - * @param int|string $project_id - * * @return mixed */ public function showNotes(int|string $project_id, int $mr_iid) @@ -232,8 +223,6 @@ public function showNotes(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function showNote(int|string $project_id, int $mr_iid, int $note_id) @@ -242,8 +231,6 @@ public function showNote(int|string $project_id, int $mr_iid, int $note_id) } /** - * @param int|string $project_id - * * @return mixed */ public function addNote(int|string $project_id, int $mr_iid, string $body, array $params = []) @@ -254,8 +241,6 @@ public function addNote(int|string $project_id, int $mr_iid, string $body, array } /** - * @param int|string $project_id - * * @return mixed */ public function updateNote(int|string $project_id, int $mr_iid, int $note_id, string $body) @@ -266,8 +251,6 @@ public function updateNote(int|string $project_id, int $mr_iid, int $note_id, st } /** - * @param int|string $project_id - * * @return mixed */ public function removeNote(int|string $project_id, int $mr_iid, int $note_id) @@ -276,8 +259,6 @@ public function removeNote(int|string $project_id, int $mr_iid, int $note_id) } /** - * @param int|string $project_id - * * @return mixed */ public function showDiscussions(int|string $project_id, int $mr_iid) @@ -286,8 +267,6 @@ public function showDiscussions(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function showDiscussion(int|string $project_id, int $mr_iid, string $discussion_id) @@ -296,8 +275,6 @@ public function showDiscussion(int|string $project_id, int $mr_iid, string $disc } /** - * @param int|string $project_id - * * @return mixed */ public function addDiscussion(int|string $project_id, int $mr_iid, array $params) @@ -306,8 +283,6 @@ public function addDiscussion(int|string $project_id, int $mr_iid, array $params } /** - * @param int|string $project_id - * * @return mixed */ public function resolveDiscussion(int|string $project_id, int $mr_iid, string $discussion_id, bool $resolved = true) @@ -318,8 +293,6 @@ public function resolveDiscussion(int|string $project_id, int $mr_iid, string $d } /** - * @param int|string $project_id - * * @return mixed */ public function addDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, string $body) @@ -328,8 +301,6 @@ public function addDiscussionNote(int|string $project_id, int $mr_iid, string $d } /** - * @param int|string $project_id - * * @return mixed */ public function updateDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, int $note_id, array $params) @@ -338,8 +309,6 @@ public function updateDiscussionNote(int|string $project_id, int $mr_iid, string } /** - * @param int|string $project_id - * * @return mixed */ public function removeDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, int $note_id) @@ -348,8 +317,6 @@ public function removeDiscussionNote(int|string $project_id, int $mr_iid, string } /** - * @param int|string $project_id - * * @return mixed */ public function showParticipants(int|string $project_id, int $mr_iid) @@ -358,8 +325,6 @@ public function showParticipants(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function changes(int|string $project_id, int $mr_iid) @@ -368,8 +333,6 @@ public function changes(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function commits(int|string $project_id, int $mr_iid) @@ -378,8 +341,6 @@ public function commits(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function closesIssues(int|string $project_id, int $mr_iid) @@ -388,8 +349,6 @@ public function closesIssues(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function approvals(int|string $project_id, int $mr_iid) @@ -398,8 +357,6 @@ public function approvals(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function approve(int|string $project_id, int $mr_iid) @@ -408,8 +365,6 @@ public function approve(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function unapprove(int|string $project_id, int $mr_iid) @@ -418,8 +373,6 @@ public function unapprove(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function awardEmoji(int|string $project_id, int $mr_iid) @@ -428,8 +381,6 @@ public function awardEmoji(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function removeAwardEmoji(int|string $project_id, int $mr_iid, int $award_id) @@ -438,8 +389,6 @@ public function removeAwardEmoji(int|string $project_id, int $mr_iid, int $award } /** - * @param int|string $project_id - * * @return mixed */ public function rebase(int|string $project_id, int $mr_iid, array $params = []) @@ -452,8 +401,6 @@ public function rebase(int|string $project_id, int $mr_iid, array $params = []) } /** - * @param int|string $project_id - * * @return mixed */ public function approvalState(int|string $project_id, int $mr_iid) @@ -462,8 +409,6 @@ public function approvalState(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function levelRules(int|string $project_id, int $mr_iid) @@ -472,7 +417,6 @@ public function levelRules(int|string $project_id, int $mr_iid) } /** - * @param int|string $project_id * @param array $parameters * * @return mixed @@ -491,7 +435,6 @@ public function createLevelRule(int|string $project_id, int $mr_iid, string $nam } /** - * @param int|string $project_id * @param array $parameters * * @return mixed @@ -510,8 +453,6 @@ public function updateLevelRule(int|string $project_id, int $mr_iid, int $approv } /** - * @param int|string $project_id - * * @return mixed */ public function deleteLevelRule(int|string $project_id, int $mr_iid, int $approval_rule_id) diff --git a/src/Api/Milestones.php b/src/Api/Milestones.php index 054cb6d1..1fbe59ac 100644 --- a/src/Api/Milestones.php +++ b/src/Api/Milestones.php @@ -27,7 +27,6 @@ class Milestones extends AbstractApi public const STATE_CLOSED = 'closed'; /** - * @param int|string $project_id * @param array $parameters { * * @var int[] $iids return only the milestones having the given iids @@ -55,8 +54,6 @@ public function all(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $milestone_id) @@ -65,8 +62,6 @@ public function show(int|string $project_id, int $milestone_id) } /** - * @param int|string $project_id - * * @return mixed */ public function create(int|string $project_id, array $params) @@ -75,8 +70,6 @@ public function create(int|string $project_id, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function update(int|string $project_id, int $milestone_id, array $params) @@ -85,8 +78,6 @@ public function update(int|string $project_id, int $milestone_id, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function remove(int|string $project_id, int $milestone_id) @@ -95,8 +86,6 @@ public function remove(int|string $project_id, int $milestone_id) } /** - * @param int|string $project_id - * * @return mixed */ public function issues(int|string $project_id, int $milestone_id) @@ -105,8 +94,6 @@ public function issues(int|string $project_id, int $milestone_id) } /** - * @param int|string $project_id - * * @return mixed */ public function mergeRequests(int|string $project_id, int $milestone_id) diff --git a/src/Api/Packages.php b/src/Api/Packages.php index 85e2a1b9..c414e1bb 100644 --- a/src/Api/Packages.php +++ b/src/Api/Packages.php @@ -19,7 +19,6 @@ class Packages extends AbstractApi { /** - * @param int|string $project_id * @param array $parameters { * * @var string $order_by the field to use as order. one of created_at (default), name, @@ -64,8 +63,6 @@ public function all(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $package_id) @@ -74,8 +71,6 @@ public function show(int|string $project_id, int $package_id) } /** - * @param int|string $project_id - * * @return mixed */ public function allFiles(int|string $project_id, int $package_id) @@ -84,8 +79,6 @@ public function allFiles(int|string $project_id, int $package_id) } /** - * @param int|string $project_id - * * @return mixed */ public function remove(int|string $project_id, int $package_id) @@ -94,8 +87,6 @@ public function remove(int|string $project_id, int $package_id) } /** - * @param int|string $project_id - * * @return mixed */ public function removeFile(int|string $project_id, int $package_id, int $package_file_id) @@ -106,8 +97,6 @@ public function removeFile(int|string $project_id, int $package_id, int $package } /** - * @param int|string $project_id - * * @return mixed */ public function addGenericFile(int|string $project_id, string $package_name, string $package_version, string $file, string $status = 'default') @@ -123,9 +112,6 @@ public function addGenericFile(int|string $project_id, string $package_name, str ); } - /** - * @param int|string $project_id - */ private function getPackagePath(int|string $project_id, int $package_id): string { return $this->getProjectPath($project_id, 'packages/'.self::encodePath($package_id)); diff --git a/src/Api/ProjectNamespaces.php b/src/Api/ProjectNamespaces.php index 4d0228fb..5dcf172d 100644 --- a/src/Api/ProjectNamespaces.php +++ b/src/Api/ProjectNamespaces.php @@ -33,8 +33,6 @@ public function all(array $parameters = []) } /** - * @param int|string $namespace_id - * * @return mixed */ public function show(int|string $namespace_id) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 3b195438..08cb8387 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -153,7 +153,6 @@ public function all(array $parameters = []) } /** - * @param int|string $project_id * @param array $parameters { * * @var bool $statistics include project statistics @@ -201,8 +200,6 @@ public function createForUser(int $user_id, string $name, array $parameters = [] } /** - * @param int|string $project_id - * * @return mixed */ public function update(int|string $project_id, array $parameters) @@ -211,8 +208,6 @@ public function update(int|string $project_id, array $parameters) } /** - * @param int|string $project_id - * * @return mixed */ public function remove(int|string $project_id) @@ -221,8 +216,6 @@ public function remove(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function archive(int|string $project_id) @@ -231,8 +224,6 @@ public function archive(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function unarchive(int|string $project_id) @@ -241,8 +232,6 @@ public function unarchive(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function triggers(int|string $project_id) @@ -251,8 +240,6 @@ public function triggers(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function trigger(int|string $project_id, int $trigger_id) @@ -261,8 +248,6 @@ public function trigger(int|string $project_id, int $trigger_id) } /** - * @param int|string $project_id - * * @return mixed */ public function createTrigger(int|string $project_id, string $description) @@ -273,8 +258,6 @@ public function createTrigger(int|string $project_id, string $description) } /** - * @param int|string $project_id - * * @return mixed */ public function removeTrigger(int|string $project_id, int $trigger_id) @@ -283,8 +266,6 @@ public function removeTrigger(int|string $project_id, int $trigger_id) } /** - * @param int|string $project_id - * * @return mixed */ public function triggerPipeline(int|string $project_id, string $ref, string $token, array $variables = []) @@ -317,7 +298,6 @@ public function enableRunner(int $project_id, int $runner_id) } /** - * @param int|string $project_id * @param array $parameters { * * @var string $scope the scope of pipelines, one of: running, pending, finished, branches, tags @@ -380,8 +360,6 @@ public function pipelines(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function pipeline(int|string $project_id, int $pipeline_id) @@ -390,8 +368,6 @@ public function pipeline(int|string $project_id, int $pipeline_id) } /** - * @param int|string $project_id - * * @return mixed */ public function pipelineJobs(int|string $project_id, int $pipeline_id) @@ -400,8 +376,6 @@ public function pipelineJobs(int|string $project_id, int $pipeline_id) } /** - * @param int|string $project_id - * * @return mixed */ public function pipelineVariables(int|string $project_id, int $pipeline_id) @@ -410,8 +384,6 @@ public function pipelineVariables(int|string $project_id, int $pipeline_id) } /** - * @param int|string $project_id - * * @return mixed */ public function pipelineTestReport(int|string $project_id, int $pipeline_id) @@ -420,8 +392,6 @@ public function pipelineTestReport(int|string $project_id, int $pipeline_id) } /** - * @param int|string $project_id - * * @return mixed */ public function pipelineTestReportSummary(int|string $project_id, int $pipeline_id) @@ -430,7 +400,6 @@ public function pipelineTestReportSummary(int|string $project_id, int $pipeline_ } /** - * @param int|string $project_id * @param array|null $variables { * * @var string $key The name of the variable @@ -454,8 +423,6 @@ public function createPipeline(int|string $project_id, string $commit_ref, ?arra } /** - * @param int|string $project_id - * * @return mixed */ public function retryPipeline(int|string $project_id, int $pipeline_id) @@ -464,8 +431,6 @@ public function retryPipeline(int|string $project_id, int $pipeline_id) } /** - * @param int|string $project_id - * * @return mixed */ public function cancelPipeline(int|string $project_id, int $pipeline_id) @@ -474,8 +439,6 @@ public function cancelPipeline(int|string $project_id, int $pipeline_id) } /** - * @param int|string $project_id - * * @return mixed */ public function deletePipeline(int|string $project_id, int $pipeline_id) @@ -484,8 +447,6 @@ public function deletePipeline(int|string $project_id, int $pipeline_id) } /** - * @param int|string $project_id - * * @return mixed */ public function allMembers(int|string $project_id, array $parameters = []) @@ -503,7 +464,6 @@ public function allMembers(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id * @param array $parameters { * * @var string $query The query you want to search members for. @@ -529,8 +489,6 @@ public function members(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function member(int|string $project_id, int $user_id) @@ -539,8 +497,6 @@ public function member(int|string $project_id, int $user_id) } /** - * @param int|string $project_id - * * @return mixed */ public function allMember(int|string $project_id, int $user_id) @@ -549,8 +505,6 @@ public function allMember(int|string $project_id, int $user_id) } /** - * @param int|string $project_id - * * @return mixed */ public function addMember(int|string $project_id, int $user_id, int $access_level, ?string $expires_at = null) @@ -567,8 +521,6 @@ public function addMember(int|string $project_id, int $user_id, int $access_leve } /** - * @param int|string $project_id - * * @return mixed */ public function saveMember(int|string $project_id, int $user_id, int $access_level, ?string $expires_at = null) @@ -584,8 +536,6 @@ public function saveMember(int|string $project_id, int $user_id, int $access_lev } /** - * @param int|string $project_id - * * @return mixed */ public function removeMember(int|string $project_id, int $user_id) @@ -594,8 +544,6 @@ public function removeMember(int|string $project_id, int $user_id) } /** - * @param int|string $project_id - * * @return mixed */ public function hooks(int|string $project_id, array $parameters = []) @@ -606,8 +554,6 @@ public function hooks(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function hook(int|string $project_id, int $hook_id) @@ -620,8 +566,6 @@ public function hook(int|string $project_id, int $hook_id) * * See https://docs.gitlab.com/ee/api/projects.html#get-project-users for more info. * - * @param int|string $project_id - * * @return mixed */ public function users(int|string $project_id, array $parameters = []) @@ -634,8 +578,6 @@ public function users(int|string $project_id, array $parameters = []) * * See https://docs.gitlab.com/ee/api/issues.html#list-project-issues for more info. * - * @param int|string $project_id - * * @return mixed */ public function issues(int|string $project_id, array $parameters = []) @@ -648,8 +590,6 @@ public function issues(int|string $project_id, array $parameters = []) * * See https://docs.gitlab.com/ee/api/boards.html for more info. * - * @param int|string $project_id - * * @return mixed */ public function boards(int|string $project_id) @@ -658,7 +598,6 @@ public function boards(int|string $project_id) } /** - * @param int|string $project_id * @param array $parameters { * * @var string $state Return opened, upcoming, current (previously started), closed, or all iterations. @@ -697,8 +636,6 @@ public function iterations(int|string $project_id, array $parameters = []) * * @see https://docs.gitlab.com/ee/api/discussions.html#list-project-commit-discussion-items * - * @param int|string $project_id - * * @return mixed */ public function getRepositoryCommitDiscussions(int|string $project_id, string $commit_id) @@ -707,8 +644,6 @@ public function getRepositoryCommitDiscussions(int|string $project_id, string $c } /** - * @param int|string $project_id - * * @return mixed */ public function addHook(int|string $project_id, string $url, array $parameters = []) @@ -723,8 +658,6 @@ public function addHook(int|string $project_id, string $url, array $parameters = } /** - * @param int|string $project_id - * * @return mixed */ public function updateHook(int|string $project_id, int $hook_id, array $parameters) @@ -733,8 +666,6 @@ public function updateHook(int|string $project_id, int $hook_id, array $paramete } /** - * @param int|string $project_id - * * @return mixed */ public function removeHook(int|string $project_id, int $hook_id) @@ -743,9 +674,6 @@ public function removeHook(int|string $project_id, int $hook_id) } /** - * @param int|string $project_id - * @param mixed $namespace - * * @return mixed */ public function transfer(int|string $project_id, mixed $namespace) @@ -754,8 +682,6 @@ public function transfer(int|string $project_id, mixed $namespace) } /** - * @param int|string $project_id - * * @return mixed */ public function deployKeys(int|string $project_id) @@ -764,8 +690,6 @@ public function deployKeys(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function deployKey(int|string $project_id, int $key_id) @@ -774,8 +698,6 @@ public function deployKey(int|string $project_id, int $key_id) } /** - * @param int|string $project_id - * * @return mixed */ public function addDeployKey(int|string $project_id, string $title, string $key, bool $canPush = false) @@ -788,8 +710,6 @@ public function addDeployKey(int|string $project_id, string $title, string $key, } /** - * @param int|string $project_id - * * @return mixed */ public function deleteDeployKey(int|string $project_id, int $key_id) @@ -798,8 +718,6 @@ public function deleteDeployKey(int|string $project_id, int $key_id) } /** - * @param int|string $project_id - * * @return mixed */ public function enableDeployKey(int|string $project_id, int $key_id) @@ -808,8 +726,6 @@ public function enableDeployKey(int|string $project_id, int $key_id) } /** - * @param int|string $project_id - * * @return mixed */ public function deployTokens(int|string $project_id, ?bool $active = null) @@ -818,7 +734,6 @@ public function deployTokens(int|string $project_id, ?bool $active = null) } /** - * @param int|string $project_id * @param array $parameters { * * @var string $name the name of the deploy token @@ -867,8 +782,6 @@ public function createDeployToken(int|string $project_id, array $parameters = [] } /** - * @param int|string $project_id - * * @return mixed */ public function deleteDeployToken(int|string $project_id, int $token_id) @@ -877,7 +790,6 @@ public function deleteDeployToken(int|string $project_id, int $token_id) } /** - * @param int|string $project_id * @param array $parameters { * * @var string $action include only events of a particular action type @@ -917,7 +829,6 @@ public function events(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id * @param array $parameters { * * @var bool $with_counts Whether or not to include issue and merge request counts. Defaults to false. @@ -944,8 +855,6 @@ public function labels(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function addLabel(int|string $project_id, array $parameters) @@ -954,8 +863,6 @@ public function addLabel(int|string $project_id, array $parameters) } /** - * @param int|string $project_id - * * @return mixed */ public function updateLabel(int|string $project_id, int $label_id, array $parameters) @@ -964,8 +871,6 @@ public function updateLabel(int|string $project_id, int $label_id, array $parame } /** - * @param int|string $project_id - * * @return mixed */ public function removeLabel(int|string $project_id, int $label_id) @@ -976,8 +881,6 @@ public function removeLabel(int|string $project_id, int $label_id) /** * Get languages used in a project with percentage value. * - * @param int|string $project_id - * * @return mixed */ public function languages(int|string $project_id) @@ -986,7 +889,6 @@ public function languages(int|string $project_id) } /** - * @param int|string $project_id * @param array $parameters { * * @var bool $archived Limit by archived status @@ -1086,7 +988,6 @@ public function forks(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id * @param array $parameters { * * @var string $namespace The ID or path of the namespace that the project will be forked to @@ -1107,9 +1008,6 @@ public function fork(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * @param int|string $forked_project_id - * * @return mixed */ public function createForkRelation(int|string $project_id, int|string $forked_project_id) @@ -1118,8 +1016,6 @@ public function createForkRelation(int|string $project_id, int|string $forked_pr } /** - * @param int|string $project_id - * * @return mixed */ public function removeForkRelation(int|string $project_id) @@ -1128,8 +1024,6 @@ public function removeForkRelation(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function setService(int|string $project_id, string $service_name, array $parameters = []) @@ -1138,8 +1032,6 @@ public function setService(int|string $project_id, string $service_name, array $ } /** - * @param int|string $project_id - * * @return mixed */ public function removeService(int|string $project_id, string $service_name) @@ -1148,8 +1040,6 @@ public function removeService(int|string $project_id, string $service_name) } /** - * @param int|string $project_id - * * @return mixed */ public function variables(int|string $project_id, array $parameters = []) @@ -1160,8 +1050,6 @@ public function variables(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function variable(int|string $project_id, string $key, array $parameters = []) @@ -1174,7 +1062,6 @@ public function variable(int|string $project_id, string $key, array $parameters } /** - * @param int|string $project_id * @param array $parameters { * * @var string $variable_type env_var (default) or file @@ -1203,7 +1090,6 @@ public function addVariable(int|string $project_id, string $key, string $value, } /** - * @param int|string $project_id * @param array $parameters { * * @var string $variable_type env_var (default) or file @@ -1231,7 +1117,6 @@ public function updateVariable(int|string $project_id, string $key, string $valu } /** - * @param int|string $project_id * @param array $parameters { * * @var array $filter { @@ -1251,8 +1136,6 @@ public function removeVariable(int|string $project_id, string $key, array $param } /** - * @param int|string $project_id - * * @return mixed */ public function uploadFile(int|string $project_id, string $file) @@ -1261,8 +1144,6 @@ public function uploadFile(int|string $project_id, string $file) } /** - * @param int|string $project_id - * * @return mixed */ public function uploadAvatar(int|string $project_id, string $file) @@ -1271,8 +1152,6 @@ public function uploadAvatar(int|string $project_id, string $file) } /** - * @param int|string $project_id - * * @return mixed * * @see https://docs.gitlab.com/ee/api/deployments.html#list-project-deployments @@ -1328,8 +1207,6 @@ public function deployments(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function deployment(int|string $project_id, int $deployment_id) @@ -1338,8 +1215,6 @@ public function deployment(int|string $project_id, int $deployment_id) } /** - * @param int|string $project_id - * * @return mixed */ public function addShare(int|string $project_id, array $parameters = []) @@ -1366,9 +1241,6 @@ public function addShare(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * @param int|string $group_id - * * @return mixed */ public function removeShare(int|string $project_id, int|string $group_id) @@ -1377,8 +1249,6 @@ public function removeShare(int|string $project_id, int|string $group_id) } /** - * @param int|string $project_id - * * @return mixed */ public function badges(int|string $project_id) @@ -1387,8 +1257,6 @@ public function badges(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function badge(int|string $project_id, int $badge_id) @@ -1397,8 +1265,6 @@ public function badge(int|string $project_id, int $badge_id) } /** - * @param int|string $project_id - * * @return mixed */ public function addBadge(int|string $project_id, array $parameters = []) @@ -1407,8 +1273,6 @@ public function addBadge(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function removeBadge(int|string $project_id, int $badge_id) @@ -1417,8 +1281,6 @@ public function removeBadge(int|string $project_id, int $badge_id) } /** - * @param int|string $project_id - * * @return mixed */ public function updateBadge(int|string $project_id, int $badge_id, array $parameters = []) @@ -1427,8 +1289,6 @@ public function updateBadge(int|string $project_id, int $badge_id, array $parame } /** - * @param int|string $project_id - * * @return mixed */ public function protectedBranches(int|string $project_id, array $parameters = []) @@ -1437,8 +1297,6 @@ public function protectedBranches(int|string $project_id, array $parameters = [] } /** - * @param int|string $project_id - * * @return mixed */ public function addProtectedBranch(int|string $project_id, array $parameters = []) @@ -1447,8 +1305,6 @@ public function addProtectedBranch(int|string $project_id, array $parameters = [ } /** - * @param int|string $project_id - * * @return mixed */ public function deleteProtectedBranch(int|string $project_id, string $branch_name) @@ -1457,8 +1313,6 @@ public function deleteProtectedBranch(int|string $project_id, string $branch_nam } /** - * @param int|string $project_id - * * @return mixed */ public function updateProtectedBranch(int|string $project_id, string $branch_name, array $parameters = []) @@ -1467,8 +1321,6 @@ public function updateProtectedBranch(int|string $project_id, string $branch_nam } /** - * @param int|string $project_id - * * @return mixed */ public function approvalsConfiguration(int|string $project_id) @@ -1477,8 +1329,6 @@ public function approvalsConfiguration(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function updateApprovalsConfiguration(int|string $project_id, array $parameters = []) @@ -1487,8 +1337,6 @@ public function updateApprovalsConfiguration(int|string $project_id, array $para } /** - * @param int|string $project_id - * * @return mixed */ public function approvalsRules(int|string $project_id) @@ -1497,8 +1345,6 @@ public function approvalsRules(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function createApprovalsRule(int|string $project_id, array $parameters = []) @@ -1507,8 +1353,6 @@ public function createApprovalsRule(int|string $project_id, array $parameters = } /** - * @param int|string $project_id - * * @return mixed */ public function updateApprovalsRule(int|string $project_id, int $approval_rule_id, array $parameters = []) @@ -1517,8 +1361,6 @@ public function updateApprovalsRule(int|string $project_id, int $approval_rule_i } /** - * @param int|string $project_id - * * @return mixed */ public function deleteApprovalsRule(int|string $project_id, int $approval_rule_id) @@ -1527,8 +1369,6 @@ public function deleteApprovalsRule(int|string $project_id, int $approval_rule_i } /** - * @param int|string $project_id - * * @return mixed */ public function deleteAllMergedBranches(int|string $project_id) @@ -1537,8 +1377,6 @@ public function deleteAllMergedBranches(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function projectAccessTokens(int|string $project_id) @@ -1547,9 +1385,6 @@ public function projectAccessTokens(int|string $project_id) } /** - * @param int|string $project_id - * @param int|string $token_id - * * @return mixed */ public function projectAccessToken(int|string $project_id, int|string $token_id) @@ -1558,7 +1393,6 @@ public function projectAccessToken(int|string $project_id, int|string $token_id) } /** - * @param int|string $project_id * @param array $parameters { * * @var string $name the name of the project access token @@ -1609,9 +1443,6 @@ public function createProjectAccessToken(int|string $project_id, array $paramete } /** - * @param int|string $project_id - * @param int|string $token_id - * * @return mixed */ public function deleteProjectAccessToken(int|string $project_id, int|string $token_id) @@ -1620,8 +1451,6 @@ public function deleteProjectAccessToken(int|string $project_id, int|string $tok } /** - * @param int|string $project_id - * * @return mixed */ public function protectedTags(int|string $project_id) @@ -1630,8 +1459,6 @@ public function protectedTags(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function protectedTag(int|string $project_id, string $tag_name) @@ -1640,8 +1467,6 @@ public function protectedTag(int|string $project_id, string $tag_name) } /** - * @param int|string $project_id - * * @return mixed */ public function addProtectedTag(int|string $project_id, array $parameters = []) @@ -1673,8 +1498,6 @@ public function addProtectedTag(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function deleteProtectedTag(int|string $project_id, string $tag_name) @@ -1683,7 +1506,6 @@ public function deleteProtectedTag(int|string $project_id, string $tag_name) } /** - * @param int|string $id * @param array $parameters { * * @var string $scope The scope to search in diff --git a/src/Api/Repositories.php b/src/Api/Repositories.php index 61981135..6d39e463 100644 --- a/src/Api/Repositories.php +++ b/src/Api/Repositories.php @@ -30,7 +30,6 @@ class Repositories extends AbstractApi public const TYPE_TAG = 'tag'; /** - * @param int|string $project_id * @param array $parameters { * * @var string $search @@ -48,8 +47,6 @@ public function branches(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function branch(int|string $project_id, string $branch) @@ -58,8 +55,6 @@ public function branch(int|string $project_id, string $branch) } /** - * @param int|string $project_id - * * @return mixed */ public function createBranch(int|string $project_id, string $branch, string $ref) @@ -71,8 +66,6 @@ public function createBranch(int|string $project_id, string $branch, string $ref } /** - * @param int|string $project_id - * * @return mixed */ public function deleteBranch(int|string $project_id, string $branch) @@ -81,8 +74,6 @@ public function deleteBranch(int|string $project_id, string $branch) } /** - * @param int|string $project_id - * * @return mixed */ public function protectBranch(int|string $project_id, string $branch, bool $devPush = false, bool $devMerge = false) @@ -94,8 +85,6 @@ public function protectBranch(int|string $project_id, string $branch, bool $devP } /** - * @param int|string $project_id - * * @return mixed */ public function unprotectBranch(int|string $project_id, string $branch) @@ -104,8 +93,6 @@ public function unprotectBranch(int|string $project_id, string $branch) } /** - * @param int|string $project_id - * * @return mixed */ public function tags(int|string $project_id, array $parameters = []) @@ -118,8 +105,6 @@ public function tags(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function createTag(int|string $project_id, string $name, string $ref, ?string $message = null) @@ -132,8 +117,6 @@ public function createTag(int|string $project_id, string $name, string $ref, ?st } /** - * @param int|string $project_id - * * @return mixed */ public function createRelease(int|string $project_id, string $tag_name, string $description, ?string $name = null) @@ -147,8 +130,6 @@ public function createRelease(int|string $project_id, string $tag_name, string $ } /** - * @param int|string $project_id - * * @return mixed */ public function updateRelease(int|string $project_id, string $tag_name, string $description, ?string $name = null) @@ -162,8 +143,6 @@ public function updateRelease(int|string $project_id, string $tag_name, string $ } /** - * @param int|string $project_id - * * @return mixed */ public function releases(int|string $project_id) @@ -176,7 +155,6 @@ public function releases(int|string $project_id) /** * @see https://docs.gitlab.com/ee/api/commits.html#list-repository-commits * - * @param int|string $project_id * @param array $parameters { * * @var string $ref_name the name of a repository branch or tag or if not given the default branch @@ -227,8 +205,6 @@ public function commits(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function commit(int|string $project_id, string $sha) @@ -237,8 +213,6 @@ public function commit(int|string $project_id, string $sha) } /** - * @param int|string $project_id - * * @return mixed */ public function commitRefs(int|string $project_id, string $sha, array $parameters = []) @@ -252,7 +226,6 @@ public function commitRefs(int|string $project_id, string $sha, array $parameter } /** - * @param int|string $project_id * @param array $parameters { * * @var string $branch Name of the branch to commit into. To create a new branch, also provide start_branch. @@ -317,8 +290,6 @@ public function createCommit(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function revertCommit(int|string $project_id, string $branch, string $sha) @@ -329,8 +300,6 @@ public function revertCommit(int|string $project_id, string $branch, string $sha } /** - * @param int|string $project_id - * * @return mixed */ public function commitComments(int|string $project_id, string $sha, array $parameters = []) @@ -344,8 +313,6 @@ public function commitComments(int|string $project_id, string $sha, array $param } /** - * @param int|string $project_id - * * @return mixed */ public function createCommitComment(int|string $project_id, string $sha, string $note, array $params = []) @@ -356,8 +323,6 @@ public function createCommitComment(int|string $project_id, string $sha, string } /** - * @param int|string $project_id - * * @return mixed */ public function getCommitBuildStatus(int|string $project_id, string $sha, array $params = []) @@ -366,8 +331,6 @@ public function getCommitBuildStatus(int|string $project_id, string $sha, array } /** - * @param int|string $project_id - * * @return mixed */ public function postCommitBuildStatus(int|string $project_id, string $sha, string $state, array $params = []) @@ -378,8 +341,6 @@ public function postCommitBuildStatus(int|string $project_id, string $sha, strin } /** - * @param int|string $project_id - * * @return mixed */ public function compare(int|string $project_id, string $fromShaOrMaster, string $toShaOrMaster, bool $straight = false, ?string $fromProjectId = null) @@ -398,8 +359,6 @@ public function compare(int|string $project_id, string $fromShaOrMaster, string } /** - * @param int|string $project_id - * * @return mixed */ public function diff(int|string $project_id, string $sha) @@ -408,8 +367,6 @@ public function diff(int|string $project_id, string $sha) } /** - * @param int|string $project_id - * * @return mixed */ public function tree(int|string $project_id, array $params = []) @@ -418,8 +375,6 @@ public function tree(int|string $project_id, array $params = []) } /** - * @param int|string $project_id - * * @return mixed */ public function contributors(int|string $project_id) @@ -428,7 +383,6 @@ public function contributors(int|string $project_id) } /** - * @param int|string $project_id * @param string $format Options: "tar.gz", "zip", "tar.bz2" and "tar" * * @return mixed @@ -439,8 +393,6 @@ public function archive(int|string $project_id, array $params = [], string $form } /** - * @param int|string $project_id - * * @return mixed */ public function mergeBase(int|string $project_id, array $refs) @@ -449,8 +401,6 @@ public function mergeBase(int|string $project_id, array $refs) } /** - * @param int|string $project_id - * * @return mixed */ public function cherryPick(int|string $project_id, string $sha, array $params = []) diff --git a/src/Api/RepositoryFiles.php b/src/Api/RepositoryFiles.php index 4913208c..16670ee7 100644 --- a/src/Api/RepositoryFiles.php +++ b/src/Api/RepositoryFiles.php @@ -19,8 +19,6 @@ class RepositoryFiles extends AbstractApi { /** - * @param int|string $project_id - * * @return mixed */ public function getFile(int|string $project_id, string $file_path, string $ref) @@ -31,8 +29,6 @@ public function getFile(int|string $project_id, string $file_path, string $ref) } /** - * @param int|string $project_id - * * @return mixed */ public function getRawFile(int|string $project_id, string $file_path, string $ref) @@ -43,7 +39,6 @@ public function getRawFile(int|string $project_id, string $file_path, string $re } /** - * @param int|string $project_id * @param array $parameters { * * @var string $file_path Url encoded full path to new file. Ex. lib%2Fclass%2Erb. @@ -78,7 +73,6 @@ public function createFile(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id * @param array $parameters { * * @var string $file_path Url encoded full path to new file. Ex. lib%2Fclass%2Erb. @@ -115,7 +109,6 @@ public function updateFile(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id * @param array $parameters { * * @var string $file_path Url encoded full path to new file. Ex. lib%2Fclass%2Erb. diff --git a/src/Api/ResourceIterationEvents.php b/src/Api/ResourceIterationEvents.php index 21028f0f..63faf760 100644 --- a/src/Api/ResourceIterationEvents.php +++ b/src/Api/ResourceIterationEvents.php @@ -17,8 +17,6 @@ class ResourceIterationEvents extends AbstractApi { /** - * @param int|string $project_id - * * @return mixed */ public function all(int|string $project_id, int $issue_iid) @@ -29,8 +27,6 @@ public function all(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $issue_iid, int $resource_iteration_event_id) diff --git a/src/Api/ResourceLabelEvents.php b/src/Api/ResourceLabelEvents.php index 446c227b..a2e208da 100644 --- a/src/Api/ResourceLabelEvents.php +++ b/src/Api/ResourceLabelEvents.php @@ -17,8 +17,6 @@ class ResourceLabelEvents extends AbstractApi { /** - * @param int|string $project_id - * * @return mixed */ public function all(int|string $project_id, int $issue_iid) @@ -29,8 +27,6 @@ public function all(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id) diff --git a/src/Api/ResourceMilestoneEvents.php b/src/Api/ResourceMilestoneEvents.php index 7c5ad3a2..d9bd03dd 100644 --- a/src/Api/ResourceMilestoneEvents.php +++ b/src/Api/ResourceMilestoneEvents.php @@ -17,8 +17,6 @@ class ResourceMilestoneEvents extends AbstractApi { /** - * @param int|string $project_id - * * @return mixed */ public function all(int|string $project_id, int $issue_iid) @@ -29,8 +27,6 @@ public function all(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $issue_iid, int $resource_milestone_event_id) diff --git a/src/Api/ResourceStateEvents.php b/src/Api/ResourceStateEvents.php index 29d817c8..15dc5b17 100644 --- a/src/Api/ResourceStateEvents.php +++ b/src/Api/ResourceStateEvents.php @@ -17,8 +17,6 @@ class ResourceStateEvents extends AbstractApi { /** - * @param int|string $project_id - * * @return mixed */ public function all(int|string $project_id, int $issue_iid) @@ -29,8 +27,6 @@ public function all(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id) diff --git a/src/Api/ResourceWeightEvents.php b/src/Api/ResourceWeightEvents.php index 34e617a7..077a2b8e 100644 --- a/src/Api/ResourceWeightEvents.php +++ b/src/Api/ResourceWeightEvents.php @@ -17,8 +17,6 @@ class ResourceWeightEvents extends AbstractApi { /** - * @param int|string $project_id - * * @return mixed */ public function all(int|string $project_id, int $issue_iid) @@ -29,8 +27,6 @@ public function all(int|string $project_id, int $issue_iid) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id) diff --git a/src/Api/Schedules.php b/src/Api/Schedules.php index c0b5dd26..75121b2b 100644 --- a/src/Api/Schedules.php +++ b/src/Api/Schedules.php @@ -17,8 +17,6 @@ class Schedules extends AbstractApi { /** - * @param int|string $project_id - * * @return mixed */ public function create(int|string $project_id, array $params) @@ -27,8 +25,6 @@ public function create(int|string $project_id, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $schedule_id) @@ -37,8 +33,6 @@ public function show(int|string $project_id, int $schedule_id) } /** - * @param int|string $project_id - * * @return mixed */ public function showAll(int|string $project_id) @@ -47,8 +41,6 @@ public function showAll(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function update(int|string $project_id, int $schedule_id, array $params) @@ -57,8 +49,6 @@ public function update(int|string $project_id, int $schedule_id, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function remove(int|string $project_id, int $schedule_id) @@ -67,8 +57,6 @@ public function remove(int|string $project_id, int $schedule_id) } /** - * @param int|string $project_id - * * @return mixed */ public function addVariable(int|string $project_id, int $schedule_id, array $params) @@ -79,8 +67,6 @@ public function addVariable(int|string $project_id, int $schedule_id, array $par } /** - * @param int|string $project_id - * * @return mixed */ public function updateVariable(int|string $project_id, int $schedule_id, string $variable_key, array $params) @@ -91,8 +77,6 @@ public function updateVariable(int|string $project_id, int $schedule_id, string } /** - * @param int|string $project_id - * * @return mixed */ public function removeVariable(int|string $project_id, int $schedule_id, string $variable_key) @@ -103,8 +87,6 @@ public function removeVariable(int|string $project_id, int $schedule_id, string } /** - * @param int|string $project_id - * * @return mixed */ public function takeOwnership(int|string $project_id, int $schedule_id) @@ -113,8 +95,6 @@ public function takeOwnership(int|string $project_id, int $schedule_id) } /** - * @param int|string $project_id - * * @return mixed */ public function play(int|string $project_id, int $schedule_id) diff --git a/src/Api/Snippets.php b/src/Api/Snippets.php index 72679081..0f49b858 100644 --- a/src/Api/Snippets.php +++ b/src/Api/Snippets.php @@ -17,8 +17,6 @@ class Snippets extends AbstractApi { /** - * @param int|string $project_id - * * @return mixed */ public function all(int|string $project_id) @@ -27,8 +25,6 @@ public function all(int|string $project_id) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, int $snippet_id) @@ -37,8 +33,6 @@ public function show(int|string $project_id, int $snippet_id) } /** - * @param int|string $project_id - * * @return mixed */ public function create(int|string $project_id, string $title, string $filename, string $code, string $visibility) @@ -52,8 +46,6 @@ public function create(int|string $project_id, string $title, string $filename, } /** - * @param int|string $project_id - * * @return mixed */ public function update(int|string $project_id, int $snippet_id, array $params) @@ -62,8 +54,6 @@ public function update(int|string $project_id, int $snippet_id, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function content(int|string $project_id, int $snippet_id) @@ -72,8 +62,6 @@ public function content(int|string $project_id, int $snippet_id) } /** - * @param int|string $project_id - * * @return mixed */ public function remove(int|string $project_id, int $snippet_id) @@ -82,8 +70,6 @@ public function remove(int|string $project_id, int $snippet_id) } /** - * @param int|string $project_id - * * @return mixed */ public function showNotes(int|string $project_id, int $snippet_id) @@ -92,8 +78,6 @@ public function showNotes(int|string $project_id, int $snippet_id) } /** - * @param int|string $project_id - * * @return mixed */ public function showNote(int|string $project_id, int $snippet_id, int $note_id) @@ -102,8 +86,6 @@ public function showNote(int|string $project_id, int $snippet_id, int $note_id) } /** - * @param int|string $project_id - * * @return mixed */ public function addNote(int|string $project_id, int $snippet_id, string $body, array $params = []) @@ -114,8 +96,6 @@ public function addNote(int|string $project_id, int $snippet_id, string $body, a } /** - * @param int|string $project_id - * * @return mixed */ public function updateNote(int|string $project_id, int $snippet_id, int $note_id, string $body) @@ -126,8 +106,6 @@ public function updateNote(int|string $project_id, int $snippet_id, int $note_id } /** - * @param int|string $project_id - * * @return mixed */ public function removeNote(int|string $project_id, int $snippet_id, int $note_id) @@ -136,8 +114,6 @@ public function removeNote(int|string $project_id, int $snippet_id, int $note_id } /** - * @param int|string $project_id - * * @return mixed */ public function awardEmoji(int|string $project_id, int $snippet_id) @@ -146,8 +122,6 @@ public function awardEmoji(int|string $project_id, int $snippet_id) } /** - * @param int|string $project_id - * * @return mixed */ public function removeAwardEmoji(int|string $project_id, int $snippet_id, int $award_id) diff --git a/src/Api/Tags.php b/src/Api/Tags.php index edd0063c..4f4244ff 100644 --- a/src/Api/Tags.php +++ b/src/Api/Tags.php @@ -17,7 +17,6 @@ class Tags extends AbstractApi { /** - * @param int|string $project_id * @param array $parameters { * * @var string $order_by Return tags ordered by `name`, `updated` or `version` fields. Default is `updated`. @@ -41,8 +40,6 @@ public function all(int|string $project_id, array $parameters = []) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, string $tag_name) @@ -51,8 +48,6 @@ public function show(int|string $project_id, string $tag_name) } /** - * @param int|string $project_id - * * @return mixed */ public function create(int|string $project_id, array $params = []) @@ -61,8 +56,6 @@ public function create(int|string $project_id, array $params = []) } /** - * @param int|string $project_id - * * @return mixed */ public function remove(int|string $project_id, string $tag_name) @@ -71,8 +64,6 @@ public function remove(int|string $project_id, string $tag_name) } /** - * @param int|string $project_id - * * @return mixed */ public function createRelease(int|string $project_id, string $tag_name, array $params = []) @@ -81,8 +72,6 @@ public function createRelease(int|string $project_id, string $tag_name, array $p } /** - * @param int|string $project_id - * * @return mixed */ public function updateRelease(int|string $project_id, string $tag_name, array $params = []) diff --git a/src/Api/Wiki.php b/src/Api/Wiki.php index 18ef7269..856fed4d 100644 --- a/src/Api/Wiki.php +++ b/src/Api/Wiki.php @@ -17,7 +17,6 @@ class Wiki extends AbstractApi { /** - * @param int|string $project_id * @param array $params * * @return mixed @@ -28,8 +27,6 @@ public function create(int|string $project_id, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function show(int|string $project_id, string $wiki_slug) @@ -38,7 +35,6 @@ public function show(int|string $project_id, string $wiki_slug) } /** - * @param int|string $project_id * @param array $params { * * @var bool $with_content Include pages' content @@ -56,7 +52,6 @@ public function showAll(int|string $project_id, array $params) } /** - * @param int|string $project_id * @param array $params * * @return mixed @@ -67,8 +62,6 @@ public function update(int|string $project_id, string $wiki_slug, array $params) } /** - * @param int|string $project_id - * * @return mixed */ public function remove(int|string $project_id, string $wiki_slug) diff --git a/src/HttpClient/Util/QueryStringBuilder.php b/src/HttpClient/Util/QueryStringBuilder.php index 1f0898e1..b25d2f22 100644 --- a/src/HttpClient/Util/QueryStringBuilder.php +++ b/src/HttpClient/Util/QueryStringBuilder.php @@ -34,9 +34,6 @@ public static function build(array $query): string /** * Encode a value. - * - * @param mixed $query - * @param scalar $prefix */ private static function encode(mixed $query, scalar $prefix): string { @@ -67,8 +64,6 @@ private static function isList(array $query): bool /** * Encode a value like rawurlencode, but return "0" when false is given. - * - * @param mixed $value */ private static function rawurlencode(mixed $value): string { From f44ed77617ed394b8ddc3e6ceab1921c5e22285d Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 17:00:04 +0000 Subject: [PATCH 099/117] WIP --- .github/workflows/static.yml | 12 ++++++------ .github/workflows/tests.yml | 8 ++++---- src/HttpClient/Util/QueryStringBuilder.php | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 66542937..b37fe5d0 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -7,7 +7,7 @@ on: jobs: phpstan: name: PHPStan - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout code @@ -23,14 +23,14 @@ jobs: update: true - name: Install Dependencies - uses: nick-invision/retry@v2 + uses: nick-invision/retry@v3 with: timeout_minutes: 5 max_attempts: 5 command: composer update --no-interaction --no-progress - name: Install PHPStan - uses: nick-invision/retry@v2 + uses: nick-invision/retry@v3 with: timeout_minutes: 5 max_attempts: 5 @@ -41,7 +41,7 @@ jobs: psalm: name: Psalm - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout code @@ -57,14 +57,14 @@ jobs: update: true - name: Install Dependencies - uses: nick-invision/retry@v2 + uses: nick-invision/retry@v3 with: timeout_minutes: 5 max_attempts: 5 command: composer update --no-interaction --no-progress - name: Install Psalm - uses: nick-invision/retry@v2 + uses: nick-invision/retry@v3 with: timeout_minutes: 5 max_attempts: 5 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eb2530e2..f2a04d29 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,11 +7,11 @@ on: jobs: tests: name: PHP ${{ matrix.php }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: - php: ['7.4', '8.0', '8.1', '8.2', '8.3'] + php: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout Code @@ -30,14 +30,14 @@ jobs: run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Install Dependencies - uses: nick-invision/retry@v2 + uses: nick-invision/retry@v3 with: timeout_minutes: 5 max_attempts: 5 command: composer update --no-interaction --no-progress - name: Install PHPUnit - uses: nick-invision/retry@v2 + uses: nick-invision/retry@v3 with: timeout_minutes: 5 max_attempts: 5 diff --git a/src/HttpClient/Util/QueryStringBuilder.php b/src/HttpClient/Util/QueryStringBuilder.php index b25d2f22..462f5ff4 100644 --- a/src/HttpClient/Util/QueryStringBuilder.php +++ b/src/HttpClient/Util/QueryStringBuilder.php @@ -35,7 +35,7 @@ public static function build(array $query): string /** * Encode a value. */ - private static function encode(mixed $query, scalar $prefix): string + private static function encode(mixed $query, int|string $prefix): string { if (!\is_array($query)) { return self::rawurlencode($prefix).'='.self::rawurlencode($query); From 926963319f042f9d592f7c0fc3a3e8bed716a79d Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 17:16:22 +0000 Subject: [PATCH 100/117] Fixes --- phpstan-baseline.neon | 78 ++++++++++++++++++++++++++++---- phpstan.neon.dist | 13 ++---- psalm-baseline.xml | 2 +- tests/Api/TagsTest.php | 4 +- vendor-bin/phpstan/composer.json | 9 ++-- vendor-bin/phpunit/composer.json | 4 +- vendor-bin/psalm/composer.json | 2 +- 7 files changed, 84 insertions(+), 28 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index cfeceeaf..3ee84310 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,42 +1,104 @@ parameters: ignoreErrors: - - message: "#^Parameter \\#1 \\$callback of function set_error_handler expects \\(callable\\(int, string, string, int\\)\\: bool\\)\\|null, Closure\\(\\)\\: void given\\.$#" + message: '#^Parameter \#1 \$callback of function set_error_handler expects \(callable\(int, string, string, int\)\: bool\)\|null, Closure\(\)\: void given\.$#' + identifier: argument.type count: 1 path: src/Api/AbstractApi.php - - message: "#^Parameter \\#2 \\$resource of method Http\\\\Message\\\\MultipartStream\\\\MultipartStreamBuilder\\:\\:addResource\\(\\) expects Psr\\\\Http\\\\Message\\\\StreamInterface\\|resource\\|string, mixed given\\.$#" + message: '#^Parameter \#2 \$resource of method Http\\Message\\MultipartStream\\MultipartStreamBuilder\:\:addResource\(\) expects Psr\\Http\\Message\\StreamInterface\|resource\|string, mixed given\.$#' + identifier: argument.type count: 1 path: src/Api/AbstractApi.php - - message: "#^Parameter \\#4 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" + message: '#^Parameter \#4 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#' + identifier: argument.type count: 1 path: src/Api/AbstractApi.php - - message: "#^Property Gitlab\\\\Api\\\\AbstractApi\\:\\:\\$perPage is never written, only read\\.$#" + message: '#^Property Gitlab\\Api\\AbstractApi\:\:\$perPage \(int\|null\) is never assigned int so it can be removed from the property type\.$#' + identifier: property.unusedType count: 1 path: src/Api/AbstractApi.php - - message: "#^PHPDoc tag @return contains generic type Http\\\\Promise\\\\Promise\\ but interface Http\\\\Promise\\\\Promise is not generic\\.$#" + message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#' + identifier: foreach.nonIterable + count: 1 + path: src/Api/Groups.php + + - + message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#' + identifier: foreach.nonIterable + count: 2 + path: src/Api/Projects.php + + - + message: '#^Parameter \#1 \$array of function array_values expects array\, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Api/Projects.php + + - + message: '#^Parameter \#1 \$options of method Symfony\\Component\\OptionsResolver\\OptionsResolver\:\:resolve\(\) expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Api/Repositories.php + + - + message: '#^Parameter \#1 \$uri of static method Gitlab\\Api\\AbstractApi\:\:encodePath\(\) expects int\|string, mixed given\.$#' + identifier: argument.type + count: 3 + path: src/Api/RepositoryFiles.php + + - + message: '#^Parameter \#1 \$message of static method Gitlab\\HttpClient\\Message\\ResponseMediator\:\:getMessageAsString\(\) expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/HttpClient/Message/ResponseMediator.php + + - + message: '#^Parameter \#3 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#' + identifier: argument.type + count: 2 + path: src/HttpClient/Message/ResponseMediator.php + + - + message: '#^PHPDoc tag @return contains generic type Http\\Promise\\Promise\ but interface Http\\Promise\\Promise is not generic\.$#' + identifier: generics.notGeneric count: 1 path: src/HttpClient/Plugin/Authentication.php - - message: "#^PHPDoc tag @return contains generic type Http\\\\Promise\\\\Promise\\ but interface Http\\\\Promise\\\\Promise is not generic\\.$#" + message: '#^PHPDoc tag @return contains generic type Http\\Promise\\Promise\ but interface Http\\Promise\\Promise is not generic\.$#' + identifier: generics.notGeneric count: 1 path: src/HttpClient/Plugin/ExceptionThrower.php - - message: "#^Cannot cast mixed to string\\.$#" + message: '#^PHPDoc tag @var with type string is not subtype of native type non\-empty\-string\|false\.$#' + identifier: varTag.nativeType + count: 1 + path: src/HttpClient/Util/JsonArray.php + + - + message: '#^Cannot cast mixed to string\.$#' + identifier: cast.string count: 1 path: src/HttpClient/Util/QueryStringBuilder.php - - message: "#^Variable method call on Gitlab\\\\Api\\\\AbstractApi\\.$#" + message: '#^PHPDoc tag @var with type Closure\(Gitlab\\Api\\AbstractApi\)\: Gitlab\\Api\\AbstractApi is not subtype of type Closure\(Gitlab\\Api\\AbstractApi\)\: Gitlab\\Api\\AbstractApi\.$#' + identifier: varTag.type + count: 1 + path: src/ResultPager.php + + - + message: '#^Variable method call on Gitlab\\Api\\AbstractApi\.$#' + identifier: method.dynamicName count: 1 path: src/ResultPager.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4a745989..40f6a875 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,20 +2,15 @@ includes: - phpstan-baseline.neon - vendor-bin/phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon - vendor-bin/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon - - vendor-bin/phpstan/vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon - -rules: - - Ergebnis\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule - - Ergebnis\PHPStan\Rules\Expressions\NoCompactRule - - Ergebnis\PHPStan\Rules\Expressions\NoEvalRule - - Ergebnis\PHPStan\Rules\Files\DeclareStrictTypesRule - - Ergebnis\PHPStan\Rules\Methods\PrivateInFinalClassRule parameters: level: max - checkMissingIterableValueType: false paths: - src ignoreErrors: - '#Only booleans are allowed in an if condition#' - '#PHPDoc tag \@var above a method has no effect.#' + - '#return type has no value type specified in iterable type array#' + - '#no value type specified in iterable type array#' + - '#expects array\, array given#' + - '#expects array\, array given#' diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 88bf06d2..3c19e346 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + 'v1.1.0', + 'releaseName' => 'v1.1.0', 'description' => 'Amazing release. Wow', 'expectedResult' => [ 'tag_name' => '1.0.0', @@ -146,7 +146,7 @@ public static function releaseDataProvider(): array ], ], [ - 'tagName' => 'version/1.1.0', + 'releaseName' => 'version/1.1.0', 'description' => 'Amazing release. Wow', 'expectedResult' => [ 'tag_name' => 'version/1.1.0', diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json index 95323c40..e93f63d9 100644 --- a/vendor-bin/phpstan/composer.json +++ b/vendor-bin/phpstan/composer.json @@ -1,11 +1,10 @@ { "require": { "php": "^8.1", - "phpstan/phpstan": "1.10.62", - "phpstan/phpstan-deprecation-rules": "1.1.4", - "phpstan/phpstan-strict-rules": "1.5.2", - "thecodingmachine/phpstan-strict-rules": "1.0.0", - "ergebnis/phpstan-rules": "2.2.0" + "phpstan/phpstan": "2.1.6", + "phpstan/phpstan-deprecation-rules": "2.0.1", + "phpstan/phpstan-strict-rules": "2.0.3", + "ergebnis/phpstan-rules": "2.8.0" }, "config": { "preferred-install": "dist" diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index 73f48cf4..00cbd40a 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -1,7 +1,7 @@ { "require": { - "php": "^7.4.15 || ^8.0.2", - "phpunit/phpunit": "^9.6.17 || ^10.5.13" + "php": "^8.1", + "phpunit/phpunit": "^10.5.45" }, "config": { "preferred-install": "dist" diff --git a/vendor-bin/psalm/composer.json b/vendor-bin/psalm/composer.json index d0f9668b..feebf503 100644 --- a/vendor-bin/psalm/composer.json +++ b/vendor-bin/psalm/composer.json @@ -1,7 +1,7 @@ { "require": { "php": "^8.1", - "psalm/phar": "5.23.1" + "psalm/phar": "5.26.1" }, "config": { "preferred-install": "dist" From 0082a050feed42e1c5fad32ad999da838f5fac3d Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 17:26:43 +0000 Subject: [PATCH 101/117] Deprecated test fixes --- tests/Api/DeployKeysTest.php | 2 +- tests/Api/DeploymentsTest.php | 4 +- tests/Api/EnvironmentsTest.php | 12 +- tests/Api/EventsTest.php | 4 +- tests/Api/GroupBoardsTest.php | 20 +-- tests/Api/GroupsEpicsTest.php | 12 +- tests/Api/GroupsMilestonesTest.php | 14 +- tests/Api/GroupsTest.php | 90 +++++----- tests/Api/IssueBoardsTest.php | 20 +-- tests/Api/IssueLinksTest.php | 6 +- tests/Api/IssueSubscribeTest.php | 4 +- tests/Api/IssuesStatisticsTest.php | 6 +- tests/Api/IssuesTest.php | 70 ++++---- tests/Api/JobsTest.php | 30 ++-- tests/Api/KeysTest.php | 2 +- tests/Api/MergeRequestsTest.php | 80 ++++----- tests/Api/MilestonesTest.php | 14 +- tests/Api/PackagesTest.php | 10 +- tests/Api/ProjectNamespacesTest.php | 4 +- tests/Api/ProjectsTest.php | 248 ++++++++++++++-------------- tests/Api/RepositoriesTest.php | 66 ++++---- tests/Api/RepositoryFilesTest.php | 20 +-- tests/Api/ScheduleTest.php | 20 +-- tests/Api/SearchTest.php | 2 +- tests/Api/SnippetsTest.php | 26 +-- tests/Api/SystemHooksTest.php | 8 +- tests/Api/TagsTest.php | 12 +- tests/Api/UsersTest.php | 80 ++++----- tests/Api/VersionTest.php | 2 +- tests/Api/WikiTest.php | 10 +- 30 files changed, 449 insertions(+), 449 deletions(-) diff --git a/tests/Api/DeployKeysTest.php b/tests/Api/DeployKeysTest.php index c8a05f86..f5a537be 100644 --- a/tests/Api/DeployKeysTest.php +++ b/tests/Api/DeployKeysTest.php @@ -29,7 +29,7 @@ public function shouldGetAllDeployKeys(): void $api->expects($this->once()) ->method('get') ->with('deploy_keys', ['page' => 2, 'per_page' => 5]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(['page' => 2, 'per_page' => 5])); diff --git a/tests/Api/DeploymentsTest.php b/tests/Api/DeploymentsTest.php index 6629a592..83f85f47 100644 --- a/tests/Api/DeploymentsTest.php +++ b/tests/Api/DeploymentsTest.php @@ -106,7 +106,7 @@ public function shouldShowDeployment(): void $api->expects($this->once()) ->method('get') ->with('projects/1/deployments/42') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->show(1, 42)); } @@ -250,7 +250,7 @@ protected function getMultipleDeploymentsRequestMock(string $path, array $expect $api->expects($this->once()) ->method('get') ->with($path, $expectedParameters) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); return $api; } diff --git a/tests/Api/EnvironmentsTest.php b/tests/Api/EnvironmentsTest.php index 03dec459..d4724a5e 100644 --- a/tests/Api/EnvironmentsTest.php +++ b/tests/Api/EnvironmentsTest.php @@ -42,7 +42,7 @@ public function shouldGetAllEnvironments(): void $api->expects($this->once()) ->method('get') ->with('projects/1/environments') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->all(1)); } @@ -61,7 +61,7 @@ public function shouldFilterEnvironmentByName(): void $api->expects($this->once()) ->method('get') ->with('projects/1/environments') - ->will($this->returnValue($expected)); + ->willReturn($expected); $this->assertEquals($expected, $api->all(1, ['name' => 'review/fix-bar'])); } @@ -140,7 +140,7 @@ public function shouldGetSingleEnvironment(): void $api->expects($this->once()) ->method('get') ->with('projects/1/environments/1') - ->will($this->returnValue($expected)); + ->willReturn($expected); $this->assertEquals($expected, $api->show(1, 1)); } @@ -169,7 +169,7 @@ public function shouldCreateEnvironment(): void $api->expects($this->once()) ->method('post') ->with('projects/1/environments', $params) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->create(1, $params)); } @@ -185,7 +185,7 @@ public function shouldRemoveEnvironment(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/environments/3') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->remove(1, 3)); } @@ -200,7 +200,7 @@ public function shouldStopEnvironment(): void $api->expects($this->once()) ->method('post') ->with('projects/1/environments/3/stop') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->stop(1, 3)); } diff --git a/tests/Api/EventsTest.php b/tests/Api/EventsTest.php index 4b4fd689..2d7e7326 100644 --- a/tests/Api/EventsTest.php +++ b/tests/Api/EventsTest.php @@ -36,7 +36,7 @@ public function shouldGetAllEvents(): void $api->expects($this->once()) ->method('get') ->with('events', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all()); @@ -56,7 +56,7 @@ public function shouldGetEventsAfter(): void $api->expects($this->once()) ->method('get') ->with('events', ['after' => '1970-01-01']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(['after' => new \DateTime('1970-01-01')])); diff --git a/tests/Api/GroupBoardsTest.php b/tests/Api/GroupBoardsTest.php index c9dc7f02..ee4c2834 100644 --- a/tests/Api/GroupBoardsTest.php +++ b/tests/Api/GroupBoardsTest.php @@ -32,7 +32,7 @@ public function shouldGetAllBoards(): void $api->expects($this->once()) ->method('get') ->with('boards', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all()); @@ -49,7 +49,7 @@ public function shouldShowIssueBoard(): void $api->expects($this->once()) ->method('get') ->with('groups/1/boards/2') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 2)); @@ -66,7 +66,7 @@ public function shouldCreateIssueBoard(): void $api->expects($this->once()) ->method('post') ->with('groups/1/boards', ['name' => 'A new issue board']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create(1, ['name' => 'A new issue board'])); @@ -83,7 +83,7 @@ public function shouldUpdateIssueBoard(): void $api->expects($this->once()) ->method('put') ->with('groups/1/boards/2', ['name' => 'A renamed issue board', 'labels' => 'foo']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(1, 2, ['name' => 'A renamed issue board', 'labels' => 'foo'])); @@ -100,7 +100,7 @@ public function shouldRemoveIssueBoard(): void $api->expects($this->once()) ->method('delete') ->with('groups/1/boards/2') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(1, 2)); @@ -135,7 +135,7 @@ public function shouldGetAllLists(): void $api->expects($this->once()) ->method('get') ->with('groups/1/boards/2/lists') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->allLists(1, 2)); @@ -162,7 +162,7 @@ public function shouldGetList(): void $api->expects($this->once()) ->method('get') ->with('groups/1/boards/2/lists/3') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showList(1, 2, 3)); @@ -189,7 +189,7 @@ public function shouldCreateList(): void $api->expects($this->once()) ->method('post') ->with('groups/1/boards/2/lists', ['label_id' => 4]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createList(1, 2, 4)); @@ -216,7 +216,7 @@ public function shouldUpdateList(): void $api->expects($this->once()) ->method('put') ->with('groups/5/boards/2/lists/3', ['position' => 1]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateList(5, 2, 3, 1)); @@ -233,7 +233,7 @@ public function shouldDeleteList(): void $api->expects($this->once()) ->method('delete') ->with('groups/1/boards/2/lists/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->deleteList(1, 2, 3)); diff --git a/tests/Api/GroupsEpicsTest.php b/tests/Api/GroupsEpicsTest.php index d10489e6..3909e510 100644 --- a/tests/Api/GroupsEpicsTest.php +++ b/tests/Api/GroupsEpicsTest.php @@ -32,7 +32,7 @@ public function shouldGetAllEpics(): void $api->expects($this->once()) ->method('get') ->with('groups/1/epics') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1)); @@ -49,7 +49,7 @@ public function shouldShowEpic(): void $api->expects($this->once()) ->method('get') ->with('groups/1/epics/2') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 2)); @@ -66,7 +66,7 @@ public function shouldCreateEpic(): void $api->expects($this->once()) ->method('post') ->with('groups/1/epics', ['description' => 'Some text', 'title' => 'A new epic']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create(1, ['description' => 'Some text', 'title' => 'A new epic'])); @@ -83,7 +83,7 @@ public function shouldUpdateEpic(): void $api->expects($this->once()) ->method('put') ->with('groups/1/epics/3', ['title' => 'Updated epic', 'description' => 'Updated description', 'state_event' => 'close']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated epic', 'description' => 'Updated description', 'state_event' => 'close'])); @@ -100,7 +100,7 @@ public function shouldRemoveEpic(): void $api->expects($this->once()) ->method('delete') ->with('groups/1/epics/2') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(1, 2)); @@ -120,7 +120,7 @@ public function shouldGetEpicsIssues(): void $api->expects($this->once()) ->method('get') ->with('groups/1/epics/2/issues') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->issues(1, 2)); diff --git a/tests/Api/GroupsMilestonesTest.php b/tests/Api/GroupsMilestonesTest.php index 9fcd80cf..0f5e6a4b 100644 --- a/tests/Api/GroupsMilestonesTest.php +++ b/tests/Api/GroupsMilestonesTest.php @@ -32,7 +32,7 @@ public function shouldGetAllMilestones(): void $api->expects($this->once()) ->method('get') ->with('groups/1/milestones') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1)); @@ -149,7 +149,7 @@ public function shouldShowMilestone(): void $api->expects($this->once()) ->method('get') ->with('groups/1/milestones/2') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 2)); @@ -166,7 +166,7 @@ public function shouldCreateMilestone(): void $api->expects($this->once()) ->method('post') ->with('groups/1/milestones', ['description' => 'Some text', 'title' => 'A new milestone']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create(1, ['description' => 'Some text', 'title' => 'A new milestone'])); @@ -183,7 +183,7 @@ public function shouldUpdateMilestone(): void $api->expects($this->once()) ->method('put') ->with('groups/1/milestones/3', ['title' => 'Updated milestone', 'due_date' => '2015-04-01', 'state_event' => 'close']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated milestone', 'due_date' => '2015-04-01', 'state_event' => 'close'])); @@ -200,7 +200,7 @@ public function shouldRemoveMilestone(): void $api->expects($this->once()) ->method('delete') ->with('groups/1/milestones/2') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(1, 2)); @@ -220,7 +220,7 @@ public function shouldGetMilestonesIssues(): void $api->expects($this->once()) ->method('get') ->with('groups/1/milestones/3/issues') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->issues(1, 3)); @@ -240,7 +240,7 @@ public function shouldGetMilestonesMergeRequests(): void $api->expects($this->once()) ->method('get') ->with('groups/1/milestones/3/merge_requests') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->mergeRequests(1, 3)); diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index 19209bfd..7f4b57c7 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -33,7 +33,7 @@ public function shouldGetAllGroups(): void $api->expects($this->once()) ->method('get') ->with('groups', ['page' => 1, 'per_page' => 10]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(['page' => 1, 'per_page' => 10])); @@ -53,7 +53,7 @@ public function shouldGetAllGroupsWithBooleanParam(): void $api->expects($this->once()) ->method('get') ->with('groups', ['all_available' => 'false']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(['all_available' => false])); @@ -73,7 +73,7 @@ public function shouldGetAllTopLevelGroupsWithoutSubgroups(): void $api->expects($this->once()) ->method('get') ->with('groups', ['top_level_only' => 'true']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(['top_level_only' => true])); @@ -93,7 +93,7 @@ public function shouldGetAllGroupProjectsWithBooleanParam(): void $api->expects($this->once()) ->method('get') ->with('groups/1/projects', ['archived' => 'false']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->projects(1, ['archived' => false])); @@ -113,7 +113,7 @@ public function shouldNotNeedPaginationWhenGettingGroups(): void $api->expects($this->once()) ->method('get') ->with('groups', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all()); @@ -130,7 +130,7 @@ public function shouldShowGroup(): void $api->expects($this->once()) ->method('get') ->with('groups/1') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1)); @@ -147,7 +147,7 @@ public function shouldCreateGroup(): void $api->expects($this->once()) ->method('post') ->with('groups', ['name' => 'A new group', 'path' => 'a-new-group', 'visibility' => 'private']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group')); @@ -164,7 +164,7 @@ public function shouldCreateGroupWithDescriptionAndVisibility(): void $api->expects($this->once()) ->method('post') ->with('groups', ['name' => 'A new group', 'path' => 'a-new-group', 'description' => 'Description', 'visibility' => 'public']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group', 'Description', 'public')); @@ -181,7 +181,7 @@ public function shouldCreateGroupWithDescriptionVisibilityAndParentId(): void $api->expects($this->once()) ->method('post') ->with('groups', ['name' => 'A new group', 'path' => 'a-new-group', 'description' => 'Description', 'visibility' => 'public', 'parent_id' => 666]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group', 'Description', 'public', null, null, 666)); @@ -198,7 +198,7 @@ public function shouldUpdateGroup(): void $api->expects($this->once()) ->method('put') ->with('groups/3', ['name' => 'Group name', 'path' => 'group-path']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(3, ['name' => 'Group name', 'path' => 'group-path'])); @@ -215,7 +215,7 @@ public function shouldTransferProjectToGroup(): void $api->expects($this->once()) ->method('post') ->with('groups/1/projects/2') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->transfer(1, 2)); @@ -235,7 +235,7 @@ public function shouldGetAllMembers(): void $api->expects($this->once()) ->method('get') ->with('groups/1/members/all') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->allMembers(1)); @@ -252,7 +252,7 @@ public function shouldGetAllMember(): void $api->expects($this->once()) ->method('get') ->with('groups/1/members/all/2') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->allMember(1, 2)); } @@ -271,7 +271,7 @@ public function shouldGetMembers(): void $api->expects($this->once()) ->method('get') ->with('groups/1/members') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->members(1)); @@ -291,7 +291,7 @@ public function shouldAddMember(): void ->with('groups/1/members', [ 'user_id' => 2, 'access_level' => 10, 'expires_at' => $tomorrow->format('Y-m-d'), ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addMember(1, 2, 10, ['expires_at' => $tomorrow])); @@ -308,7 +308,7 @@ public function shouldSaveMember(): void $api->expects($this->once()) ->method('put') ->with('groups/1/members/2', ['access_level' => 4]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->saveMember(1, 2, 4)); @@ -325,7 +325,7 @@ public function shouldRemoveMember(): void $api->expects($this->once()) ->method('delete') ->with('groups/1/members/2') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeMember(1, 2)); @@ -342,7 +342,7 @@ public function shouldRemoveGroup(): void $api->expects($this->once()) ->method('delete') ->with('groups/1') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(1)); @@ -362,7 +362,7 @@ public function shouldGetAllSubgroups(): void $api->expects($this->once()) ->method('get') ->with('groups/1/subgroups', ['page' => 1, 'per_page' => 10]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->subgroups(1, ['page' => 1, 'per_page' => 10])); @@ -383,7 +383,7 @@ public function shouldGetAllIssues(): void $api->expects($this->once()) ->method('get') ->with('groups/1/issues', ['page' => 1, 'per_page' => 10]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->issues(1, ['page' => 1, 'per_page' => 10])); @@ -403,7 +403,7 @@ public function shouldGetLabels(): void $api->expects($this->once()) ->method('get') ->with('groups/1/labels') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->labels(1)); @@ -420,7 +420,7 @@ public function shouldAddLabel(): void $api->expects($this->once()) ->method('post') ->with('groups/1/labels', ['name' => 'wont-fix', 'color' => '#ffffff']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addLabel(1, ['name' => 'wont-fix', 'color' => '#ffffff'])); @@ -437,7 +437,7 @@ public function shouldUpdateLabel(): void $api->expects($this->once()) ->method('put') ->with('groups/1/labels/123', ['new_name' => 'big-bug', 'color' => '#00ffff']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateLabel(1, 123, ['new_name' => 'big-bug', 'color' => '#00ffff'])); @@ -454,7 +454,7 @@ public function shouldRemoveLabel(): void $api->expects($this->once()) ->method('delete') ->with('groups/1/labels/456', []) - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeLabel(1, 456)); @@ -471,7 +471,7 @@ public function shouldGetVariables(): void $api->expects($this->once()) ->method('get') ->with('groups/1/variables') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->variables(1)); @@ -488,7 +488,7 @@ public function shouldGetVariable(): void $api->expects($this->once()) ->method('get') ->with('groups/1/variables/ftp_username') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->variable(1, 'ftp_username')); @@ -508,7 +508,7 @@ public function shouldAddVariable(): void $api->expects($this->once()) ->method('post') ->with('groups/1/variables', $expectedArray) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addVariable(1, $expectedKey, $expectedValue)); @@ -529,7 +529,7 @@ public function shouldAddVariableWithProtected(): void $api->expects($this->once()) ->method('post') ->with('groups/1/variables', $expectedArray) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); @@ -552,7 +552,7 @@ public function shouldUpdateVariable(): void $api->expects($this->once()) ->method('put') ->with('groups/1/variables/'.$expectedKey, ['value' => $expectedValue]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateVariable(1, $expectedKey, $expectedValue)); @@ -573,7 +573,7 @@ public function shouldUpdateVariableWithProtected(): void $api->expects($this->once()) ->method('put') ->with('groups/1/variables/DEPLOY_SERVER', ['value' => 'stage.example.com', 'protected' => true]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); @@ -590,7 +590,7 @@ public function shouldRemoveVariable(): void $api->expects($this->once()) ->method('delete') ->with('groups/1/variables/ftp_password') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeVariable(1, 'ftp_password')); @@ -615,7 +615,7 @@ public function shouldGetAllGroupProjectsWithIssuesEnabled(): void $api->expects($this->once()) ->method('get') ->with('groups/1/projects', ['with_issues_enabled' => 'true']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->projects(1, ['with_issues_enabled' => true])); @@ -635,7 +635,7 @@ public function shouldGetAllGroupProjectsWithMergeRequestsEnabled(): void $api->expects($this->once()) ->method('get') ->with('groups/1/projects', ['with_merge_requests_enabled' => 'true']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->projects(1, ['with_merge_requests_enabled' => true])); @@ -655,7 +655,7 @@ public function shouldGetAllGroupProjectsSharedToGroup(): void $api->expects($this->once()) ->method('get') ->with('groups/1/projects', ['with_shared' => 'true']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->projects(1, ['with_shared' => true])); @@ -675,7 +675,7 @@ public function shouldGetAllGroupProjectsIncludingSubsgroups(): void $api->expects($this->once()) ->method('get') ->with('groups/1/projects', ['include_subgroups' => 'true']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->projects(1, ['include_subgroups' => true])); @@ -695,7 +695,7 @@ public function shouldGetAllGroupProjectsIncludingCustomAttributes(): void $api->expects($this->once()) ->method('get') ->with('groups/1/projects', ['with_custom_attributes' => 'true']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->projects(1, ['with_custom_attributes' => true])); @@ -727,7 +727,7 @@ public function shouldGetIterations(): void $api->expects($this->once()) ->method('get') ->with('groups/1/iterations') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->iterations(1)); @@ -767,7 +767,7 @@ public function shouldGetPackages(): void $api->expects($this->once()) ->method('get') ->with('groups/1/packages') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->packages(1)); @@ -787,7 +787,7 @@ public function shouldGetGroupMergeRequests(): void $api->expects($this->once()) ->method('get') ->with('groups/1/merge_requests') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->mergeRequests(1, [])); @@ -817,7 +817,7 @@ public function shouldGetDeployTokens(): void $api->expects($this->once()) ->method('get') ->with('groups/1/deploy_tokens') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->deployTokens(1)); } @@ -846,7 +846,7 @@ public function shouldGetActiveDeployTokens(): void $api->expects($this->once()) ->method('get') ->with('groups/1/deploy_tokens', ['active' => true]) - ->will($this->returnValue([])); + ->willReturn([]);; $this->assertEquals([], $api->deployTokens(1, true)); } @@ -875,7 +875,7 @@ public function shouldGetInactiveDeployTokens(): void $api->expects($this->once()) ->method('get') ->with('groups/1/deploy_tokens', ['active' => false]) - ->will($this->returnValue([])); + ->willReturn([]);; $this->assertEquals([], $api->deployTokens(1, false)); } @@ -913,7 +913,7 @@ public function shouldCreateDeployToken(): void 'expires_at' => (new DateTime('2021-01-01'))->format('c'), ] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createDeployToken(1, [ 'name' => 'My Deploy Token', @@ -936,7 +936,7 @@ public function shouldDeleteDeployToken(): void $api->expects($this->once()) ->method('delete') ->with('groups/1/deploy_tokens/2') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); } @@ -962,7 +962,7 @@ public function shouldSearchGroups(): void 'order_by' => 'created_at', 'sort' => 'desc', ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->search(123, [ 'scope' => 'projects', diff --git a/tests/Api/IssueBoardsTest.php b/tests/Api/IssueBoardsTest.php index d39ebe0e..2cbf7249 100644 --- a/tests/Api/IssueBoardsTest.php +++ b/tests/Api/IssueBoardsTest.php @@ -32,7 +32,7 @@ public function shouldGetAllBoards(): void $api->expects($this->once()) ->method('get') ->with('boards', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all()); @@ -49,7 +49,7 @@ public function shouldShowIssueBoard(): void $api->expects($this->once()) ->method('get') ->with('projects/1/boards/2') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 2)); @@ -66,7 +66,7 @@ public function shouldCreateIssueBoard(): void $api->expects($this->once()) ->method('post') ->with('projects/1/boards', ['name' => 'A new issue board']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create(1, ['name' => 'A new issue board'])); @@ -83,7 +83,7 @@ public function shouldUpdateIssueBoard(): void $api->expects($this->once()) ->method('put') ->with('projects/1/boards/2', ['name' => 'A renamed issue board', 'labels' => 'foo']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(1, 2, ['name' => 'A renamed issue board', 'labels' => 'foo'])); @@ -100,7 +100,7 @@ public function shouldRemoveIssueBoard(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/boards/2') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(1, 2)); @@ -135,7 +135,7 @@ public function shouldGetAllLists(): void $api->expects($this->once()) ->method('get') ->with('projects/1/boards/2/lists') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->allLists(1, 2)); @@ -162,7 +162,7 @@ public function shouldGetList(): void $api->expects($this->once()) ->method('get') ->with('projects/1/boards/2/lists/3') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showList(1, 2, 3)); @@ -189,7 +189,7 @@ public function shouldCreateList(): void $api->expects($this->once()) ->method('post') ->with('projects/1/boards/2/lists', ['label_id' => 4]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createList(1, 2, 4)); @@ -216,7 +216,7 @@ public function shouldUpdateList(): void $api->expects($this->once()) ->method('put') ->with('projects/5/boards/2/lists/3', ['position' => 1]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateList(5, 2, 3, 1)); @@ -233,7 +233,7 @@ public function shouldDeleteList(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/boards/2/lists/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->deleteList(1, 2, 3)); diff --git a/tests/Api/IssueLinksTest.php b/tests/Api/IssueLinksTest.php index 2c76233d..5c37aa0f 100644 --- a/tests/Api/IssueLinksTest.php +++ b/tests/Api/IssueLinksTest.php @@ -40,7 +40,7 @@ public function shouldGetIssueLinks(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/10/links') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1, 10)); @@ -60,7 +60,7 @@ public function shouldCreateIssueLink(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/10/links', ['target_project_id' => 2, 'target_issue_iid' => 20]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create(1, 10, 2, 20)); @@ -80,7 +80,7 @@ public function shouldRemoveIssueLink(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/issues/10/links/100') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->remove(1, 10, 100)); diff --git a/tests/Api/IssueSubscribeTest.php b/tests/Api/IssueSubscribeTest.php index 2918eef4..a9f36af8 100644 --- a/tests/Api/IssueSubscribeTest.php +++ b/tests/Api/IssueSubscribeTest.php @@ -28,7 +28,7 @@ public function testSubscribeIssue(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/subscribe') - ->will($this->returnValue($expectedValue)); + ->willReturn($expectedValue);; $this->assertEquals($expectedValue, $api->subscribe(1, 2)); } @@ -40,7 +40,7 @@ public function testUnsubscribeIssue(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/unsubscribe') - ->will($this->returnValue($expectedValue)); + ->willReturn($expectedValue);; $this->assertEquals($expectedValue, $api->unsubscribe(1, 2)); } diff --git a/tests/Api/IssuesStatisticsTest.php b/tests/Api/IssuesStatisticsTest.php index 86898fd7..4b588137 100644 --- a/tests/Api/IssuesStatisticsTest.php +++ b/tests/Api/IssuesStatisticsTest.php @@ -46,7 +46,7 @@ public function shouldGetAll(): void 'updated_before' => $now->format('c'), 'confidential' => 'false', ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->all([ 'milestone' => '', @@ -77,7 +77,7 @@ public function shouldGetProject(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues_statistics', []) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->project(1, [])); } @@ -93,7 +93,7 @@ public function shouldGetGroup(): void $api->expects($this->once()) ->method('get') ->with('groups/1/issues_statistics', []) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->group(1, [])); } diff --git a/tests/Api/IssuesTest.php b/tests/Api/IssuesTest.php index 7c62ffd9..7110000c 100644 --- a/tests/Api/IssuesTest.php +++ b/tests/Api/IssuesTest.php @@ -32,7 +32,7 @@ public function shouldGetAllIssues(): void $api->expects($this->once()) ->method('get') ->with('issues', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all()); @@ -52,7 +52,7 @@ public function shouldGetAllGroupIssues(): void $api->expects($this->once()) ->method('get') ->with('groups/1/issues', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->group(1)); @@ -72,7 +72,7 @@ public function shouldGetGroupIssuesWithPagination(): void $api->expects($this->once()) ->method('get') ->with('groups/1/issues', ['page' => 2, 'per_page' => 5]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->group(1, ['page' => 2, 'per_page' => 5])); @@ -92,7 +92,7 @@ public function shouldGetGroupIssuesWithParams(): void $api->expects($this->once()) ->method('get') ->with('groups/1/issues', ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_title' => 'Title', 'assignee_id' => 1]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->group(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_title' => 'Title', 'assignee_id' => 1])); @@ -112,7 +112,7 @@ public function shouldGetProjectIssuesWithPagination(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues', ['page' => 2, 'per_page' => 5]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1, ['page' => 2, 'per_page' => 5])); @@ -132,7 +132,7 @@ public function shouldGetProjectIssuesWithParams(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues', ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_id' => 1, 'assignee_id' => 2]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_id' => 1, 'assignee_id' => 2])); @@ -149,7 +149,7 @@ public function shouldShowIssue(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 2)); @@ -166,7 +166,7 @@ public function shouldCreateIssue(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues', ['title' => 'A new issue', 'labels' => 'foo,bar']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create(1, ['title' => 'A new issue', 'labels' => 'foo,bar'])); @@ -183,7 +183,7 @@ public function shouldUpdateIssue(): void $api->expects($this->once()) ->method('put') ->with('projects/1/issues/2', ['title' => 'A renamed issue', 'labels' => 'foo']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(1, 2, ['title' => 'A renamed issue', 'labels' => 'foo'])); @@ -199,7 +199,7 @@ public function shouldReorderIssue(): void $api->expects($this->once()) ->method('put') ->with('projects/1/issues/2/reorder', ['move_after_id' => 3, 'move_before_id' => 4]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->reorder(1, 2, ['move_after_id' => 3, 'move_before_id' => 4])); } @@ -215,7 +215,7 @@ public function shouldMoveIssue(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/move', ['to_project_id' => 3]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->move(1, 2, 3)); @@ -235,7 +235,7 @@ public function shouldGetNotes(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/notes') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showNotes(1, 2)); @@ -252,7 +252,7 @@ public function shouldGetNote(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/notes/3') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showNote(1, 2, 3)); @@ -269,7 +269,7 @@ public function shouldCreateNote(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/notes', ['body' => 'A new note']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addNote(1, 2, 'A new note')); @@ -286,7 +286,7 @@ public function shouldUpdateNote(): void $api->expects($this->once()) ->method('put') ->with('projects/1/issues/2/notes/3', ['body' => 'An edited comment']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateNote(1, 2, 3, 'An edited comment')); @@ -303,7 +303,7 @@ public function shouldRemoveNote(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/issues/2/notes/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); @@ -323,7 +323,7 @@ public function shouldGetIssueDiscussions(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/discussions') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showDiscussions(1, 2)); @@ -340,7 +340,7 @@ public function shouldGetIssueDiscussion(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/discussions/abc') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showDiscussion(1, 2, 'abc')); @@ -357,7 +357,7 @@ public function shouldCreateDiscussion(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/discussions', ['body' => 'A new discussion']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addDiscussion(1, 2, 'A new discussion')); @@ -374,7 +374,7 @@ public function shouldCreateDiscussionNote(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/discussions/abc/notes', ['body' => 'A new discussion note']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addDiscussionNote(1, 2, 'abc', 'A new discussion note')); @@ -391,7 +391,7 @@ public function shouldUpdateDiscussionNote(): void $api->expects($this->once()) ->method('put') ->with('projects/1/issues/2/discussions/abc/notes/3', ['body' => 'An edited discussion note']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateDiscussionNote(1, 2, 'abc', 3, 'An edited discussion note')); @@ -408,7 +408,7 @@ public function shouldRemoveDiscussionNote(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/issues/2/discussions/abc/notes/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeDiscussionNote(1, 2, 'abc', 3)); @@ -425,7 +425,7 @@ public function shouldSetTimeEstimate(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/time_estimate', ['duration' => '4h']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->setTimeEstimate(1, 2, '4h')); @@ -442,7 +442,7 @@ public function shouldResetTimeEstimate(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/reset_time_estimate') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->resetTimeEstimate(1, 2)); @@ -459,7 +459,7 @@ public function shouldAddSpentTime(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/add_spent_time', ['duration' => '4h']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addSpentTime(1, 2, '4h')); @@ -476,7 +476,7 @@ public function shouldResetSpentTime(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/reset_spent_time') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->resetSpentTime(1, 2)); @@ -493,7 +493,7 @@ public function shouldGetIssueTimeStats(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/time_stats') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->getTimeStats(1, 2)); @@ -513,7 +513,7 @@ public function shouldIssueAwardEmoji(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/award_emoji') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->awardEmoji(1, 2)); @@ -530,7 +530,7 @@ public function shouldRevokeAwardEmoji(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/issues/2/award_emoji/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); @@ -550,7 +550,7 @@ public function shouldGetIssueClosedByMergeRequests(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/closed_by') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->closedByMergeRequests(1, 2)); @@ -570,7 +570,7 @@ public function shouldGetIssueRelatedMergeRequests(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/related_merge_requests') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->relatedMergeRequests(1, 2)); @@ -590,7 +590,7 @@ public function shouldGetProjectIssuesByAssignee(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues', ['assignee_id' => 1]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1, ['assignee_id' => 1])); @@ -624,7 +624,7 @@ public function shouldGetIssueParticipants(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/participants') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showParticipants(1, 2)); @@ -644,7 +644,7 @@ public function shouldGetIssueResourceLabelEvents(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/resource_label_events') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showResourceLabelEvents(1, 2)); @@ -661,7 +661,7 @@ public function shouldGetIssueResourceLabelEvent(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues/2/resource_label_events/3') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showResourceLabelEvent(1, 2, 3)); diff --git a/tests/Api/JobsTest.php b/tests/Api/JobsTest.php index 9ca55526..d8ff3f57 100644 --- a/tests/Api/JobsTest.php +++ b/tests/Api/JobsTest.php @@ -35,7 +35,7 @@ public function shouldGetAllJobs(): void ->with('projects/1/jobs', [ 'scope' => ['pending'], ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1, ['scope' => Jobs::SCOPE_PENDING])); @@ -57,7 +57,7 @@ public function shouldGetPipelineJobs(): void ->with('projects/1/pipelines/2/jobs', [ 'scope' => ['pending', 'running'], ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->pipelineJobs(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING]])); @@ -81,7 +81,7 @@ public function shouldGetPipelineJobsIncludingRetried(): void 'scope' => ['pending', 'running'], 'include_retried' => true, ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->pipelineJobs(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING], 'include_retried' => true])); @@ -103,7 +103,7 @@ public function shouldGetPipelineBridges(): void ->with('projects/1/pipelines/2/bridges', [ 'scope' => ['pending', 'running'], ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->pipelineBridges(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING]])); @@ -120,7 +120,7 @@ public function shouldGetJob(): void $api->expects($this->once()) ->method('get') ->with('projects/1/jobs/3') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 3)); @@ -137,7 +137,7 @@ public function shouldGetArtifacts(): void $api->expects($this->once()) ->method('getAsResponse') ->with('projects/1/jobs/3/artifacts') - ->will($this->returnValue($returnedStream)) + ->willReturn($returnedStream); ; $this->assertEquals('foobar', $api->artifacts(1, 3)->getContents()); @@ -154,7 +154,7 @@ public function shouldGetArtifactsByJobId(): void $api->expects($this->once()) ->method('getAsResponse') ->with('projects/1/jobs/3/artifacts/artifact_path') - ->will($this->returnValue($returnedStream)) + ->willReturn($returnedStream); ; $this->assertEquals('foobar', $api->artifactByJobId(1, 3, 'artifact_path')->getContents()); @@ -173,7 +173,7 @@ public function shouldGetArtifactsByRefName(): void ->with('projects/1/jobs/artifacts/master/download', [ 'job' => 'job name', ]) - ->will($this->returnValue($returnedStream)) + ->willReturn($returnedStream); ; $this->assertEquals('foobar', $api->artifactsByRefName(1, 'master', 'job name')->getContents()); @@ -191,7 +191,7 @@ public function shouldGetArtifactByRefName(): void ->with('projects/1/jobs/artifacts/master/raw/artifact_path', [ 'job' => 'job name', ]) - ->will($this->returnValue($returnedStream)) + ->willReturn($returnedStream); ; $this->assertEquals('foobar', $api->artifactByRefName(1, 'master', 'job name', 'artifact_path')->getContents()); } @@ -207,7 +207,7 @@ public function shouldGetTrace(): void $api->expects($this->once()) ->method('get') ->with('projects/1/jobs/3/trace') - ->will($this->returnValue($expectedString)) + ->willReturn($expectedString); ; $this->assertEquals($expectedString, $api->trace(1, 3)); @@ -224,7 +224,7 @@ public function shouldCancel(): void $api->expects($this->once()) ->method('post') ->with('projects/1/jobs/3/cancel') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->cancel(1, 3)); @@ -241,7 +241,7 @@ public function shouldRetry(): void $api->expects($this->once()) ->method('post') ->with('projects/1/jobs/3/retry') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->retry(1, 3)); @@ -258,7 +258,7 @@ public function shouldErase(): void $api->expects($this->once()) ->method('post') ->with('projects/1/jobs/3/erase') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->erase(1, 3)); @@ -275,7 +275,7 @@ public function shouldKeepArtifacts(): void $api->expects($this->once()) ->method('post') ->with('projects/1/jobs/3/artifacts/keep') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->keepArtifacts(1, 3)); @@ -292,7 +292,7 @@ public function shouldPlay(): void $api->expects($this->once()) ->method('post') ->with('projects/1/jobs/3/play') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->play(1, 3)); diff --git a/tests/Api/KeysTest.php b/tests/Api/KeysTest.php index 89af69f5..f148bc73 100644 --- a/tests/Api/KeysTest.php +++ b/tests/Api/KeysTest.php @@ -28,7 +28,7 @@ public function shouldShowKey(): void $api->expects($this->once()) ->method('get') ->with('keys/1') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->show(1)); } diff --git a/tests/Api/MergeRequestsTest.php b/tests/Api/MergeRequestsTest.php index 227b89a0..e310c470 100644 --- a/tests/Api/MergeRequestsTest.php +++ b/tests/Api/MergeRequestsTest.php @@ -29,7 +29,7 @@ public function shouldGetAll(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1)); @@ -46,7 +46,7 @@ public function shouldGetAllWithNoProject(): void $api->expects($this->once()) ->method('get') ->with('merge_requests', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all()); @@ -78,7 +78,7 @@ public function shouldGetAllWithParams(): void 'with_merge_status_recheck' => true, 'approved_by_ids' => [1], ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1, [ @@ -118,7 +118,7 @@ public function shouldGetAllWithDateTimeParams(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests', $expectedWithArray) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals( @@ -138,7 +138,7 @@ public function shouldShowMergeRequest(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 2)); @@ -160,7 +160,7 @@ public function shouldShowMergeRequestWithOptionalParameters(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2', ['include_diverged_commits_count' => true, 'include_rebase_in_progress' => true]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 2, [ @@ -184,7 +184,7 @@ public function shouldCreateMergeRequestWithoutOptionalParams(): void 'target_branch' => 'master', 'source_branch' => 'develop', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create(1, 'develop', 'master', 'Merge Request')); @@ -209,7 +209,7 @@ public function shouldCreateMergeRequestWithOptionalParams(): void 'description' => 'Some changes', 'remove_source_branch' => true, ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals( @@ -235,7 +235,7 @@ public function shouldUpdateMergeRequest(): void $api->expects($this->once()) ->method('put') ->with('projects/1/merge_requests/2', ['title' => 'Updated title', 'description' => 'No so many changes now', 'state_event' => 'close']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(1, 2, [ @@ -256,7 +256,7 @@ public function shouldMergeMergeRequest(): void $api->expects($this->once()) ->method('put') ->with('projects/1/merge_requests/2/merge', ['merge_commit_message' => 'Accepted']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->merge(1, 2, ['merge_commit_message' => 'Accepted'])); @@ -276,7 +276,7 @@ public function shouldGetNotes(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2/notes') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showNotes(1, 2)); @@ -293,7 +293,7 @@ public function shouldGetNote(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2/notes/3') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showNote(1, 2, 3)); @@ -310,7 +310,7 @@ public function shouldCreateNote(): void $api->expects($this->once()) ->method('post') ->with('projects/1/merge_requests/2/notes', ['body' => 'A new note']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addNote(1, 2, 'A new note')); @@ -327,7 +327,7 @@ public function shouldUpdateNote(): void $api->expects($this->once()) ->method('put') ->with('projects/1/merge_requests/2/notes/3', ['body' => 'An edited comment']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateNote(1, 2, 3, 'An edited comment')); @@ -344,7 +344,7 @@ public function shouldRemoveNote(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/merge_requests/2/notes/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); @@ -378,7 +378,7 @@ public function shouldGetMergeRequestParticipants(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2/participants') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showParticipants(1, 2)); @@ -395,7 +395,7 @@ public function shouldGetMergeRequestChanges(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2/changes') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->changes(1, 2)); @@ -415,7 +415,7 @@ public function shouldGetMergeRequestDiscussions(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2/discussions') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showDiscussions(1, 2)); @@ -432,7 +432,7 @@ public function shouldGetMergeRequestDiscussion(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2/discussions/abc') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showDiscussion(1, 2, 'abc')); @@ -449,7 +449,7 @@ public function shouldCreateDiscussion(): void $api->expects($this->once()) ->method('post') ->with('projects/1/merge_requests/2/discussions', ['body' => 'A new discussion']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addDiscussion(1, 2, ['body' => 'A new discussion'])); @@ -466,7 +466,7 @@ public function shouldResolveDiscussion(): void $api->expects($this->once()) ->method('put') ->with('projects/1/merge_requests/2/discussions/abc', ['resolved' => true]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->resolveDiscussion(1, 2, 'abc', true)); @@ -483,7 +483,7 @@ public function shouldUnresolveDiscussion(): void $api->expects($this->once()) ->method('put') ->with('projects/1/merge_requests/2/discussions/abc', ['resolved' => false]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->resolveDiscussion(1, 2, 'abc', false)); @@ -500,7 +500,7 @@ public function shouldCreateDiscussionNote(): void $api->expects($this->once()) ->method('post') ->with('projects/1/merge_requests/2/discussions/abc/notes', ['body' => 'A new discussion note']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addDiscussionNote(1, 2, 'abc', 'A new discussion note')); @@ -517,7 +517,7 @@ public function shouldUpdateDiscussionNote(): void $api->expects($this->once()) ->method('put') ->with('projects/1/merge_requests/2/discussions/abc/notes/3', ['body' => 'An edited discussion note']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateDiscussionNote(1, 2, 'abc', 3, ['body' => 'An edited discussion note'])); @@ -534,7 +534,7 @@ public function shouldRemoveDiscussionNote(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/merge_requests/2/discussions/abc/notes/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeDiscussionNote(1, 2, 'abc', 3)); @@ -551,7 +551,7 @@ public function shouldGetIssuesClosedByMergeRequest(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2/closes_issues') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->closesIssues(1, 2)); @@ -568,7 +568,7 @@ public function shouldGetMergeRequestByIid(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests', ['iids' => [2]]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1, ['iids' => [2]])); @@ -585,7 +585,7 @@ public function shouldApproveMergeRequest(): void $api->expects($this->once()) ->method('post') ->with('projects/1/merge_requests/2/approve') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->approve(1, 2)); @@ -602,7 +602,7 @@ public function shouldUnApproveMergeRequest(): void $api->expects($this->once()) ->method('post') ->with('projects/1/merge_requests/2/unapprove') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->unapprove(1, 2)); @@ -619,7 +619,7 @@ public function shouldGetMergeRequestApprovals(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests', ['iids' => [2]]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1, ['iids' => [2]])); @@ -639,7 +639,7 @@ public function shouldIssueMergeRequestAwardEmoji(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2/award_emoji') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->awardEmoji(1, 2)); @@ -656,7 +656,7 @@ public function shouldRevokeMergeRequestAwardEmoji(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/merge_requests/2/award_emoji/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); @@ -676,7 +676,7 @@ public function shoudGetApprovalState(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2/approval_state') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->approvalState(1, 2)); } @@ -706,7 +706,7 @@ public function shoudGetLevelRules(): void $api->expects($this->once()) ->method('get') ->with('projects/1/merge_requests/2/approval_rules') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->levelRules(1, 2)); } @@ -740,7 +740,7 @@ public function shoudCreateLevelRuleWithoutOptionalParameters(): void 'approvals_required' => 3, ] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createLevelRule(1, 2, 'Foo', 3)); } @@ -776,7 +776,7 @@ public function shoudCreateLevelRuleWithOptionalParameters(): void 'group_ids' => [104121], ] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createLevelRule(1, 2, 'Foo', 3, [ 'user_ids' => [1951878], @@ -813,7 +813,7 @@ public function shoudUpdateLevelRuleWithoutOptionalParameters(): void 'approvals_required' => 3, ] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->updateLevelRule(1, 2, 20892835, 'Foo', 3)); } @@ -849,7 +849,7 @@ public function shoudUpdateLevelRuleWithOptionalParameters(): void 'group_ids' => [104121], ] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->updateLevelRule(1, 2, 20892835, 'Foo', 3, [ 'user_ids' => [1951878], @@ -868,7 +868,7 @@ public function shoudDeleteLevelRule(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/merge_requests/2/approval_rules/3') - ->will($this->returnValue($expectedValue)); + ->willReturn($expectedValue);; $this->assertEquals($expectedValue, $api->deleteLevelRule(1, 2, 3)); } @@ -897,7 +897,7 @@ public function shouldRebaseMergeRequest(): void $api->expects($this->once()) ->method('put') ->with('projects/1/merge_requests/2/rebase', ['skip_ci' => true]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->rebase(1, 2, [ diff --git a/tests/Api/MilestonesTest.php b/tests/Api/MilestonesTest.php index 16f86a35..2a440da7 100644 --- a/tests/Api/MilestonesTest.php +++ b/tests/Api/MilestonesTest.php @@ -32,7 +32,7 @@ public function shouldGetAllMilestones(): void $api->expects($this->once()) ->method('get') ->with('projects/1/milestones') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1)); @@ -49,7 +49,7 @@ public function shouldShowMilestone(): void $api->expects($this->once()) ->method('get') ->with('projects/1/milestones/2') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 2)); @@ -66,7 +66,7 @@ public function shouldCreateMilestone(): void $api->expects($this->once()) ->method('post') ->with('projects/1/milestones', ['description' => 'Some text', 'title' => 'A new milestone']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create(1, ['description' => 'Some text', 'title' => 'A new milestone'])); @@ -83,7 +83,7 @@ public function shouldUpdateMilestone(): void $api->expects($this->once()) ->method('put') ->with('projects/1/milestones/3', ['title' => 'Updated milestone', 'due_date' => '2015-04-01', 'state_event' => 'close']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated milestone', 'due_date' => '2015-04-01', 'state_event' => 'close'])); @@ -100,7 +100,7 @@ public function shouldRemoveMilestone(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/milestones/2') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(1, 2)); @@ -120,7 +120,7 @@ public function shouldGetMilestonesIssues(): void $api->expects($this->once()) ->method('get') ->with('projects/1/milestones/3/issues') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->issues(1, 3)); @@ -140,7 +140,7 @@ public function shouldGetMilestonesMergeRequests(): void $api->expects($this->once()) ->method('get') ->with('projects/1/milestones/3/merge_requests') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->mergeRequests(1, 3)); diff --git a/tests/Api/PackagesTest.php b/tests/Api/PackagesTest.php index 44265c46..823504cc 100644 --- a/tests/Api/PackagesTest.php +++ b/tests/Api/PackagesTest.php @@ -43,7 +43,7 @@ public function shouldGetAllPackages(): void $api->expects($this->once()) ->method('get') ->with('projects/1/packages') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->all(1)); } @@ -61,7 +61,7 @@ public function shouldShowPackage(): void $api->expects($this->once()) ->method('get') ->with('projects/1/packages/1') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->show(1, 1)); } @@ -81,7 +81,7 @@ public function shouldGetAllPackageFiles(): void $api->expects($this->once()) ->method('get') ->with('projects/1/packages/1/package_files') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->allFiles(1, 1)); } @@ -97,7 +97,7 @@ public function shouldRemovePackage(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/packages/1') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->remove(1, 1)); } @@ -113,7 +113,7 @@ public function shouldRemovePackageFile(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/packages/1/package_files/25') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->removeFile(1, 1, 25)); } diff --git a/tests/Api/ProjectNamespacesTest.php b/tests/Api/ProjectNamespacesTest.php index 69e59ecd..2e1f03a0 100644 --- a/tests/Api/ProjectNamespacesTest.php +++ b/tests/Api/ProjectNamespacesTest.php @@ -32,7 +32,7 @@ public function shouldGetAllNamespaces(): void $api->expects($this->once()) ->method('get') ->with('namespaces', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all()); @@ -49,7 +49,7 @@ public function shouldShowNamespace(): void $api->expects($this->once()) ->method('get') ->with('namespaces/1') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1)); diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index c3296d62..9a606c9b 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -61,7 +61,7 @@ public function shouldNotNeedPaginationWhenGettingProjects(): void $api->expects($this->once()) ->method('get') ->with('projects') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->all()); } @@ -261,7 +261,7 @@ public function shouldShowProject(): void $api->expects($this->once()) ->method('get') ->with('projects/1') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->show(1)); } @@ -287,7 +287,7 @@ public function shouldShowProjectWithStatistics(): void $api->expects($this->once()) ->method('get') ->with('projects/1', ['statistics' => true]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->show(1, ['statistics' => true])); } @@ -303,7 +303,7 @@ public function shouldCreateProject(): void $api->expects($this->once()) ->method('post') ->with('projects', ['name' => 'Project Name', 'issues_enabled' => true]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->create('Project Name', [ 'issues_enabled' => true, @@ -321,7 +321,7 @@ public function shouldUpdateProject(): void $api->expects($this->once()) ->method('put') ->with('projects/1', ['name' => 'Updated Name', 'issues_enabled' => true]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->update(1, [ 'name' => 'Updated Name', @@ -340,7 +340,7 @@ public function shouldArchiveProject(): void $api->expects($this->once()) ->method('post') ->with('projects/1/archive') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->archive(1)); } @@ -356,7 +356,7 @@ public function shouldUnarchiveProject(): void $api->expects($this->once()) ->method('post') ->with('projects/1/unarchive') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->unarchive(1)); } @@ -372,7 +372,7 @@ public function shouldCreateProjectForUser(): void $api->expects($this->once()) ->method('post') ->with('projects/user/1', ['name' => 'Project Name', 'issues_enabled' => true]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createForUser(1, 'Project Name', [ 'issues_enabled' => true, @@ -390,7 +390,7 @@ public function shouldRemoveProject(): void $api->expects($this->once()) ->method('delete') ->with('projects/1') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->remove(1)); } @@ -410,7 +410,7 @@ public function shouldGetPipelines(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipelines') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->pipelines(1)); } @@ -429,7 +429,7 @@ public function shouldGetTriggers(): void $api->expects($this->once()) ->method('get') ->with('projects/1/triggers') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->triggers(1)); } @@ -449,7 +449,7 @@ public function shouldGetTrigger(): void $api->expects($this->once()) ->method('get') ->with('projects/1/triggers/3') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->trigger(1, 3)); } @@ -467,7 +467,7 @@ public function shouldGetProjectIssues(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->issues(1)); } @@ -485,7 +485,7 @@ public function shouldGetProjectUsers(): void $api->expects($this->once()) ->method('get') ->with('projects/1/users') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->users(1)); } @@ -503,7 +503,7 @@ public function shouldGetProjectIssuesParameters(): void $api->expects($this->once()) ->method('get') ->with('projects/1/issues') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->issues(1, ['state' => 'opened'])); } @@ -612,7 +612,7 @@ public function shouldGetBoards(): void $api->expects($this->once()) ->method('get') ->with('projects/1/boards') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->boards(1)); } @@ -700,7 +700,7 @@ public function shouldGetIterations(): void $api->expects($this->once()) ->method('get') ->with('projects/1/iterations') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->iterations(1)); @@ -721,7 +721,7 @@ public function shouldCreateTrigger(): void $api->expects($this->once()) ->method('post') ->with('projects/1/triggers', ['description' => 'foobar']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createTrigger(1, 'foobar')); } @@ -737,7 +737,7 @@ public function shouldRemoveTrigger(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/triggers/2') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->removeTrigger(1, 2)); } @@ -761,7 +761,7 @@ public function shouldTriggerPipeline(): void 'projects/1/trigger/pipeline', ['ref' => 'master', 'token' => 'some_token', 'variables' => ['VAR_1' => 'value 1']] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->triggerPipeline(1, 'master', 'some_token', ['VAR_1' => 'value 1'])); } @@ -781,7 +781,7 @@ public function shouldGetPipelinesWithBooleanParam(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipelines', ['yaml_errors' => 'false']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->pipelines(1, ['yaml_errors' => false])); } @@ -809,7 +809,7 @@ public function shouldGetPipelineWithDateParam(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipelines', $expectedWithArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->pipelines(1, [ 'updated_after' => $updated_after, @@ -832,7 +832,7 @@ public function shouldGetPipelinesWithSHA(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipelines', ['sha' => '123']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->pipelines(1, ['sha' => '123'])); } @@ -852,7 +852,7 @@ public function shouldGetPipeline(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipelines/3') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->pipeline(1, 3)); } @@ -872,7 +872,7 @@ public function shouldGetPipelineJobs(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipelines/3/jobs') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->pipelineJobs(1, 3)); } @@ -891,7 +891,7 @@ public function shouldGetPipelineVariables(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipelines/3/variables') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->pipelineVariables(1, 3)); } @@ -915,7 +915,7 @@ public function shouldGetPipelineTestReport(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipelines/3/test_report') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->pipelineTestReport(1, 3)); } @@ -939,7 +939,7 @@ public function shouldGetPipelineTestReportSummary(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipelines/3/test_report_summary') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->pipelineTestReportSummary(1, 3)); } @@ -957,7 +957,7 @@ public function shouldCreatePipeline(): void $api->expects($this->once()) ->method('post') ->with('projects/1/pipeline', [], [], [], ['ref' => 'test-pipeline']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createPipeline(1, 'test-pipeline')); } @@ -986,7 +986,7 @@ public function shouldCreatePipelineWithVariables(): void $api->expects($this->once()) ->method('post') ->with('projects/1/pipeline', ['variables' => $variables], [], [], ['ref' => 'test-pipeline']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createPipeline(1, 'test-pipeline', $variables)); } @@ -1004,7 +1004,7 @@ public function shouldRetryPipeline(): void $api->expects($this->once()) ->method('post') ->with('projects/1/pipelines/4/retry') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->retryPipeline(1, 4)); } @@ -1022,7 +1022,7 @@ public function shouldCancelPipeline(): void $api->expects($this->once()) ->method('post') ->with('projects/1/pipelines/6/cancel') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->cancelPipeline(1, 6)); } @@ -1038,7 +1038,7 @@ public function shouldDeletePipeline(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/pipelines/3') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->deletePipeline(1, 3)); } @@ -1057,7 +1057,7 @@ public function shouldGetAllMembers(): void $api->expects($this->once()) ->method('get') ->with('projects/1/members/all') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->allMembers(1)); } @@ -1073,7 +1073,7 @@ public function shouldGetAllMember(): void $api->expects($this->once()) ->method('get') ->with('projects/1/members/all/2') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->allMember(1, 2)); } @@ -1092,7 +1092,7 @@ public function shouldGetMembers(): void $api->expects($this->once()) ->method('get') ->with('projects/1/members') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->members(1)); } @@ -1110,7 +1110,7 @@ public function shouldGetMembersWithQuery(): void $api->expects($this->once()) ->method('get') ->with('projects/1/members', ['query' => 'at']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->members(1, ['query' => 'at'])); } @@ -1129,7 +1129,7 @@ public function shouldGetMembersWithNullQuery(): void $api->expects($this->once()) ->method('get') ->with('projects/1/members') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->members(1)); } @@ -1151,7 +1151,7 @@ public function shouldGetMembersWithPagination(): void 'page' => 2, 'per_page' => 15, ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->members(1, ['page' => 2, 'per_page' => 15])); } @@ -1167,7 +1167,7 @@ public function shouldGetMember(): void $api->expects($this->once()) ->method('get') ->with('projects/1/members/2') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->member(1, 2)); } @@ -1183,7 +1183,7 @@ public function shouldAddMember(): void $api->expects($this->once()) ->method('post') ->with('projects/1/members', ['user_id' => 2, 'access_level' => 3]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addMember(1, 2, 3)); } @@ -1205,7 +1205,7 @@ public function shouldAddMemberWithExpiration(): void $api->expects($this->once()) ->method('post') ->with('projects/1/members', ['user_id' => 3, 'access_level' => 3, 'expires_at' => $expiration]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addMember(1, 3, 3, $expiration)); } @@ -1221,7 +1221,7 @@ public function shouldSaveMember(): void $api->expects($this->once()) ->method('put') ->with('projects/1/members/2', ['access_level' => 4]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->saveMember(1, 2, 4)); } @@ -1243,7 +1243,7 @@ public function shouldSaveMemberWithExpiration(): void $api->expects($this->once()) ->method('put') ->with('projects/1/members/3', ['access_level' => 4, 'expires_at' => $expiration]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->saveMember(1, 3, 4, $expiration)); } @@ -1259,7 +1259,7 @@ public function shouldRemoveMember(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/members/2') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->removeMember(1, 2)); } @@ -1278,7 +1278,7 @@ public function shouldGetHooks(): void $api->expects($this->once()) ->method('get') ->with('projects/1/hooks') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->hooks(1)); } @@ -1294,7 +1294,7 @@ public function shouldGetHook(): void $api->expects($this->once()) ->method('get') ->with('projects/1/hooks/2') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->hook(1, 2)); } @@ -1315,7 +1315,7 @@ public function shouldAddHook(): void 'issues_events' => true, 'merge_requests_events' => true, ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addHook( 1, @@ -1335,7 +1335,7 @@ public function shouldAddHookWithOnlyUrl(): void $api->expects($this->once()) ->method('post') ->with('projects/1/hooks', ['url' => 'http://www.example.com/', 'push_events' => true]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addHook(1, 'http://www.example.com/')); } @@ -1351,7 +1351,7 @@ public function shouldAddHookWithoutPushEvents(): void $api->expects($this->once()) ->method('post') ->with('projects/1/hooks', ['url' => 'http://www.example.com/', 'push_events' => false]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addHook(1, 'http://www.example.com/', ['push_events' => false])); } @@ -1367,7 +1367,7 @@ public function shouldUpdateHook(): void $api->expects($this->once()) ->method('put') ->with('projects/1/hooks/3', ['url' => 'http://www.example-test.com/', 'push_events' => false]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -1386,7 +1386,7 @@ public function shouldRemoveHook(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/hooks/2') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->removeHook(1, 2)); } @@ -1406,7 +1406,7 @@ public function shouldTransfer(): void $api->expects($this->once()) ->method('put') ->with('projects/1/transfer', ['namespace' => 'a_namespace']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->transfer(1, 'a_namespace')); } @@ -1425,7 +1425,7 @@ public function shouldGetDeployKeys(): void $api->expects($this->once()) ->method('get') ->with('projects/1/deploy_keys') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->deployKeys(1)); } @@ -1441,7 +1441,7 @@ public function shouldGetDeployKey(): void $api->expects($this->once()) ->method('get') ->with('projects/1/deploy_keys/2') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->deployKey(1, 2)); } @@ -1457,7 +1457,7 @@ public function shouldAddKey(): void $api->expects($this->once()) ->method('post') ->with('projects/1/deploy_keys', ['title' => 'new-key', 'key' => '...', 'can_push' => false]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addDeployKey(1, 'new-key', '...')); } @@ -1473,7 +1473,7 @@ public function shouldAddKeyWithPushOption(): void $api->expects($this->once()) ->method('post') ->with('projects/1/deploy_keys', ['title' => 'new-key', 'key' => '...', 'can_push' => true]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addDeployKey(1, 'new-key', '...', true)); } @@ -1489,7 +1489,7 @@ public function shouldDeleteDeployKey(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/deploy_keys/3') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->deleteDeployKey(1, 3)); } @@ -1505,7 +1505,7 @@ public function shoudEnableDeployKey(): void $api->expects($this->once()) ->method('post') ->with('projects/1/deploy_keys/3/enable') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->enableDeployKey(1, 3)); } @@ -1534,7 +1534,7 @@ public function shouldGetDeployTokens(): void $api->expects($this->once()) ->method('get') ->with('projects/1/deploy_tokens') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->deployTokens(1)); } @@ -1563,7 +1563,7 @@ public function shouldGetActiveDeployTokens(): void $api->expects($this->once()) ->method('get') ->with('projects/1/deploy_tokens', ['active' => true]) - ->will($this->returnValue([])); + ->willReturn([]);; $this->assertEquals([], $api->deployTokens(1, true)); } @@ -1592,7 +1592,7 @@ public function shouldGetInactiveDeployTokens(): void $api->expects($this->once()) ->method('get') ->with('projects/1/deploy_tokens', ['active' => false]) - ->will($this->returnValue([])); + ->willReturn([]);; $this->assertEquals([], $api->deployTokens(1, false)); } @@ -1630,7 +1630,7 @@ public function shouldCreateDeployToken(): void 'expires_at' => (new DateTime('2021-01-01'))->format('c'), ] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createDeployToken(1, [ 'name' => 'My Deploy Token', @@ -1653,7 +1653,7 @@ public function shouldDeleteDeployToken(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/deploy_tokens/2') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); } @@ -1672,7 +1672,7 @@ public function shouldGetEvents(): void $api->expects($this->once()) ->method('get') ->with('projects/1/events', []) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->events(1)); } @@ -1699,7 +1699,7 @@ public function shouldGetEventsWithDateTimeParams(): void $api->expects($this->once()) ->method('get') ->with('projects/1/events', $expectedWithArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->events(1, ['after' => $after, 'before' => $before])); } @@ -1721,7 +1721,7 @@ public function shouldGetEventsWithPagination(): void 'page' => 2, 'per_page' => 15, ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->events(1, ['page' => 2, 'per_page' => 15])); } @@ -1740,7 +1740,7 @@ public function shouldGetLabels(): void $api->expects($this->once()) ->method('get') ->with('projects/1/labels') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->labels(1)); } @@ -1756,7 +1756,7 @@ public function shouldAddLabel(): void $api->expects($this->once()) ->method('post') ->with('projects/1/labels', ['name' => 'wont-fix', 'color' => '#ffffff']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addLabel(1, ['name' => 'wont-fix', 'color' => '#ffffff'])); } @@ -1772,7 +1772,7 @@ public function shouldUpdateLabel(): void $api->expects($this->once()) ->method('put') ->with('projects/1/labels/123', ['new_name' => 'big-bug', 'color' => '#00ffff']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -1791,7 +1791,7 @@ public function shouldRemoveLabel(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/labels/456', []) - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->removeLabel(1, 456)); } @@ -1805,7 +1805,7 @@ public function shouldGetLanguages(): void $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->languages(1)); } @@ -1823,7 +1823,7 @@ public function shouldForkWithNamespace(): void $api->expects($this->once()) ->method('post') ->with('projects/1/fork', $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->fork(1, [ 'namespace' => 'new_namespace', @@ -1844,7 +1844,7 @@ public function shouldForkWithNamespaceAndPath(): void $api->expects($this->once()) ->method('post') ->with('projects/1/fork', $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->fork(1, [ 'namespace' => 'new_namespace', @@ -1867,7 +1867,7 @@ public function shouldForkWithNamespaceAndPathAndName(): void $api->expects($this->once()) ->method('post') ->with('projects/1/fork', $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->fork(1, [ 'namespace' => 'new_namespace', @@ -1887,7 +1887,7 @@ public function shouldCreateForkRelation(): void $api->expects($this->once()) ->method('post') ->with('projects/1/fork/2') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createForkRelation(1, 2)); } @@ -1903,7 +1903,7 @@ public function shouldRemoveForkRelation(): void $api->expects($this->once()) ->method('delete') ->with('projects/2/fork') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->removeForkRelation(2)); } @@ -1931,7 +1931,7 @@ public function shouldGetForks(): void $api->expects($this->once()) ->method('get') ->with('projects/1/forks') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->forks(1)); } @@ -1979,7 +1979,7 @@ public function shouldGetForksUsingParameters(): void 'updated_before' => $updated_before->format('c'), 'with_custom_attributes' => 'true', ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->forks(1, [ 'archived' => false, @@ -2012,7 +2012,7 @@ public function shouldSetService(): void $api->expects($this->once()) ->method('put') ->with('projects/1/services/hipchat', ['param' => 'value']) - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->setService(1, 'hipchat', ['param' => 'value'])); } @@ -2028,7 +2028,7 @@ public function shouldRemoveService(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/services/hipchat') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->removeService(1, 'hipchat')); } @@ -2047,7 +2047,7 @@ public function shouldGetVariables(): void $api->expects($this->once()) ->method('get') ->with('projects/1/variables') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->variables(1)); } @@ -2063,7 +2063,7 @@ public function shouldGetVariable(): void $api->expects($this->once()) ->method('get') ->with('projects/1/variables/ftp_username') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->variable(1, 'ftp_username')); } @@ -2085,7 +2085,7 @@ public function shouldAddVariable(): void $api->expects($this->once()) ->method('post') ->with('projects/1/variables', $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addVariable(1, $expectedKey, $expectedValue)); } @@ -2105,7 +2105,7 @@ public function shouldAddVariableWithProtected(): void $api->expects($this->once()) ->method('post') ->with('projects/1/variables', $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); } @@ -2125,7 +2125,7 @@ public function shouldAddVariableWithEnvironment(): void $api->expects($this->once()) ->method('post') ->with('projects/1/variables', $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -2149,7 +2149,7 @@ public function shouldAddVariableWithProtectionAndEnvironment(): void $api->expects($this->once()) ->method('post') ->with('projects/1/variables', $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -2173,7 +2173,7 @@ public function shouldAddVariableWithEnvironmentAndVariableType(): void $api->expects($this->once()) ->method('post') ->with('projects/1/variables', $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -2196,7 +2196,7 @@ public function shouldAddVariableWithEnvironmentFromParameterList(): void $api->expects($this->once()) ->method('post') ->with('projects/1/variables', $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -2221,7 +2221,7 @@ public function shouldUpdateVariable(): void $api->expects($this->once()) ->method('put') ->with('projects/1/variables/'.$expectedKey, ['value' => $expectedValue]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->updateVariable(1, $expectedKey, $expectedValue)); } @@ -2241,7 +2241,7 @@ public function shouldUpdateVariableWithProtected(): void $api->expects($this->once()) ->method('put') ->with('projects/1/variables/DEPLOY_SERVER', ['value' => 'stage.example.com', 'protected' => true]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); } @@ -2264,7 +2264,7 @@ public function shouldUpdateVariableWithEnvironment(): void 'projects/1/variables/DEPLOY_SERVER', ['value' => 'stage.example.com', 'environment_scope' => 'staging'] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -2291,7 +2291,7 @@ public function shouldUpdateVariableWithProtectedAndEnvironment(): void 'projects/1/variables/DEPLOY_SERVER', ['value' => 'stage.example.com', 'protected' => true, 'environment_scope' => 'staging'] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -2318,7 +2318,7 @@ public function shouldUpdateVariableWithEnvironmentAndVariableType(): void 'projects/1/variables/DEPLOY_SERVER', ['value' => 'stage.example.com', 'environment_scope' => 'staging', 'variable_type' => 'file'] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -2344,7 +2344,7 @@ public function shouldUpdateVariableWithEnvironmentFromParameterList(): void 'projects/1/variables/DEPLOY_SERVER', ['value' => 'stage.example.com', 'environment_scope' => 'staging'] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -2363,7 +2363,7 @@ public function shouldRemoveVariable(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/variables/ftp_password') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->removeVariable(1, 'ftp_password')); } @@ -2374,7 +2374,7 @@ protected function getMultipleProjectsRequestMock($path, $expectedArray = [], $e $api->expects($this->once()) ->method('get') ->with($path, $expectedParameters) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); return $api; } @@ -2393,7 +2393,7 @@ public function shouldGetDeployments(): void $api->expects($this->once()) ->method('get') ->with('projects/1/deployments', []) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->deployments(1)); } @@ -2415,7 +2415,7 @@ public function shouldGetDeploymentsWithPagination(): void 'page' => 2, 'per_page' => 15, ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->deployments(1, ['page' => 2, 'per_page' => 15])); } @@ -2438,7 +2438,7 @@ public function shouldGetDeploymentsSorted(): void 'order_by' => 'id', 'sort' => 'asc', ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->deployments(1, ['order_by' => 'id', 'sort' => 'asc'])); @@ -2449,7 +2449,7 @@ public function shouldGetDeploymentsSorted(): void 'order_by' => 'id', 'sort' => 'desc', ]) - ->will($this->returnValue(\array_reverse($expectedArray))); + ->willReturn(\array_reverse($expectedArray)); $this->assertEquals(\array_reverse($expectedArray), $api->deployments(1, ['order_by' => 'id', 'sort' => 'desc'])); } @@ -2473,7 +2473,7 @@ public function shouldGetDeploymentsFiltered(): void ->with('projects/1/deployments', [ 'updated_after' => $time->format('c'), ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->deployments(1, ['updated_after' => $time])); } @@ -2538,7 +2538,7 @@ public function shouldGetBadges(): void $api->expects($this->once()) ->method('get') ->with('projects/1/badges') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->badges(1)); } @@ -2557,7 +2557,7 @@ public function shouldGetBadge(): void $api->expects($this->once()) ->method('get') ->with('projects/1/badges/1') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->badge(1, 1)); } @@ -2579,7 +2579,7 @@ public function shouldAddBadge(): void $api->expects($this->once()) ->method('post') ->with('projects/1/badges', ['link_url' => $link_url, 'image_url' => $image_url]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals( $expectedArray, @@ -2601,7 +2601,7 @@ public function shouldUpdateBadge(): void $api->expects($this->once()) ->method('put') ->with('projects/1/badges/2') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->updateBadge(1, 2, ['image_url' => $image_url])); } @@ -2617,7 +2617,7 @@ public function shouldRemoveBadge(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/badges/1') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->removeBadge(1, 1)); } @@ -2645,7 +2645,7 @@ public function shouldAddProtectedBranch(): void 'projects/1/protected_branches', ['name' => 'master', 'push_access_level' => 0, 'merge_access_level' => 30] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addProtectedBranch(1, ['name' => 'master', 'push_access_level' => 0, 'merge_access_level' => 30])); } @@ -2661,7 +2661,7 @@ public function shouldRemoveProtectedBranch(): void ->with( 'projects/1/protected_branches/test-branch' ) - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->deleteProtectedBranch(1, 'test-branch')); } @@ -2686,7 +2686,7 @@ public function shoudGetApprovalsConfiguration(): void $api->expects($this->once()) ->method('get') ->with('projects/1/approvals') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->approvalsConfiguration(1)); } @@ -2714,7 +2714,7 @@ public function shoudGetApprovalsRules(): void $api->expects($this->once()) ->method('get') ->with('projects/1/approval_rules') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->approvalsRules(1)); } @@ -2736,7 +2736,7 @@ public function shoudCreateApprovalsRule(): void $api->expects($this->once()) ->method('post') ->with('projects/1/approval_rules/', ['name' => 'All Members', 'rule_type' => 'any_approver']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createApprovalsRule(1, [ 'name' => 'All Members', @@ -2759,7 +2759,7 @@ public function shoudUpdateApprovalsRule(): void $api->expects($this->once()) ->method('put') ->with('projects/1/approval_rules/1', ['name' => 'Updated Name']) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->updateApprovalsRule(1, 1, [ 'name' => 'Updated Name', @@ -2777,7 +2777,7 @@ public function shoudDeleteApprovalsRule(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/approval_rules/1') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->deleteApprovalsRule(1, 1)); } @@ -2793,7 +2793,7 @@ public function shouldDeleteAllMergedBranches(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/repository/merged_branches') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->deleteAllMergedBranches(1)); } @@ -2828,7 +2828,7 @@ public function shouldGetProtectedBranches(): void $api->expects($this->once()) ->method('get') ->with('projects/1/protected_branches') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->protectedBranches(1)); } @@ -2857,7 +2857,7 @@ public function shouldGetProjectAccessTokens(): void $api->expects($this->once()) ->method('get') ->with('projects/1/access_tokens') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->projectAccessTokens(1)); } @@ -2884,7 +2884,7 @@ public function shouldGetProjectAccessToken(): void $api->expects($this->once()) ->method('get') ->with('projects/1/access_tokens/42') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->projectAccessToken(1, 42)); } @@ -2923,7 +2923,7 @@ public function shouldCreateProjectAccessToken(): void 'expires_at' => '2021-01-31', ] ) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->createProjectAccessToken(1, [ 'name' => 'test_token', @@ -2947,7 +2947,7 @@ public function shouldDeleteProjectAccessToken(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/access_tokens/2') - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->deleteProjectAccessToken(1, 2)); } @@ -2966,7 +2966,7 @@ public function shouldUploadAvatar(): void $api->expects($this->once()) ->method('put') ->with('projects/1', [], [], ['avatar' => $fileName]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->uploadAvatar(1, $fileName)); \unlink($fileName); } @@ -2992,7 +2992,7 @@ public function shouldAddProtectedTag(): void $api->expects($this->once()) ->method('post') ->with('projects/1/protected_tags', $params) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addProtectedTag(1, $params)); } @@ -3008,7 +3008,7 @@ public function shouldRemoveProtectedTag(): void ->with( 'projects/1/protected_tags/release-%2A' ) - ->will($this->returnValue($expectedBool)); + ->willReturn($expectedBool);; $this->assertEquals($expectedBool, $api->deleteProtectedTag(1, 'release-*')); } @@ -3039,7 +3039,7 @@ public function shouldSearchGroups(): void 'order_by' => 'created_at', 'sort' => 'desc', ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->search(123, [ 'scope' => 'issues', diff --git a/tests/Api/RepositoriesTest.php b/tests/Api/RepositoriesTest.php index d674dc43..66453b22 100644 --- a/tests/Api/RepositoriesTest.php +++ b/tests/Api/RepositoriesTest.php @@ -32,7 +32,7 @@ public function shouldGetBranches(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/branches', ['search' => '^term']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->branches(1, ['search' => '^term'])); @@ -49,7 +49,7 @@ public function shouldGetBranch(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/branches/master') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->branch(1, 'master')); @@ -66,7 +66,7 @@ public function shouldCreateBranch(): void $api->expects($this->once()) ->method('post') ->with('projects/1/repository/branches', ['branch' => 'feature', 'ref' => 'master']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createBranch(1, 'feature', 'master')); @@ -83,7 +83,7 @@ public function shouldDeleteBranch(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/repository/branches/feature%2FTEST-15') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->deleteBranch(1, 'feature/TEST-15')); @@ -100,7 +100,7 @@ public function shouldProtectBranch(): void $api->expects($this->once()) ->method('put') ->with('projects/1/repository/branches/master/protect', ['developers_can_push' => false, 'developers_can_merge' => false]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->protectBranch(1, 'master')); @@ -117,7 +117,7 @@ public function shouldProtectBranchWithPermissions(): void $api->expects($this->once()) ->method('put') ->with('projects/1/repository/branches/master/protect', ['developers_can_push' => true, 'developers_can_merge' => true]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->protectBranch(1, 'master', true, true)); @@ -134,7 +134,7 @@ public function shouldUnprotectBranch(): void $api->expects($this->once()) ->method('put') ->with('projects/1/repository/branches/master/unprotect') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->unprotectBranch(1, 'master')); @@ -154,7 +154,7 @@ public function shouldGetTags(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/tags') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->tags(1, ['search' => '^term'])); @@ -175,7 +175,7 @@ public function shouldCreateTag(): void 'ref' => 'abcd1234', 'message' => '1.0 release', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createTag(1, '1.0', 'abcd1234', '1.0 release')); @@ -200,7 +200,7 @@ public function shouldCreateRelease(): void 'tag_name' => $tagName, 'description' => $description, ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createRelease($project_id, $tagName, $description)); @@ -225,7 +225,7 @@ public function shouldUpdateRelease(): void 'tag_name' => $tagName, 'description' => $description, ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateRelease($project_id, $tagName, $description)); @@ -250,7 +250,7 @@ public function shouldGetReleases(): void $api->expects($this->once()) ->method('get') ->with('projects/1/releases') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->releases($project_id)); @@ -270,7 +270,7 @@ public function shouldGetCommits(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/commits', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->commits(1)); @@ -290,7 +290,7 @@ public function shouldGetCommitsWithParams(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/commits', ['page' => 2, 'per_page' => 25, 'ref_name' => 'master', 'all' => 'true', 'with_stats' => 'true', 'path' => 'file_path/file_name']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->commits(1, ['page' => 2, 'per_page' => 25, 'ref_name' => 'master', 'all' => true, 'with_stats' => true, 'path' => 'file_path/file_name'])); @@ -318,7 +318,7 @@ public function shouldGetCommitsWithTimeParams(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/commits', $expectedWithArray) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->commits(1, ['since' => $since, 'until' => $until])); @@ -335,7 +335,7 @@ public function shouldGetCommit(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/commits/abcd1234') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->commit(1, 'abcd1234')); @@ -355,7 +355,7 @@ public function shouldGetCommitRefs(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/commits/abcd1234/refs') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->commitRefs(1, 'abcd1234')); @@ -372,7 +372,7 @@ public function shouldGetCommitRefsWithParams(string $type, array $expectedArray $api->expects($this->once()) ->method('get') ->with('projects/1/repository/commits/abcd1234/refs', ['type' => $type]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->commitRefs(1, 'abcd1234', ['type' => $type])); @@ -403,7 +403,7 @@ public function shouldCreateCommit(): void $api->expects($this->once()) ->method('post') ->with('projects/1/repository/commits') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createCommit(1, [ @@ -437,7 +437,7 @@ public function shouldRevertCommit(): void $api->expects($this->once()) ->method('post') ->with('projects/1/repository/commits/abcd1234/revert') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->revertCommit(1, 'develop', 'abcd1234')); @@ -457,7 +457,7 @@ public function shouldGetCommitComments(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/commits/abcd1234/comments') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->commitComments(1, 'abcd1234')); @@ -474,7 +474,7 @@ public function shouldCreateCommitComment(): void $api->expects($this->once()) ->method('post') ->with('projects/1/repository/commits/abcd1234/comments', ['note' => 'A new comment']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createCommitComment(1, 'abcd1234', 'A new comment')); @@ -495,7 +495,7 @@ public function shouldCreateCommitCommentWithParams(): void 'path' => '/some/file.txt', 'line' => 123, 'line_type' => 'old', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createCommitComment(1, 'abcd1234', 'A new comment', [ @@ -516,7 +516,7 @@ public function shouldCompareStraight(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/compare', ['from' => 'master', 'to' => 'feature', 'straight' => 'true']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature', true)); @@ -533,7 +533,7 @@ public function shouldNotCompareStraight(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/compare', ['from' => 'master', 'to' => 'feature', 'straight' => 'false']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature')); @@ -550,7 +550,7 @@ public function shouldCompareComplexBranchName(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/compare', ['from' => 'master', 'to' => 'feature/760.fake-branch', 'straight' => 'true']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature/760.fake-branch', true)); @@ -567,7 +567,7 @@ public function shouldCompareWithFromProjectId(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/compare', ['from' => 'master', 'to' => 'feature', 'straight' => 'true', 'from_project_id' => '123']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature', true, '123')); @@ -587,7 +587,7 @@ public function shouldGetDiff(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/commits/abcd1234/diff') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->diff(1, 'abcd1234')); @@ -607,7 +607,7 @@ public function shouldGetTree(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/tree') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->tree(1)); @@ -627,7 +627,7 @@ public function shouldGetTreeWithParams(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/tree', ['path' => 'dir/', 'ref_name' => 'master']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->tree(1, ['path' => 'dir/', 'ref_name' => 'master'])); @@ -647,7 +647,7 @@ public function shouldGetContributors(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/contributors') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->contributors(1)); @@ -679,7 +679,7 @@ public function shouldGetMergeBase(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/merge_base', ['refs' => ['efgh5678efgh5678efgh5678efgh5678efgh5678', '1234567812345678123456781234567812345678']]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->mergeBase(1, ['efgh5678efgh5678efgh5678efgh5678efgh5678', '1234567812345678123456781234567812345678'])); @@ -712,7 +712,7 @@ public function shouldCherryPick(): void $api->expects($this->once()) ->method('post') ->with('projects/1/repository/commits/123456123456/cherry_pick', ['branch' => 'feature_branch']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->cherryPick(1, '123456123456', ['branch' => 'feature_branch'])); diff --git a/tests/Api/RepositoryFilesTest.php b/tests/Api/RepositoryFilesTest.php index 81600a59..d37ab572 100644 --- a/tests/Api/RepositoryFilesTest.php +++ b/tests/Api/RepositoryFilesTest.php @@ -29,7 +29,7 @@ public function shouldGetBlob(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/files/dir%2Ffile1.txt/raw', ['ref' => 'abcd1234']) - ->will($this->returnValue($expectedString)) + ->willReturn($expectedString); ; $this->assertEquals($expectedString, $api->getRawFile(1, 'dir/file1.txt', 'abcd1234')); @@ -46,7 +46,7 @@ public function shouldGetFile(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/files/dir%2Ffile1.txt', ['ref' => 'abcd1234']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->getFile(1, 'dir/file1.txt', 'abcd1234')); @@ -68,7 +68,7 @@ public function shouldCreateFile(): void 'content' => 'some contents', 'commit_message' => 'Added new file', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createFile(1, [ @@ -96,7 +96,7 @@ public function shouldCreateFileWithEncoding(): void 'content' => 'some contents', 'commit_message' => 'Added new file', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createFile(1, [ @@ -126,7 +126,7 @@ public function shouldCreateFileWithAuthor(): void 'author_email' => 'gitlab@example.com', 'author_name' => 'GitLab User', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createFile(1, [ @@ -155,7 +155,7 @@ public function shouldUpdateFile(): void 'content' => 'some new contents', 'commit_message' => 'Updated new file', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateFile(1, [ @@ -183,7 +183,7 @@ public function shouldUpdateFileWithEncoding(): void 'content' => 'c29tZSBuZXcgY29udGVudHM=', 'commit_message' => 'Updated file', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateFile(1, [ @@ -213,7 +213,7 @@ public function shouldUpdateFileWithAuthor(): void 'author_email' => 'gitlab@example.com', 'author_name' => 'GitLab User', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateFile(1, [ @@ -241,7 +241,7 @@ public function shouldDeleteFile(): void 'branch' => 'master', 'commit_message' => 'Deleted file', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->deleteFile(1, [ @@ -268,7 +268,7 @@ public function shouldDeleteFileWithAuthor(): void 'author_email' => 'gitlab@example.com', 'author_name' => 'GitLab User', ]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->deleteFile(1, [ diff --git a/tests/Api/ScheduleTest.php b/tests/Api/ScheduleTest.php index 329397c3..adcffd89 100644 --- a/tests/Api/ScheduleTest.php +++ b/tests/Api/ScheduleTest.php @@ -49,7 +49,7 @@ public function shouldCreateSchedule(): void 'created_at' => '2017-05-19T13:31:08.849Z', 'updated_at' => '2017-05-19T13:40:17.727Z', ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->create( 1, @@ -78,7 +78,7 @@ public function shouldShowSchedule(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipeline_schedules/2') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 2)); @@ -95,7 +95,7 @@ public function shouldShowAllSchedule(): void $api->expects($this->once()) ->method('get') ->with('projects/1/pipeline_schedules') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showAll(1)); @@ -112,7 +112,7 @@ public function shouldUpdateSchedule(): void $api->expects($this->once()) ->method('put') ->with('projects/1/pipeline_schedules/3', ['title' => 'Updated schedule', 'due_date' => '2015-04-01', 'state_event' => 'close']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated schedule', 'due_date' => '2015-04-01', 'state_event' => 'close'])); @@ -129,7 +129,7 @@ public function shouldRemoveSchedule(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/pipeline_schedules/2') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(1, 2)); @@ -150,7 +150,7 @@ public function shouldCreateScheduleVariable(): void $api->expects($this->once()) ->method('post') ->with('projects/1/pipeline_schedules/2/variables', $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addVariable( 1, @@ -175,7 +175,7 @@ public function shouldUpdateScheduleVariable(): void $api->expects($this->once()) ->method('put') ->with('projects/1/pipeline_schedules/2/variables/'.$variabelName, $expectedArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->updateVariable( 1, @@ -196,7 +196,7 @@ public function shouldRemoveScheduleVariable(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/pipeline_schedules/2/variables/FOO_BAR') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeVariable(1, 2, 'FOO_BAR')); @@ -213,7 +213,7 @@ public function shouldTakeOwnership(): void $api->expects($this->once()) ->method('post') ->with('projects/1/pipeline_schedules/2/take_ownership') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->takeOwnership(1, 2)); @@ -230,7 +230,7 @@ public function shouldPlay(): void $api->expects($this->once()) ->method('post') ->with('projects/1/pipeline_schedules/2/play') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->play(1, 2)); diff --git a/tests/Api/SearchTest.php b/tests/Api/SearchTest.php index e1e7c991..0eafc203 100644 --- a/tests/Api/SearchTest.php +++ b/tests/Api/SearchTest.php @@ -39,7 +39,7 @@ public function shouldGetAll(): void 'order_by' => 'created_at', 'sort' => 'desc', ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->all([ 'scope' => 'projects', diff --git a/tests/Api/SnippetsTest.php b/tests/Api/SnippetsTest.php index 16272201..6fe4a486 100644 --- a/tests/Api/SnippetsTest.php +++ b/tests/Api/SnippetsTest.php @@ -32,7 +32,7 @@ public function shouldGetAllSnippets(): void $api->expects($this->once()) ->method('get') ->with('projects/1/snippets') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(1)); @@ -49,7 +49,7 @@ public function shouldShowSnippet(): void $api->expects($this->once()) ->method('get') ->with('projects/1/snippets/2') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1, 2)); @@ -66,7 +66,7 @@ public function shouldCreateSnippet(): void $api->expects($this->once()) ->method('post') ->with('projects/1/snippets', ['title' => 'A new snippet', 'code' => 'A file', 'file_name' => 'file.txt', 'visibility' => 'public']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create(1, 'A new snippet', 'file.txt', 'A file', 'public')); @@ -83,7 +83,7 @@ public function shouldUpdateSnippet(): void $api->expects($this->once()) ->method('put') ->with('projects/1/snippets/3', ['title' => 'Updated snippet', 'code' => 'New content', 'file_name' => 'new_file.txt']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(1, 3, ['file_name' => 'new_file.txt', 'code' => 'New content', 'title' => 'Updated snippet'])); @@ -100,7 +100,7 @@ public function shouldShowContent(): void $api->expects($this->once()) ->method('get') ->with('projects/1/snippets/3/raw') - ->will($this->returnValue($expectedString)) + ->willReturn($expectedString); ; $this->assertEquals($expectedString, $api->content(1, 3)); @@ -117,7 +117,7 @@ public function shouldRemoveSnippet(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/snippets/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(1, 3)); @@ -137,7 +137,7 @@ public function shouldGetNotes(): void $api->expects($this->once()) ->method('get') ->with('projects/1/snippets/2/notes') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showNotes(1, 2)); @@ -154,7 +154,7 @@ public function shouldGetNote(): void $api->expects($this->once()) ->method('get') ->with('projects/1/snippets/2/notes/3') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showNote(1, 2, 3)); @@ -171,7 +171,7 @@ public function shouldCreateNote(): void $api->expects($this->once()) ->method('post') ->with('projects/1/snippets/2/notes', ['body' => 'A new note']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->addNote(1, 2, 'A new note')); @@ -188,7 +188,7 @@ public function shouldUpdateNote(): void $api->expects($this->once()) ->method('put') ->with('projects/1/snippets/2/notes/3', ['body' => 'An edited comment']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->updateNote(1, 2, 3, 'An edited comment')); @@ -205,7 +205,7 @@ public function shouldRemoveNote(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/snippets/2/notes/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); @@ -225,7 +225,7 @@ public function shouldIssueSnippetAwardEmoji(): void $api->expects($this->once()) ->method('get') ->with('projects/1/snippets/2/award_emoji') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->awardEmoji(1, 2)); @@ -242,7 +242,7 @@ public function shouldRevokeSnippetAwardEmoji(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/snippets/2/award_emoji/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); diff --git a/tests/Api/SystemHooksTest.php b/tests/Api/SystemHooksTest.php index 80834195..41efc4bd 100644 --- a/tests/Api/SystemHooksTest.php +++ b/tests/Api/SystemHooksTest.php @@ -32,7 +32,7 @@ public function shouldGetAllHooks(): void $api->expects($this->once()) ->method('get') ->with('hooks') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all()); @@ -49,7 +49,7 @@ public function shouldCreateHook(): void $api->expects($this->once()) ->method('post') ->with('hooks', ['url' => 'http://www.example.net/']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create('http://www.example.net/')); @@ -66,7 +66,7 @@ public function shouldTestHook(): void $api->expects($this->once()) ->method('get') ->with('hooks/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->test(3)); @@ -83,7 +83,7 @@ public function shouldRemoveHook(): void $api->expects($this->once()) ->method('delete') ->with('hooks/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(3)); diff --git a/tests/Api/TagsTest.php b/tests/Api/TagsTest.php index d5165413..0dff92cc 100644 --- a/tests/Api/TagsTest.php +++ b/tests/Api/TagsTest.php @@ -32,7 +32,7 @@ public function shouldGetAllTags(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/tags') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->all(1)); } @@ -49,7 +49,7 @@ public function shouldShowTag(): void $api->expects($this->once()) ->method('get') ->with('projects/1/repository/tags/v1.0.0') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->show(1, 'v1.0.0')); } @@ -72,7 +72,7 @@ public function shouldCreateTag(): void $api->expects($this->once()) ->method('post') ->with('projects/1/repository/tags', $params) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->create(1, $params)); } @@ -90,7 +90,7 @@ public function shouldRemoveTag(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/repository/tags/v1.1.0') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->remove(1, 'v1.1.0')); } @@ -109,7 +109,7 @@ public function shouldCreateRelease(string $releaseName, string $description, ar $api->expects($this->once()) ->method('post') ->with('projects/1/repository/tags/'.\str_replace('/', '%2F', $releaseName).'/release', $params) - ->will($this->returnValue($expectedResult)); + ->willReturn($expectedResult); $this->assertEquals($expectedResult, $api->createRelease(1, $releaseName, $params)); } @@ -129,7 +129,7 @@ public function shouldUpdateRelease(string $releaseName, string $description, ar $api->expects($this->once()) ->method('put') ->with('projects/1/repository/tags/'.\str_replace('/', '%2F', $releaseName).'/release', $params) - ->will($this->returnValue($expectedResult)); + ->willReturn($expectedResult); $this->assertEquals($expectedResult, $api->updateRelease(1, $releaseName, $params)); } diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index 26921a50..fcbb4096 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -32,7 +32,7 @@ public function shouldGetAllUsers(): void $api->expects($this->once()) ->method('get') ->with('users', []) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all()); @@ -52,7 +52,7 @@ public function shouldGetActiveUsers(): void $api->expects($this->once()) ->method('get') ->with('users', ['active' => true]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->all(['active' => true])); @@ -80,7 +80,7 @@ public function shouldGetUsersWithDateTimeParams(): void $api->expects($this->once()) ->method('get') ->with('users', $expectedWithArray) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals( @@ -100,7 +100,7 @@ public function shouldShowUser(): void $api->expects($this->once()) ->method('get') ->with('users/1') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->show(1)); @@ -130,7 +130,7 @@ protected function getUsersMembershipsRequestMock($path, $expectedArray = [], $e $api->expects($this->once()) ->method('get') ->with($path, $expectedParameters) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; return $api; @@ -186,7 +186,7 @@ protected function getUsersProjectsRequestMock($path, $expectedArray = [], $expe $api->expects($this->once()) ->method('get') ->with($path, $expectedParameters) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; return $api; @@ -398,7 +398,7 @@ public function shouldCreateUser(): void $api->expects($this->once()) ->method('post') ->with('users', ['email' => 'billy@example.com', 'password' => 'password']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create('billy@example.com', 'password')); @@ -415,7 +415,7 @@ public function shouldCreateUserWithAdditionalInfo(): void $api->expects($this->once()) ->method('post') ->with('users', ['email' => 'billy@example.com', 'password' => 'password', 'name' => 'Billy', 'bio' => 'A person']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->create('billy@example.com', 'password', ['name' => 'Billy', 'bio' => 'A person'])); @@ -432,7 +432,7 @@ public function shouldUpdateUser(): void $api->expects($this->once()) ->method('put') ->with('users/3', ['name' => 'Billy Bob']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(3, ['name' => 'Billy Bob'])); @@ -443,7 +443,7 @@ public function shouldUpdateUser(): void $api->expects($this->once()) ->method('put') ->with('users/4', [], [], ['avatar' => '/some/image.jpg']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(4, [], ['avatar' => '/some/image.jpg'])); @@ -460,7 +460,7 @@ public function shouldRemoveUser(): void $api->expects($this->once()) ->method('delete') ->with('users/1') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(1)); @@ -477,7 +477,7 @@ public function shouldBlockUser(): void $api->expects($this->once()) ->method('post') ->with('users/1/block') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->block(1)); @@ -494,7 +494,7 @@ public function shouldUnblockUser(): void $api->expects($this->once()) ->method('post') ->with('users/1/unblock') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->unblock(1)); @@ -511,7 +511,7 @@ public function shouldActivateUser(): void $api->expects($this->once()) ->method('post') ->with('users/1/activate') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->activate(1)); @@ -528,7 +528,7 @@ public function shouldDeactivateUser(): void $api->expects($this->once()) ->method('post') ->with('users/1/deactivate') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->deactivate(1)); @@ -545,7 +545,7 @@ public function shouldShowCurrentUser(): void $api->expects($this->once()) ->method('get') ->with('user') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->me()); @@ -565,7 +565,7 @@ public function shouldGetCurrentUserKeys(): void $api->expects($this->once()) ->method('get') ->with('user/keys') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->keys(1)); @@ -582,7 +582,7 @@ public function shouldGetCurrentUserKey(): void $api->expects($this->once()) ->method('get') ->with('user/keys/1') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->key(1)); @@ -599,7 +599,7 @@ public function shouldCreateKeyForCurrentUser(): void $api->expects($this->once()) ->method('post') ->with('user/keys', ['title' => 'A new key', 'key' => '...']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createKey('A new key', '...')); @@ -616,7 +616,7 @@ public function shouldDeleteKeyForCurrentUser(): void $api->expects($this->once()) ->method('delete') ->with('user/keys/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeKey(3)); @@ -636,7 +636,7 @@ public function shouldGetUserKeys(): void $api->expects($this->once()) ->method('get') ->with('users/1/keys') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->userKeys(1)); @@ -653,7 +653,7 @@ public function shouldGetUserKey(): void $api->expects($this->once()) ->method('get') ->with('users/1/keys/2') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->userKey(1, 2)); @@ -670,7 +670,7 @@ public function shouldCreateKeyForUser(): void $api->expects($this->once()) ->method('post') ->with('users/1/keys', ['title' => 'A new key', 'key' => '...']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createKeyForUser(1, 'A new key', '...')); @@ -687,7 +687,7 @@ public function shouldDeleteKeyForUser(): void $api->expects($this->once()) ->method('delete') ->with('users/1/keys/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeUserKey(1, 3)); @@ -707,7 +707,7 @@ public function shouldGetUserEmails(): void $api->expects($this->once()) ->method('get') ->with('user/emails') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->emails()); } @@ -723,7 +723,7 @@ public function shouldGetSpecificUserEmail(): void $api->expects($this->once()) ->method('get') ->with('user/emails/1') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->email(1)); } @@ -742,7 +742,7 @@ public function shouldGetEmailsForUser(): void $api->expects($this->once()) ->method('get') ->with('users/1/emails') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->userEmails(1)); @@ -759,7 +759,7 @@ public function shouldCreateEmailForUser(): void $api->expects($this->once()) ->method('post') ->with('users/1/emails', ['email' => 'foo@bar.example', 'skip_confirmation' => false]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createEmailForUser(1, 'foo@bar.example')); @@ -776,7 +776,7 @@ public function shouldCreateConfirmedEmailForUser(): void $api->expects($this->once()) ->method('post') ->with('users/1/emails', ['email' => 'foo@baz.example', 'skip_confirmation' => true]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createEmailForUser(1, 'foo@baz.example', true)); @@ -793,7 +793,7 @@ public function shouldDeleteEmailForUser(): void $api->expects($this->once()) ->method('delete') ->with('users/1/emails/3') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeUserEmail(1, 3)); @@ -813,7 +813,7 @@ public function shouldGetCurrentUserImpersonationTokens(): void $api->expects($this->once()) ->method('get') ->with('users/1/impersonation_tokens') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->userImpersonationTokens(1)); @@ -830,7 +830,7 @@ public function shouldGetUserImpersonationToken(): void $api->expects($this->once()) ->method('get') ->with('users/1/impersonation_tokens/1') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->userImpersonationToken(1, 1)); @@ -847,7 +847,7 @@ public function shouldCreateImpersonationTokenForUser(): void $api->expects($this->once()) ->method('post') ->with('users/1/impersonation_tokens', ['name' => 'name', 'scopes' => ['api'], 'expires_at' => null]) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->createImpersonationToken(1, 'name', ['api'])); @@ -864,7 +864,7 @@ public function shouldDeleteImpersonationTokenForUser(): void $api->expects($this->once()) ->method('delete') ->with('users/1/impersonation_tokens/1') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->removeImpersonationToken(1, 1)); @@ -883,7 +883,7 @@ public function shouldGetCurrentUserActiveImpersonationTokens(): void $api->expects($this->once()) ->method('get') ->with('users/1/impersonation_tokens') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->userImpersonationTokens(1, ['state' => 'active'])); @@ -902,7 +902,7 @@ public function shouldGetCurrentUserInactiveImpersonationTokens(): void $api->expects($this->once()) ->method('get') ->with('users/1/impersonation_tokens') - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->userImpersonationTokens(1, ['state' => 'inactive'])); @@ -927,7 +927,7 @@ public function shouldGetEvents(): void $api->expects($this->once()) ->method('get') ->with('users/1/events', []) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->events(1)); } @@ -954,7 +954,7 @@ public function shouldGetEventsWithDateTimeParams(): void $api->expects($this->once()) ->method('get') ->with('users/1/events', $expectedWithArray) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->events(1, ['after' => $after, 'before' => $before])); } @@ -976,7 +976,7 @@ public function shouldGetEventsWithPagination(): void 'page' => 2, 'per_page' => 15, ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->events(1, ['page' => 2, 'per_page' => 15])); } @@ -994,7 +994,7 @@ public function getRemoveUserIdentity(): void $api->expects($this->once()) ->method('delete') ->with('users/1/identities/test') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->removeUserIdentity(1, 'test')); } diff --git a/tests/Api/VersionTest.php b/tests/Api/VersionTest.php index 66aa4870..4a3a7ad5 100644 --- a/tests/Api/VersionTest.php +++ b/tests/Api/VersionTest.php @@ -32,7 +32,7 @@ public function shouldShowVersion(): void $api->expects($this->once()) ->method('get') ->with('version') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->show()); } diff --git a/tests/Api/WikiTest.php b/tests/Api/WikiTest.php index 642a7e59..7a941789 100644 --- a/tests/Api/WikiTest.php +++ b/tests/Api/WikiTest.php @@ -38,7 +38,7 @@ public function shouldCreateWiki(): void 'title' => 'Test Wiki', 'content' => 'This is the test Wiki', ]) - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->create( 1, @@ -65,7 +65,7 @@ public function shouldShowWiki(): void $api->expects($this->once()) ->method('get') ->with('projects/1/wikis/Test-Wiki') - ->will($this->returnValue($expectedArray)); + ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->show(1, 'Test-Wiki')); } @@ -87,7 +87,7 @@ public function shouldShowAllWiki(): void $api->expects($this->once()) ->method('get') ->with('projects/1/wikis', $params) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->showAll(1, $params)); @@ -109,7 +109,7 @@ public function shouldUpdateWiki(): void $api->expects($this->once()) ->method('put') ->with('projects/1/wikis/Test-Wiki', ['content' => 'This is the test Wiki that has been updated']) - ->will($this->returnValue($expectedArray)) + ->willReturn($expectedArray) ; $this->assertEquals($expectedArray, $api->update(1, 'Test-Wiki', ['content' => 'This is the test Wiki that has been updated'])); @@ -126,7 +126,7 @@ public function shouldRemoveWiki(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/wikis/Test-Wiki') - ->will($this->returnValue($expectedBool)) + ->willReturn($expectedBool); ; $this->assertEquals($expectedBool, $api->remove(1, 'Test-Wiki')); From 723301db98a18bce3d9e264829888d642fc55f4b Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 17:26:53 +0000 Subject: [PATCH 102/117] Get ready for next release --- CHANGELOG.md | 2 ++ LICENSE | 2 +- README.md | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0084aebb..cc32cd98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [12.0.0] - UPCOMING +* Add PHP 8.4 support * Drop support for PHP earlier than 8.1 +* Moved various param types to native PHP types ## [11.14.0] - 2024-03-11 diff --git a/LICENSE b/LICENSE index 2d9ff471..9cebae09 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ MIT License Copyright (c) 2012-2018 Matt Humphrey -Copyright (c) 2018-2024 Graham Campbell +Copyright (c) 2018-2025 Graham Campbell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index d70e1991..35065ecd 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Check out the [change log](CHANGELOG.md), [releases](https://github.com/GitLabPH ## Installation -This version supports [PHP](https://php.net) 7.4-8.3. To get started, simply require the project using [Composer](https://getcomposer.org). You will also need to install packages that "provide" [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) and [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation). +This version supports [PHP](https://php.net) 8.1-8.4. To get started, simply require the project using [Composer](https://getcomposer.org). You will also need to install packages that "provide" [`psr/http-client-implementation`](https://packagist.org/providers/psr/http-client-implementation) and [`psr/http-factory-implementation`](https://packagist.org/providers/psr/http-factory-implementation). ### Standard Installation From 87fa5f577ff3d79b59908d23b3c5d21f11c6d89e Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 23 Feb 2025 17:27:10 +0000 Subject: [PATCH 103/117] Apply fixes from StyleCI --- tests/Api/EnvironmentsTest.php | 4 +-- tests/Api/GroupBoardsTest.php | 2 -- tests/Api/GroupsEpicsTest.php | 1 - tests/Api/GroupsMilestonesTest.php | 1 - tests/Api/GroupsTest.php | 11 +++----- tests/Api/IssueBoardsTest.php | 2 -- tests/Api/IssueSubscribeTest.php | 4 +-- tests/Api/IssuesTest.php | 3 --- tests/Api/JobsTest.php | 6 +---- tests/Api/MergeRequestsTest.php | 5 +--- tests/Api/MilestonesTest.php | 1 - tests/Api/PackagesTest.php | 4 +-- tests/Api/ProjectsTest.php | 42 +++++++++++++++--------------- tests/Api/RepositoriesTest.php | 1 - tests/Api/RepositoryFilesTest.php | 1 - tests/Api/ScheduleTest.php | 4 --- tests/Api/SnippetsTest.php | 4 --- tests/Api/SystemHooksTest.php | 2 -- tests/Api/UsersTest.php | 9 ------- tests/Api/WikiTest.php | 1 - 20 files changed, 32 insertions(+), 76 deletions(-) diff --git a/tests/Api/EnvironmentsTest.php b/tests/Api/EnvironmentsTest.php index d4724a5e..badec596 100644 --- a/tests/Api/EnvironmentsTest.php +++ b/tests/Api/EnvironmentsTest.php @@ -185,7 +185,7 @@ public function shouldRemoveEnvironment(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/environments/3') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->remove(1, 3)); } @@ -200,7 +200,7 @@ public function shouldStopEnvironment(): void $api->expects($this->once()) ->method('post') ->with('projects/1/environments/3/stop') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->stop(1, 3)); } diff --git a/tests/Api/GroupBoardsTest.php b/tests/Api/GroupBoardsTest.php index ee4c2834..b87ac456 100644 --- a/tests/Api/GroupBoardsTest.php +++ b/tests/Api/GroupBoardsTest.php @@ -101,7 +101,6 @@ public function shouldRemoveIssueBoard(): void ->method('delete') ->with('groups/1/boards/2') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(1, 2)); } @@ -234,7 +233,6 @@ public function shouldDeleteList(): void ->method('delete') ->with('groups/1/boards/2/lists/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->deleteList(1, 2, 3)); } diff --git a/tests/Api/GroupsEpicsTest.php b/tests/Api/GroupsEpicsTest.php index 3909e510..37a7afd8 100644 --- a/tests/Api/GroupsEpicsTest.php +++ b/tests/Api/GroupsEpicsTest.php @@ -101,7 +101,6 @@ public function shouldRemoveEpic(): void ->method('delete') ->with('groups/1/epics/2') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(1, 2)); } diff --git a/tests/Api/GroupsMilestonesTest.php b/tests/Api/GroupsMilestonesTest.php index 0f5e6a4b..94c28d71 100644 --- a/tests/Api/GroupsMilestonesTest.php +++ b/tests/Api/GroupsMilestonesTest.php @@ -201,7 +201,6 @@ public function shouldRemoveMilestone(): void ->method('delete') ->with('groups/1/milestones/2') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(1, 2)); } diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index 7f4b57c7..535717d2 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -216,7 +216,6 @@ public function shouldTransferProjectToGroup(): void ->method('post') ->with('groups/1/projects/2') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->transfer(1, 2)); } @@ -326,7 +325,6 @@ public function shouldRemoveMember(): void ->method('delete') ->with('groups/1/members/2') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeMember(1, 2)); } @@ -343,7 +341,6 @@ public function shouldRemoveGroup(): void ->method('delete') ->with('groups/1') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(1)); } @@ -455,7 +452,6 @@ public function shouldRemoveLabel(): void ->method('delete') ->with('groups/1/labels/456', []) ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeLabel(1, 456)); } @@ -591,7 +587,6 @@ public function shouldRemoveVariable(): void ->method('delete') ->with('groups/1/variables/ftp_password') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeVariable(1, 'ftp_password')); } @@ -846,7 +841,7 @@ public function shouldGetActiveDeployTokens(): void $api->expects($this->once()) ->method('get') ->with('groups/1/deploy_tokens', ['active' => true]) - ->willReturn([]);; + ->willReturn([]); $this->assertEquals([], $api->deployTokens(1, true)); } @@ -875,7 +870,7 @@ public function shouldGetInactiveDeployTokens(): void $api->expects($this->once()) ->method('get') ->with('groups/1/deploy_tokens', ['active' => false]) - ->willReturn([]);; + ->willReturn([]); $this->assertEquals([], $api->deployTokens(1, false)); } @@ -936,7 +931,7 @@ public function shouldDeleteDeployToken(): void $api->expects($this->once()) ->method('delete') ->with('groups/1/deploy_tokens/2') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); } diff --git a/tests/Api/IssueBoardsTest.php b/tests/Api/IssueBoardsTest.php index 2cbf7249..d4a9a7fe 100644 --- a/tests/Api/IssueBoardsTest.php +++ b/tests/Api/IssueBoardsTest.php @@ -101,7 +101,6 @@ public function shouldRemoveIssueBoard(): void ->method('delete') ->with('projects/1/boards/2') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(1, 2)); } @@ -234,7 +233,6 @@ public function shouldDeleteList(): void ->method('delete') ->with('projects/1/boards/2/lists/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->deleteList(1, 2, 3)); } diff --git a/tests/Api/IssueSubscribeTest.php b/tests/Api/IssueSubscribeTest.php index a9f36af8..dea23ec0 100644 --- a/tests/Api/IssueSubscribeTest.php +++ b/tests/Api/IssueSubscribeTest.php @@ -28,7 +28,7 @@ public function testSubscribeIssue(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/subscribe') - ->willReturn($expectedValue);; + ->willReturn($expectedValue); $this->assertEquals($expectedValue, $api->subscribe(1, 2)); } @@ -40,7 +40,7 @@ public function testUnsubscribeIssue(): void $api->expects($this->once()) ->method('post') ->with('projects/1/issues/2/unsubscribe') - ->willReturn($expectedValue);; + ->willReturn($expectedValue); $this->assertEquals($expectedValue, $api->unsubscribe(1, 2)); } diff --git a/tests/Api/IssuesTest.php b/tests/Api/IssuesTest.php index 7110000c..8457dbd1 100644 --- a/tests/Api/IssuesTest.php +++ b/tests/Api/IssuesTest.php @@ -304,7 +304,6 @@ public function shouldRemoveNote(): void ->method('delete') ->with('projects/1/issues/2/notes/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); } @@ -409,7 +408,6 @@ public function shouldRemoveDiscussionNote(): void ->method('delete') ->with('projects/1/issues/2/discussions/abc/notes/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeDiscussionNote(1, 2, 'abc', 3)); } @@ -531,7 +529,6 @@ public function shouldRevokeAwardEmoji(): void ->method('delete') ->with('projects/1/issues/2/award_emoji/3') ->willReturn($expectedBool); - ; $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); } diff --git a/tests/Api/JobsTest.php b/tests/Api/JobsTest.php index d8ff3f57..b8618f83 100644 --- a/tests/Api/JobsTest.php +++ b/tests/Api/JobsTest.php @@ -138,7 +138,6 @@ public function shouldGetArtifacts(): void ->method('getAsResponse') ->with('projects/1/jobs/3/artifacts') ->willReturn($returnedStream); - ; $this->assertEquals('foobar', $api->artifacts(1, 3)->getContents()); } @@ -155,7 +154,6 @@ public function shouldGetArtifactsByJobId(): void ->method('getAsResponse') ->with('projects/1/jobs/3/artifacts/artifact_path') ->willReturn($returnedStream); - ; $this->assertEquals('foobar', $api->artifactByJobId(1, 3, 'artifact_path')->getContents()); } @@ -174,7 +172,6 @@ public function shouldGetArtifactsByRefName(): void 'job' => 'job name', ]) ->willReturn($returnedStream); - ; $this->assertEquals('foobar', $api->artifactsByRefName(1, 'master', 'job name')->getContents()); } @@ -192,7 +189,7 @@ public function shouldGetArtifactByRefName(): void 'job' => 'job name', ]) ->willReturn($returnedStream); - ; + $this->assertEquals('foobar', $api->artifactByRefName(1, 'master', 'job name', 'artifact_path')->getContents()); } @@ -208,7 +205,6 @@ public function shouldGetTrace(): void ->method('get') ->with('projects/1/jobs/3/trace') ->willReturn($expectedString); - ; $this->assertEquals($expectedString, $api->trace(1, 3)); } diff --git a/tests/Api/MergeRequestsTest.php b/tests/Api/MergeRequestsTest.php index e310c470..44a376e0 100644 --- a/tests/Api/MergeRequestsTest.php +++ b/tests/Api/MergeRequestsTest.php @@ -345,7 +345,6 @@ public function shouldRemoveNote(): void ->method('delete') ->with('projects/1/merge_requests/2/notes/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); } @@ -535,7 +534,6 @@ public function shouldRemoveDiscussionNote(): void ->method('delete') ->with('projects/1/merge_requests/2/discussions/abc/notes/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeDiscussionNote(1, 2, 'abc', 3)); } @@ -657,7 +655,6 @@ public function shouldRevokeMergeRequestAwardEmoji(): void ->method('delete') ->with('projects/1/merge_requests/2/award_emoji/3') ->willReturn($expectedBool); - ; $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); } @@ -868,7 +865,7 @@ public function shoudDeleteLevelRule(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/merge_requests/2/approval_rules/3') - ->willReturn($expectedValue);; + ->willReturn($expectedValue); $this->assertEquals($expectedValue, $api->deleteLevelRule(1, 2, 3)); } diff --git a/tests/Api/MilestonesTest.php b/tests/Api/MilestonesTest.php index 2a440da7..bb36c981 100644 --- a/tests/Api/MilestonesTest.php +++ b/tests/Api/MilestonesTest.php @@ -101,7 +101,6 @@ public function shouldRemoveMilestone(): void ->method('delete') ->with('projects/1/milestones/2') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(1, 2)); } diff --git a/tests/Api/PackagesTest.php b/tests/Api/PackagesTest.php index 823504cc..a269aae6 100644 --- a/tests/Api/PackagesTest.php +++ b/tests/Api/PackagesTest.php @@ -97,7 +97,7 @@ public function shouldRemovePackage(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/packages/1') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->remove(1, 1)); } @@ -113,7 +113,7 @@ public function shouldRemovePackageFile(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/packages/1/package_files/25') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->removeFile(1, 1, 25)); } diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 9a606c9b..f4dcb808 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -390,7 +390,7 @@ public function shouldRemoveProject(): void $api->expects($this->once()) ->method('delete') ->with('projects/1') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->remove(1)); } @@ -737,7 +737,7 @@ public function shouldRemoveTrigger(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/triggers/2') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->removeTrigger(1, 2)); } @@ -1038,7 +1038,7 @@ public function shouldDeletePipeline(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/pipelines/3') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->deletePipeline(1, 3)); } @@ -1259,7 +1259,7 @@ public function shouldRemoveMember(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/members/2') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->removeMember(1, 2)); } @@ -1386,7 +1386,7 @@ public function shouldRemoveHook(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/hooks/2') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->removeHook(1, 2)); } @@ -1489,7 +1489,7 @@ public function shouldDeleteDeployKey(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/deploy_keys/3') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->deleteDeployKey(1, 3)); } @@ -1505,7 +1505,7 @@ public function shoudEnableDeployKey(): void $api->expects($this->once()) ->method('post') ->with('projects/1/deploy_keys/3/enable') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->enableDeployKey(1, 3)); } @@ -1563,7 +1563,7 @@ public function shouldGetActiveDeployTokens(): void $api->expects($this->once()) ->method('get') ->with('projects/1/deploy_tokens', ['active' => true]) - ->willReturn([]);; + ->willReturn([]); $this->assertEquals([], $api->deployTokens(1, true)); } @@ -1592,7 +1592,7 @@ public function shouldGetInactiveDeployTokens(): void $api->expects($this->once()) ->method('get') ->with('projects/1/deploy_tokens', ['active' => false]) - ->willReturn([]);; + ->willReturn([]); $this->assertEquals([], $api->deployTokens(1, false)); } @@ -1653,7 +1653,7 @@ public function shouldDeleteDeployToken(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/deploy_tokens/2') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); } @@ -1791,7 +1791,7 @@ public function shouldRemoveLabel(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/labels/456', []) - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->removeLabel(1, 456)); } @@ -1903,7 +1903,7 @@ public function shouldRemoveForkRelation(): void $api->expects($this->once()) ->method('delete') ->with('projects/2/fork') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->removeForkRelation(2)); } @@ -2012,7 +2012,7 @@ public function shouldSetService(): void $api->expects($this->once()) ->method('put') ->with('projects/1/services/hipchat', ['param' => 'value']) - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->setService(1, 'hipchat', ['param' => 'value'])); } @@ -2028,7 +2028,7 @@ public function shouldRemoveService(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/services/hipchat') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->removeService(1, 'hipchat')); } @@ -2363,7 +2363,7 @@ public function shouldRemoveVariable(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/variables/ftp_password') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->removeVariable(1, 'ftp_password')); } @@ -2617,7 +2617,7 @@ public function shouldRemoveBadge(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/badges/1') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->removeBadge(1, 1)); } @@ -2661,7 +2661,7 @@ public function shouldRemoveProtectedBranch(): void ->with( 'projects/1/protected_branches/test-branch' ) - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->deleteProtectedBranch(1, 'test-branch')); } @@ -2777,7 +2777,7 @@ public function shoudDeleteApprovalsRule(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/approval_rules/1') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->deleteApprovalsRule(1, 1)); } @@ -2793,7 +2793,7 @@ public function shouldDeleteAllMergedBranches(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/repository/merged_branches') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->deleteAllMergedBranches(1)); } @@ -2947,7 +2947,7 @@ public function shouldDeleteProjectAccessToken(): void $api->expects($this->once()) ->method('delete') ->with('projects/1/access_tokens/2') - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->deleteProjectAccessToken(1, 2)); } @@ -3008,7 +3008,7 @@ public function shouldRemoveProtectedTag(): void ->with( 'projects/1/protected_tags/release-%2A' ) - ->willReturn($expectedBool);; + ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->deleteProtectedTag(1, 'release-*')); } diff --git a/tests/Api/RepositoriesTest.php b/tests/Api/RepositoriesTest.php index 66453b22..0b59ae8d 100644 --- a/tests/Api/RepositoriesTest.php +++ b/tests/Api/RepositoriesTest.php @@ -84,7 +84,6 @@ public function shouldDeleteBranch(): void ->method('delete') ->with('projects/1/repository/branches/feature%2FTEST-15') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->deleteBranch(1, 'feature/TEST-15')); } diff --git a/tests/Api/RepositoryFilesTest.php b/tests/Api/RepositoryFilesTest.php index d37ab572..babbb33b 100644 --- a/tests/Api/RepositoryFilesTest.php +++ b/tests/Api/RepositoryFilesTest.php @@ -30,7 +30,6 @@ public function shouldGetBlob(): void ->method('get') ->with('projects/1/repository/files/dir%2Ffile1.txt/raw', ['ref' => 'abcd1234']) ->willReturn($expectedString); - ; $this->assertEquals($expectedString, $api->getRawFile(1, 'dir/file1.txt', 'abcd1234')); } diff --git a/tests/Api/ScheduleTest.php b/tests/Api/ScheduleTest.php index adcffd89..8fe636d4 100644 --- a/tests/Api/ScheduleTest.php +++ b/tests/Api/ScheduleTest.php @@ -130,7 +130,6 @@ public function shouldRemoveSchedule(): void ->method('delete') ->with('projects/1/pipeline_schedules/2') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(1, 2)); } @@ -197,7 +196,6 @@ public function shouldRemoveScheduleVariable(): void ->method('delete') ->with('projects/1/pipeline_schedules/2/variables/FOO_BAR') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeVariable(1, 2, 'FOO_BAR')); } @@ -214,7 +212,6 @@ public function shouldTakeOwnership(): void ->method('post') ->with('projects/1/pipeline_schedules/2/take_ownership') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->takeOwnership(1, 2)); } @@ -231,7 +228,6 @@ public function shouldPlay(): void ->method('post') ->with('projects/1/pipeline_schedules/2/play') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->play(1, 2)); } diff --git a/tests/Api/SnippetsTest.php b/tests/Api/SnippetsTest.php index 6fe4a486..e366e5ec 100644 --- a/tests/Api/SnippetsTest.php +++ b/tests/Api/SnippetsTest.php @@ -101,7 +101,6 @@ public function shouldShowContent(): void ->method('get') ->with('projects/1/snippets/3/raw') ->willReturn($expectedString); - ; $this->assertEquals($expectedString, $api->content(1, 3)); } @@ -118,7 +117,6 @@ public function shouldRemoveSnippet(): void ->method('delete') ->with('projects/1/snippets/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(1, 3)); } @@ -206,7 +204,6 @@ public function shouldRemoveNote(): void ->method('delete') ->with('projects/1/snippets/2/notes/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); } @@ -243,7 +240,6 @@ public function shouldRevokeSnippetAwardEmoji(): void ->method('delete') ->with('projects/1/snippets/2/award_emoji/3') ->willReturn($expectedBool); - ; $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); } diff --git a/tests/Api/SystemHooksTest.php b/tests/Api/SystemHooksTest.php index 41efc4bd..a9037261 100644 --- a/tests/Api/SystemHooksTest.php +++ b/tests/Api/SystemHooksTest.php @@ -67,7 +67,6 @@ public function shouldTestHook(): void ->method('get') ->with('hooks/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->test(3)); } @@ -84,7 +83,6 @@ public function shouldRemoveHook(): void ->method('delete') ->with('hooks/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(3)); } diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index fcbb4096..e1ce8bb8 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -461,7 +461,6 @@ public function shouldRemoveUser(): void ->method('delete') ->with('users/1') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(1)); } @@ -478,7 +477,6 @@ public function shouldBlockUser(): void ->method('post') ->with('users/1/block') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->block(1)); } @@ -495,7 +493,6 @@ public function shouldUnblockUser(): void ->method('post') ->with('users/1/unblock') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->unblock(1)); } @@ -512,7 +509,6 @@ public function shouldActivateUser(): void ->method('post') ->with('users/1/activate') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->activate(1)); } @@ -529,7 +525,6 @@ public function shouldDeactivateUser(): void ->method('post') ->with('users/1/deactivate') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->deactivate(1)); } @@ -617,7 +612,6 @@ public function shouldDeleteKeyForCurrentUser(): void ->method('delete') ->with('user/keys/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeKey(3)); } @@ -688,7 +682,6 @@ public function shouldDeleteKeyForUser(): void ->method('delete') ->with('users/1/keys/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeUserKey(1, 3)); } @@ -794,7 +787,6 @@ public function shouldDeleteEmailForUser(): void ->method('delete') ->with('users/1/emails/3') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeUserEmail(1, 3)); } @@ -865,7 +857,6 @@ public function shouldDeleteImpersonationTokenForUser(): void ->method('delete') ->with('users/1/impersonation_tokens/1') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->removeImpersonationToken(1, 1)); } diff --git a/tests/Api/WikiTest.php b/tests/Api/WikiTest.php index 7a941789..b9b46da5 100644 --- a/tests/Api/WikiTest.php +++ b/tests/Api/WikiTest.php @@ -127,7 +127,6 @@ public function shouldRemoveWiki(): void ->method('delete') ->with('projects/1/wikis/Test-Wiki') ->willReturn($expectedBool); - ; $this->assertEquals($expectedBool, $api->remove(1, 'Test-Wiki')); } From 15afa14dca34a7718d9a91ec218bc618152de440 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 17:34:59 +0000 Subject: [PATCH 104/117] WIP --- tests/Api/DeployKeysTest.php | 5 +- tests/Api/DeploymentsTest.php | 30 +- tests/Api/EnvironmentsTest.php | 25 +- tests/Api/EventsTest.php | 11 +- tests/Api/GroupBoardsTest.php | 50 +- tests/Api/GroupsEpicsTest.php | 30 +- tests/Api/GroupsMilestonesTest.php | 70 +- tests/Api/GroupsTest.php | 216 ++---- tests/Api/IssueBoardsTest.php | 50 +- tests/Api/IssueLinksTest.php | 16 +- tests/Api/IssueSubscribeTest.php | 1 + tests/Api/IssuesStatisticsTest.php | 15 +- tests/Api/IssuesTest.php | 175 +---- tests/Api/JobsTest.php | 76 +- tests/Api/KeysTest.php | 5 +- tests/Api/MergeRequestsTest.php | 200 ++--- tests/Api/MilestonesTest.php | 35 +- tests/Api/PackagesTest.php | 25 +- tests/Api/ProjectNamespacesTest.php | 10 +- tests/Api/ProjectsTest.php | 686 ++++-------------- tests/Api/RepositoriesTest.php | 170 +---- tests/Api/RepositoryFilesTest.php | 50 +- tests/Api/ResourceIterationEventsTest.php | 10 +- tests/Api/ResourceLabelEventsTest.php | 10 +- tests/Api/ResourceMilestoneEventsTest.php | 10 +- tests/Api/ResourceStateEventsTest.php | 10 +- tests/Api/ResourceWeightEventsTest.php | 10 +- tests/Api/ScheduleTest.php | 50 +- tests/Api/SearchTest.php | 5 +- tests/Api/SnippetsTest.php | 65 +- tests/Api/SystemHooksTest.php | 20 +- tests/Api/TagsTest.php | 38 +- tests/Api/TestCase.php | 3 + tests/Api/UsersTest.php | 278 ++----- tests/Api/VersionTest.php | 5 +- tests/Api/WikiTest.php | 25 +- tests/ClientTest.php | 3 + tests/HttpClient/BuilderTest.php | 7 + .../Message/ResponseMediatorTest.php | 5 + .../Util/QueryStringBuilderTest.php | 9 +- tests/IntegrationTest.php | 3 + 41 files changed, 572 insertions(+), 1945 deletions(-) diff --git a/tests/Api/DeployKeysTest.php b/tests/Api/DeployKeysTest.php index f5a537be..0a600d96 100644 --- a/tests/Api/DeployKeysTest.php +++ b/tests/Api/DeployKeysTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\DeployKeys; class DeployKeysTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllDeployKeys(): void { $expectedArray = $this->getMultipleDeployKeysData(); diff --git a/tests/Api/DeploymentsTest.php b/tests/Api/DeploymentsTest.php index 83f85f47..f62f1371 100644 --- a/tests/Api/DeploymentsTest.php +++ b/tests/Api/DeploymentsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Deployments; class DeploymentsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllDeployments(): void { $expectedArray = $this->getMultipleDeploymentsData(); @@ -29,10 +28,7 @@ public function shouldGetAllDeployments(): void $this->assertEquals($expectedArray, $api->all(1)); } - - /** - * @test - */ + #[Test] public function shouldShowDeployment(): void { $expectedArray = [ @@ -254,10 +250,7 @@ protected function getMultipleDeploymentsRequestMock(string $path, array $expect return $api; } - - /** - * @test - */ + #[Test] public function shouldGetAllDeploymentsSortedByCreatedAt(): void { $expectedArray = $this->getMultipleDeploymentsData(); @@ -278,10 +271,7 @@ protected function getApiClass() { return Deployments::class; } - - /** - * @test - */ + #[Test] public function shouldAllowDeploymentFilterByStatus(): void { $expectedArray = $this->getMultipleDeploymentsData(); @@ -297,10 +287,7 @@ public function shouldAllowDeploymentFilterByStatus(): void $api->all(1, ['status' => 'success']) ); } - - /** - * @test - */ + #[Test] public function shouldAllowFilterByEnvironment(): void { $expectedArray = $this->getMultipleDeploymentsData(); @@ -316,10 +303,7 @@ public function shouldAllowFilterByEnvironment(): void $api->all(1, ['environment' => 'production']) ); } - - /** - * @test - */ + #[Test] public function shouldAllowEmptyArrayIfAllExcludedByFilter(): void { $expectedArray = $this->getMultipleDeploymentsData(); diff --git a/tests/Api/EnvironmentsTest.php b/tests/Api/EnvironmentsTest.php index badec596..caeda60d 100644 --- a/tests/Api/EnvironmentsTest.php +++ b/tests/Api/EnvironmentsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Environments; class EnvironmentsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllEnvironments(): void { $expectedArray = [ @@ -64,10 +63,7 @@ public function shouldFilterEnvironmentByName(): void ->willReturn($expected); $this->assertEquals($expected, $api->all(1, ['name' => 'review/fix-bar'])); } - - /** - * @test - */ + #[Test] public function shouldGetSingleEnvironment(): void { $expected = [ @@ -143,10 +139,7 @@ public function shouldGetSingleEnvironment(): void ->willReturn($expected); $this->assertEquals($expected, $api->show(1, 1)); } - - /** - * @test - */ + #[Test] public function shouldCreateEnvironment(): void { $expectedArray = [ @@ -173,10 +166,7 @@ public function shouldCreateEnvironment(): void $this->assertEquals($expectedArray, $api->create(1, $params)); } - - /** - * @test - */ + #[Test] public function shouldRemoveEnvironment(): void { $expectedBool = true; @@ -188,10 +178,7 @@ public function shouldRemoveEnvironment(): void ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->remove(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldStopEnvironment(): void { $expectedBool = true; diff --git a/tests/Api/EventsTest.php b/tests/Api/EventsTest.php index 2d7e7326..5f60bdba 100644 --- a/tests/Api/EventsTest.php +++ b/tests/Api/EventsTest.php @@ -13,6 +13,7 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Events; class EventsTest extends TestCase @@ -21,10 +22,7 @@ protected function getApiClass() { return Events::class; } - - /** - * @test - */ + #[Test] public function shouldGetAllEvents(): void { $expectedArray = [ @@ -41,10 +39,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldGetEventsAfter(): void { $expectedArray = [ diff --git a/tests/Api/GroupBoardsTest.php b/tests/Api/GroupBoardsTest.php index b87ac456..45c5c849 100644 --- a/tests/Api/GroupBoardsTest.php +++ b/tests/Api/GroupBoardsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\GroupsBoards; class GroupBoardsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllBoards(): void { $expectedArray = [ @@ -37,10 +36,7 @@ public function shouldGetAllBoards(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldShowIssueBoard(): void { $expectedArray = ['id' => 2, 'name' => 'Another issue board']; @@ -54,10 +50,7 @@ public function shouldShowIssueBoard(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldCreateIssueBoard(): void { $expectedArray = ['id' => 3, 'name' => 'A new issue board']; @@ -71,10 +64,7 @@ public function shouldCreateIssueBoard(): void $this->assertEquals($expectedArray, $api->create(1, ['name' => 'A new issue board'])); } - - /** - * @test - */ + #[Test] public function shouldUpdateIssueBoard(): void { $expectedArray = ['id' => 2, 'name' => 'A renamed issue board']; @@ -88,10 +78,7 @@ public function shouldUpdateIssueBoard(): void $this->assertEquals($expectedArray, $api->update(1, 2, ['name' => 'A renamed issue board', 'labels' => 'foo'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveIssueBoard(): void { $expectedBool = true; @@ -104,10 +91,7 @@ public function shouldRemoveIssueBoard(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetAllLists(): void { $expectedArray = [ @@ -139,10 +123,7 @@ public function shouldGetAllLists(): void $this->assertEquals($expectedArray, $api->allLists(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetList(): void { $expectedArray = [ @@ -166,10 +147,7 @@ public function shouldGetList(): void $this->assertEquals($expectedArray, $api->showList(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldCreateList(): void { $expectedArray = [ @@ -193,10 +171,7 @@ public function shouldCreateList(): void $this->assertEquals($expectedArray, $api->createList(1, 2, 4)); } - - /** - * @test - */ + #[Test] public function shouldUpdateList(): void { $expectedArray = [ @@ -220,10 +195,7 @@ public function shouldUpdateList(): void $this->assertEquals($expectedArray, $api->updateList(5, 2, 3, 1)); } - - /** - * @test - */ + #[Test] public function shouldDeleteList(): void { $expectedBool = true; diff --git a/tests/Api/GroupsEpicsTest.php b/tests/Api/GroupsEpicsTest.php index 37a7afd8..586caedf 100644 --- a/tests/Api/GroupsEpicsTest.php +++ b/tests/Api/GroupsEpicsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\GroupsEpics; class GroupsEpicsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllEpics(): void { $expectedArray = [ @@ -37,10 +36,7 @@ public function shouldGetAllEpics(): void $this->assertEquals($expectedArray, $api->all(1)); } - - /** - * @test - */ + #[Test] public function shouldShowEpic(): void { $expectedArray = ['id' => 1, 'name' => 'A epic']; @@ -54,10 +50,7 @@ public function shouldShowEpic(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldCreateEpic(): void { $expectedArray = ['id' => 3, 'title' => 'A new epic']; @@ -71,10 +64,7 @@ public function shouldCreateEpic(): void $this->assertEquals($expectedArray, $api->create(1, ['description' => 'Some text', 'title' => 'A new epic'])); } - - /** - * @test - */ + #[Test] public function shouldUpdateEpic(): void { $expectedArray = ['id' => 3, 'title' => 'Updated epic']; @@ -88,10 +78,7 @@ public function shouldUpdateEpic(): void $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated epic', 'description' => 'Updated description', 'state_event' => 'close'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveEpic(): void { $expectedBool = true; @@ -104,10 +91,7 @@ public function shouldRemoveEpic(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetEpicsIssues(): void { $expectedArray = [ diff --git a/tests/Api/GroupsMilestonesTest.php b/tests/Api/GroupsMilestonesTest.php index 94c28d71..a96c823b 100644 --- a/tests/Api/GroupsMilestonesTest.php +++ b/tests/Api/GroupsMilestonesTest.php @@ -14,13 +14,14 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\GroupsMilestones; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\DataProvider; class GroupsMilestonesTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllMilestones(): void { $expectedArray = [ @@ -37,10 +38,7 @@ public function shouldGetAllMilestones(): void $this->assertEquals($expectedArray, $api->all(1)); } - - /** - * @test - */ + #[Test] public function shouldGetAllMilestonesWithParameterOneIidsValue(): void { $api = $this->getApiMock(); @@ -51,10 +49,7 @@ public function shouldGetAllMilestonesWithParameterOneIidsValue(): void $api->all(1, ['iids' => [456]]); } - - /** - * @test - */ + #[Test] public function shouldGetAllMilestonesWithParameterTwoIidsValues(): void { $api = $this->getApiMock(); @@ -73,12 +68,8 @@ public static function getAllMilestonesWithParameterStateDataProvider() GroupsMilestones::STATE_CLOSED => [GroupsMilestones::STATE_CLOSED], ]; } - - /** - * @test - * - * @dataProvider getAllMilestonesWithParameterStateDataProvider - */ + #[Test] + #[DataProvider('getAllMilestonesWithParameterStateDataProvider')] public function shouldGetAllMilestonesWithParameterState(string $state): void { $api = $this->getApiMock(); @@ -89,10 +80,7 @@ public function shouldGetAllMilestonesWithParameterState(string $state): void $api->all(1, ['state' => $state]); } - - /** - * @test - */ + #[Test] public function shouldGetAllMilestonesWithParameterSearch(): void { $searchValue = 'abc'; @@ -105,10 +93,7 @@ public function shouldGetAllMilestonesWithParameterSearch(): void $api->all(1, ['search' => $searchValue]); } - - /** - * @test - */ + #[Test] public function shouldGetAllMilestonesWithParameterUpdatedBefore(): void { $updatedBefore = new \DateTimeImmutable('2023-11-25T08:00:00Z'); @@ -121,10 +106,7 @@ public function shouldGetAllMilestonesWithParameterUpdatedBefore(): void $api->all(1, ['updated_before' => $updatedBefore]); } - - /** - * @test - */ + #[Test] public function shouldGetAllMilestonesWithParameterUpdatedAfter(): void { $updatedAfter = new \DateTimeImmutable('2023-11-25T08:00:00Z'); @@ -137,10 +119,7 @@ public function shouldGetAllMilestonesWithParameterUpdatedAfter(): void $api->all(1, ['updated_after' => $updatedAfter]); } - - /** - * @test - */ + #[Test] public function shouldShowMilestone(): void { $expectedArray = ['id' => 1, 'name' => 'A milestone']; @@ -154,10 +133,7 @@ public function shouldShowMilestone(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldCreateMilestone(): void { $expectedArray = ['id' => 3, 'title' => 'A new milestone']; @@ -171,10 +147,7 @@ public function shouldCreateMilestone(): void $this->assertEquals($expectedArray, $api->create(1, ['description' => 'Some text', 'title' => 'A new milestone'])); } - - /** - * @test - */ + #[Test] public function shouldUpdateMilestone(): void { $expectedArray = ['id' => 3, 'title' => 'Updated milestone']; @@ -188,10 +161,7 @@ public function shouldUpdateMilestone(): void $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated milestone', 'due_date' => '2015-04-01', 'state_event' => 'close'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveMilestone(): void { $expectedBool = true; @@ -204,10 +174,7 @@ public function shouldRemoveMilestone(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetMilestonesIssues(): void { $expectedArray = [ @@ -224,10 +191,7 @@ public function shouldGetMilestonesIssues(): void $this->assertEquals($expectedArray, $api->issues(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetMilestonesMergeRequests(): void { $expectedArray = [ diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index 535717d2..58d9fdca 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -14,14 +14,14 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use DateTime; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Groups; class GroupsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllGroups(): void { $expectedArray = [ @@ -38,10 +38,7 @@ public function shouldGetAllGroups(): void $this->assertEquals($expectedArray, $api->all(['page' => 1, 'per_page' => 10])); } - - /** - * @test - */ + #[Test] public function shouldGetAllGroupsWithBooleanParam(): void { $expectedArray = [ @@ -58,10 +55,7 @@ public function shouldGetAllGroupsWithBooleanParam(): void $this->assertEquals($expectedArray, $api->all(['all_available' => false])); } - - /** - * @test - */ + #[Test] public function shouldGetAllTopLevelGroupsWithoutSubgroups(): void { $expectedArray = [ @@ -78,10 +72,7 @@ public function shouldGetAllTopLevelGroupsWithoutSubgroups(): void $this->assertEquals($expectedArray, $api->all(['top_level_only' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetAllGroupProjectsWithBooleanParam(): void { $expectedArray = [ @@ -98,10 +89,7 @@ public function shouldGetAllGroupProjectsWithBooleanParam(): void $this->assertEquals($expectedArray, $api->projects(1, ['archived' => false])); } - - /** - * @test - */ + #[Test] public function shouldNotNeedPaginationWhenGettingGroups(): void { $expectedArray = [ @@ -118,10 +106,7 @@ public function shouldNotNeedPaginationWhenGettingGroups(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldShowGroup(): void { $expectedArray = ['id' => 1, 'name' => 'A group']; @@ -135,10 +120,7 @@ public function shouldShowGroup(): void $this->assertEquals($expectedArray, $api->show(1)); } - - /** - * @test - */ + #[Test] public function shouldCreateGroup(): void { $expectedArray = ['id' => 1, 'name' => 'A new group']; @@ -152,10 +134,7 @@ public function shouldCreateGroup(): void $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group')); } - - /** - * @test - */ + #[Test] public function shouldCreateGroupWithDescriptionAndVisibility(): void { $expectedArray = ['id' => 1, 'name' => 'A new group', 'visibility_level' => 2]; @@ -169,10 +148,7 @@ public function shouldCreateGroupWithDescriptionAndVisibility(): void $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group', 'Description', 'public')); } - - /** - * @test - */ + #[Test] public function shouldCreateGroupWithDescriptionVisibilityAndParentId(): void { $expectedArray = ['id' => 1, 'name' => 'A new group', 'visibility_level' => 2, 'parent_id' => 666]; @@ -186,10 +162,7 @@ public function shouldCreateGroupWithDescriptionVisibilityAndParentId(): void $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group', 'Description', 'public', null, null, 666)); } - - /** - * @test - */ + #[Test] public function shouldUpdateGroup(): void { $expectedArray = ['id' => 3, 'name' => 'Group name', 'path' => 'group-path']; @@ -203,10 +176,7 @@ public function shouldUpdateGroup(): void $this->assertEquals($expectedArray, $api->update(3, ['name' => 'Group name', 'path' => 'group-path'])); } - - /** - * @test - */ + #[Test] public function shouldTransferProjectToGroup(): void { $expectedBool = true; @@ -219,10 +189,7 @@ public function shouldTransferProjectToGroup(): void $this->assertEquals($expectedBool, $api->transfer(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetAllMembers(): void { $expectedArray = [ @@ -239,10 +206,7 @@ public function shouldGetAllMembers(): void $this->assertEquals($expectedArray, $api->allMembers(1)); } - - /** - * @test - */ + #[Test] public function shouldGetAllMember(): void { $expectedArray = ['id' => 2, 'name' => 'Bob']; @@ -255,10 +219,7 @@ public function shouldGetAllMember(): void $this->assertEquals($expectedArray, $api->allMember(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetMembers(): void { $expectedArray = [ @@ -275,10 +236,7 @@ public function shouldGetMembers(): void $this->assertEquals($expectedArray, $api->members(1)); } - - /** - * @test - */ + #[Test] public function shouldAddMember(): void { $tomorrow = (new DateTime('tomorrow')); @@ -295,10 +253,7 @@ public function shouldAddMember(): void $this->assertEquals($expectedArray, $api->addMember(1, 2, 10, ['expires_at' => $tomorrow])); } - - /** - * @test - */ + #[Test] public function shouldSaveMember(): void { $expectedArray = ['id' => 1, 'name' => 'Matt']; @@ -312,10 +267,7 @@ public function shouldSaveMember(): void $this->assertEquals($expectedArray, $api->saveMember(1, 2, 4)); } - - /** - * @test - */ + #[Test] public function shouldRemoveMember(): void { $expectedBool = true; @@ -328,10 +280,7 @@ public function shouldRemoveMember(): void $this->assertEquals($expectedBool, $api->removeMember(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldRemoveGroup(): void { $expectedBool = true; @@ -344,10 +293,7 @@ public function shouldRemoveGroup(): void $this->assertEquals($expectedBool, $api->remove(1)); } - - /** - * @test - */ + #[Test] public function shouldGetAllSubgroups(): void { $expectedArray = [ @@ -364,10 +310,7 @@ public function shouldGetAllSubgroups(): void $this->assertEquals($expectedArray, $api->subgroups(1, ['page' => 1, 'per_page' => 10])); } - - /** - * @test - */ + #[Test] public function shouldGetAllIssues(): void { $expectedArray = [ @@ -385,10 +328,7 @@ public function shouldGetAllIssues(): void $this->assertEquals($expectedArray, $api->issues(1, ['page' => 1, 'per_page' => 10])); } - - /** - * @test - */ + #[Test] public function shouldGetLabels(): void { $expectedArray = [ @@ -405,10 +345,7 @@ public function shouldGetLabels(): void $this->assertEquals($expectedArray, $api->labels(1)); } - - /** - * @test - */ + #[Test] public function shouldAddLabel(): void { $expectedArray = ['name' => 'bug', 'color' => '#000000']; @@ -422,10 +359,7 @@ public function shouldAddLabel(): void $this->assertEquals($expectedArray, $api->addLabel(1, ['name' => 'wont-fix', 'color' => '#ffffff'])); } - - /** - * @test - */ + #[Test] public function shouldUpdateLabel(): void { $expectedArray = ['name' => 'bug', 'color' => '#00ffff']; @@ -439,10 +373,7 @@ public function shouldUpdateLabel(): void $this->assertEquals($expectedArray, $api->updateLabel(1, 123, ['new_name' => 'big-bug', 'color' => '#00ffff'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveLabel(): void { $expectedBool = true; @@ -472,10 +403,7 @@ public function shouldGetVariables(): void $this->assertEquals($expectedArray, $api->variables(1)); } - - /** - * @test - */ + #[Test] public function shouldGetVariable(): void { $expectedArray = ['key' => 'ftp_username', 'value' => 'ftp']; @@ -509,10 +437,7 @@ public function shouldAddVariable(): void $this->assertEquals($expectedArray, $api->addVariable(1, $expectedKey, $expectedValue)); } - - /** - * @test - */ + #[Test] public function shouldAddVariableWithProtected(): void { $expectedArray = [ @@ -530,10 +455,7 @@ public function shouldAddVariableWithProtected(): void $this->assertEquals($expectedArray, $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); } - - /** - * @test - */ + #[Test] public function shouldUpdateVariable(): void { $expectedKey = 'ftp_port'; @@ -553,10 +475,7 @@ public function shouldUpdateVariable(): void $this->assertEquals($expectedArray, $api->updateVariable(1, $expectedKey, $expectedValue)); } - - /** - * @test - */ + #[Test] public function shouldUpdateVariableWithProtected(): void { $expectedArray = [ @@ -574,10 +493,7 @@ public function shouldUpdateVariableWithProtected(): void $this->assertEquals($expectedArray, $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); } - - /** - * @test - */ + #[Test] public function shouldRemoveVariable(): void { $expectedBool = true; @@ -595,10 +511,7 @@ protected function getApiClass() { return Groups::class; } - - /** - * @test - */ + #[Test] public function shouldGetAllGroupProjectsWithIssuesEnabled(): void { $expectedArray = [ @@ -615,10 +528,7 @@ public function shouldGetAllGroupProjectsWithIssuesEnabled(): void $this->assertEquals($expectedArray, $api->projects(1, ['with_issues_enabled' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetAllGroupProjectsWithMergeRequestsEnabled(): void { $expectedArray = [ @@ -635,10 +545,7 @@ public function shouldGetAllGroupProjectsWithMergeRequestsEnabled(): void $this->assertEquals($expectedArray, $api->projects(1, ['with_merge_requests_enabled' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetAllGroupProjectsSharedToGroup(): void { $expectedArray = [ @@ -655,10 +562,7 @@ public function shouldGetAllGroupProjectsSharedToGroup(): void $this->assertEquals($expectedArray, $api->projects(1, ['with_shared' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetAllGroupProjectsIncludingSubsgroups(): void { $expectedArray = [ @@ -675,10 +579,7 @@ public function shouldGetAllGroupProjectsIncludingSubsgroups(): void $this->assertEquals($expectedArray, $api->projects(1, ['include_subgroups' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetAllGroupProjectsIncludingCustomAttributes(): void { $expectedArray = [ @@ -695,10 +596,7 @@ public function shouldGetAllGroupProjectsIncludingCustomAttributes(): void $this->assertEquals($expectedArray, $api->projects(1, ['with_custom_attributes' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetIterations(): void { $expectedArray = [ @@ -727,10 +625,7 @@ public function shouldGetIterations(): void $this->assertEquals($expectedArray, $api->iterations(1)); } - - /** - * @test - */ + #[Test] public function shouldGetPackages(): void { $expectedArray = [ @@ -767,10 +662,7 @@ public function shouldGetPackages(): void $this->assertEquals($expectedArray, $api->packages(1)); } - - /** - * @test - */ + #[Test] public function shouldGetGroupMergeRequests(): void { $expectedArray = [ @@ -787,10 +679,7 @@ public function shouldGetGroupMergeRequests(): void $this->assertEquals($expectedArray, $api->mergeRequests(1, [])); } - - /** - * @test - */ + #[Test] public function shouldGetDeployTokens(): void { $expectedArray = [ @@ -816,10 +705,7 @@ public function shouldGetDeployTokens(): void $this->assertEquals($expectedArray, $api->deployTokens(1)); } - - /** - * @test - */ + #[Test] public function shouldGetActiveDeployTokens(): void { $expectedArray = [ @@ -845,10 +731,7 @@ public function shouldGetActiveDeployTokens(): void $this->assertEquals([], $api->deployTokens(1, true)); } - - /** - * @test - */ + #[Test] public function shouldGetInactiveDeployTokens(): void { $expectedArray = [ @@ -874,10 +757,7 @@ public function shouldGetInactiveDeployTokens(): void $this->assertEquals([], $api->deployTokens(1, false)); } - - /** - * @test - */ + #[Test] public function shouldCreateDeployToken(): void { $expectedArray = [ @@ -919,10 +799,7 @@ public function shouldCreateDeployToken(): void 'expires_at' => new DateTime('2021-01-01'), ])); } - - /** - * @test - */ + #[Test] public function shouldDeleteDeployToken(): void { $expectedBool = true; @@ -935,10 +812,7 @@ public function shouldDeleteDeployToken(): void $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldSearchGroups(): void { $expectedArray = [ diff --git a/tests/Api/IssueBoardsTest.php b/tests/Api/IssueBoardsTest.php index d4a9a7fe..a41b19e2 100644 --- a/tests/Api/IssueBoardsTest.php +++ b/tests/Api/IssueBoardsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\IssueBoards; class IssueBoardsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllBoards(): void { $expectedArray = [ @@ -37,10 +36,7 @@ public function shouldGetAllBoards(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldShowIssueBoard(): void { $expectedArray = ['id' => 2, 'name' => 'Another issue board']; @@ -54,10 +50,7 @@ public function shouldShowIssueBoard(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldCreateIssueBoard(): void { $expectedArray = ['id' => 3, 'name' => 'A new issue board']; @@ -71,10 +64,7 @@ public function shouldCreateIssueBoard(): void $this->assertEquals($expectedArray, $api->create(1, ['name' => 'A new issue board'])); } - - /** - * @test - */ + #[Test] public function shouldUpdateIssueBoard(): void { $expectedArray = ['id' => 2, 'name' => 'A renamed issue board']; @@ -88,10 +78,7 @@ public function shouldUpdateIssueBoard(): void $this->assertEquals($expectedArray, $api->update(1, 2, ['name' => 'A renamed issue board', 'labels' => 'foo'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveIssueBoard(): void { $expectedBool = true; @@ -104,10 +91,7 @@ public function shouldRemoveIssueBoard(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetAllLists(): void { $expectedArray = [ @@ -139,10 +123,7 @@ public function shouldGetAllLists(): void $this->assertEquals($expectedArray, $api->allLists(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetList(): void { $expectedArray = [ @@ -166,10 +147,7 @@ public function shouldGetList(): void $this->assertEquals($expectedArray, $api->showList(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldCreateList(): void { $expectedArray = [ @@ -193,10 +171,7 @@ public function shouldCreateList(): void $this->assertEquals($expectedArray, $api->createList(1, 2, 4)); } - - /** - * @test - */ + #[Test] public function shouldUpdateList(): void { $expectedArray = [ @@ -220,10 +195,7 @@ public function shouldUpdateList(): void $this->assertEquals($expectedArray, $api->updateList(5, 2, 3, 1)); } - - /** - * @test - */ + #[Test] public function shouldDeleteList(): void { $expectedBool = true; diff --git a/tests/Api/IssueLinksTest.php b/tests/Api/IssueLinksTest.php index 5c37aa0f..b6ad78f9 100644 --- a/tests/Api/IssueLinksTest.php +++ b/tests/Api/IssueLinksTest.php @@ -14,6 +14,7 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\IssueLinks; class IssueLinksTest extends TestCase @@ -25,10 +26,7 @@ protected function getApiClass() { return IssueLinks::class; } - - /** - * @test - */ + #[Test] public function shouldGetIssueLinks(): void { $expectedArray = [ @@ -45,10 +43,7 @@ public function shouldGetIssueLinks(): void $this->assertEquals($expectedArray, $api->all(1, 10)); } - - /** - * @test - */ + #[Test] public function shouldCreateIssueLink(): void { $expectedArray = [ @@ -65,10 +60,7 @@ public function shouldCreateIssueLink(): void $this->assertEquals($expectedArray, $api->create(1, 10, 2, 20)); } - - /** - * @test - */ + #[Test] public function shouldRemoveIssueLink(): void { $expectedArray = [ diff --git a/tests/Api/IssueSubscribeTest.php b/tests/Api/IssueSubscribeTest.php index dea23ec0..674a1724 100644 --- a/tests/Api/IssueSubscribeTest.php +++ b/tests/Api/IssueSubscribeTest.php @@ -14,6 +14,7 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Issues; /** diff --git a/tests/Api/IssuesStatisticsTest.php b/tests/Api/IssuesStatisticsTest.php index 4b588137..88cc0d07 100644 --- a/tests/Api/IssuesStatisticsTest.php +++ b/tests/Api/IssuesStatisticsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\IssuesStatistics; class IssuesStatisticsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAll(): void { $expectedArray = []; @@ -65,10 +64,7 @@ public function shouldGetAll(): void 'confidential' => false, ])); } - - /** - * @test - */ + #[Test] public function shouldGetProject(): void { $expectedArray = []; @@ -81,10 +77,7 @@ public function shouldGetProject(): void $this->assertEquals($expectedArray, $api->project(1, [])); } - - /** - * @test - */ + #[Test] public function shouldGetGroup(): void { $expectedArray = []; diff --git a/tests/Api/IssuesTest.php b/tests/Api/IssuesTest.php index 8457dbd1..0c9abc72 100644 --- a/tests/Api/IssuesTest.php +++ b/tests/Api/IssuesTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Issues; class IssuesTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllIssues(): void { $expectedArray = [ @@ -37,10 +36,7 @@ public function shouldGetAllIssues(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldGetAllGroupIssues(): void { $expectedArray = [ @@ -57,10 +53,7 @@ public function shouldGetAllGroupIssues(): void $this->assertEquals($expectedArray, $api->group(1)); } - - /** - * @test - */ + #[Test] public function shouldGetGroupIssuesWithPagination(): void { $expectedArray = [ @@ -77,10 +70,7 @@ public function shouldGetGroupIssuesWithPagination(): void $this->assertEquals($expectedArray, $api->group(1, ['page' => 2, 'per_page' => 5])); } - - /** - * @test - */ + #[Test] public function shouldGetGroupIssuesWithParams(): void { $expectedArray = [ @@ -97,10 +87,7 @@ public function shouldGetGroupIssuesWithParams(): void $this->assertEquals($expectedArray, $api->group(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_title' => 'Title', 'assignee_id' => 1])); } - - /** - * @test - */ + #[Test] public function shouldGetProjectIssuesWithPagination(): void { $expectedArray = [ @@ -117,10 +104,7 @@ public function shouldGetProjectIssuesWithPagination(): void $this->assertEquals($expectedArray, $api->all(1, ['page' => 2, 'per_page' => 5])); } - - /** - * @test - */ + #[Test] public function shouldGetProjectIssuesWithParams(): void { $expectedArray = [ @@ -137,10 +121,7 @@ public function shouldGetProjectIssuesWithParams(): void $this->assertEquals($expectedArray, $api->all(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_id' => 1, 'assignee_id' => 2])); } - - /** - * @test - */ + #[Test] public function shouldShowIssue(): void { $expectedArray = ['id' => 2, 'title' => 'Another issue']; @@ -154,10 +135,7 @@ public function shouldShowIssue(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldCreateIssue(): void { $expectedArray = ['id' => 3, 'title' => 'A new issue']; @@ -171,10 +149,7 @@ public function shouldCreateIssue(): void $this->assertEquals($expectedArray, $api->create(1, ['title' => 'A new issue', 'labels' => 'foo,bar'])); } - - /** - * @test - */ + #[Test] public function shouldUpdateIssue(): void { $expectedArray = ['id' => 2, 'title' => 'A renamed issue']; @@ -188,10 +163,7 @@ public function shouldUpdateIssue(): void $this->assertEquals($expectedArray, $api->update(1, 2, ['title' => 'A renamed issue', 'labels' => 'foo'])); } - - /** - * @test - */ + #[Test] public function shouldReorderIssue(): void { $expectedArray = ['id' => 2, 'title' => 'A reordered issue']; @@ -203,10 +175,7 @@ public function shouldReorderIssue(): void ; $this->assertEquals($expectedArray, $api->reorder(1, 2, ['move_after_id' => 3, 'move_before_id' => 4])); } - - /** - * @test - */ + #[Test] public function shouldMoveIssue(): void { $expectedArray = ['id' => 2, 'title' => 'A moved issue']; @@ -220,10 +189,7 @@ public function shouldMoveIssue(): void $this->assertEquals($expectedArray, $api->move(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetNotes(): void { $expectedArray = [ @@ -240,10 +206,7 @@ public function shouldGetNotes(): void $this->assertEquals($expectedArray, $api->showNotes(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetNote(): void { $expectedArray = ['id' => 3, 'body' => 'A new note']; @@ -257,10 +220,7 @@ public function shouldGetNote(): void $this->assertEquals($expectedArray, $api->showNote(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldCreateNote(): void { $expectedArray = ['id' => 3, 'body' => 'A new note']; @@ -274,10 +234,7 @@ public function shouldCreateNote(): void $this->assertEquals($expectedArray, $api->addNote(1, 2, 'A new note')); } - - /** - * @test - */ + #[Test] public function shouldUpdateNote(): void { $expectedArray = ['id' => 3, 'body' => 'An edited comment']; @@ -291,10 +248,7 @@ public function shouldUpdateNote(): void $this->assertEquals($expectedArray, $api->updateNote(1, 2, 3, 'An edited comment')); } - - /** - * @test - */ + #[Test] public function shouldRemoveNote(): void { $expectedBool = true; @@ -307,10 +261,7 @@ public function shouldRemoveNote(): void $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetIssueDiscussions(): void { $expectedArray = [ @@ -327,10 +278,7 @@ public function shouldGetIssueDiscussions(): void $this->assertEquals($expectedArray, $api->showDiscussions(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetIssueDiscussion(): void { $expectedArray = ['id' => 'abc', 'body' => 'A discussion']; @@ -344,10 +292,7 @@ public function shouldGetIssueDiscussion(): void $this->assertEquals($expectedArray, $api->showDiscussion(1, 2, 'abc')); } - - /** - * @test - */ + #[Test] public function shouldCreateDiscussion(): void { $expectedArray = ['id' => 'abc', 'body' => 'A new discussion']; @@ -361,10 +306,7 @@ public function shouldCreateDiscussion(): void $this->assertEquals($expectedArray, $api->addDiscussion(1, 2, 'A new discussion')); } - - /** - * @test - */ + #[Test] public function shouldCreateDiscussionNote(): void { $expectedArray = ['id' => 3, 'body' => 'A new discussion note']; @@ -378,10 +320,7 @@ public function shouldCreateDiscussionNote(): void $this->assertEquals($expectedArray, $api->addDiscussionNote(1, 2, 'abc', 'A new discussion note')); } - - /** - * @test - */ + #[Test] public function shouldUpdateDiscussionNote(): void { $expectedArray = ['id' => 3, 'body' => 'An edited discussion note']; @@ -395,10 +334,7 @@ public function shouldUpdateDiscussionNote(): void $this->assertEquals($expectedArray, $api->updateDiscussionNote(1, 2, 'abc', 3, 'An edited discussion note')); } - - /** - * @test - */ + #[Test] public function shouldRemoveDiscussionNote(): void { $expectedBool = true; @@ -411,10 +347,7 @@ public function shouldRemoveDiscussionNote(): void $this->assertEquals($expectedBool, $api->removeDiscussionNote(1, 2, 'abc', 3)); } - - /** - * @test - */ + #[Test] public function shouldSetTimeEstimate(): void { $expectedArray = ['time_estimate' => 14400, 'total_time_spent' => 0, 'human_time_estimate' => '4h', 'human_total_time_spent' => null]; @@ -428,10 +361,7 @@ public function shouldSetTimeEstimate(): void $this->assertEquals($expectedArray, $api->setTimeEstimate(1, 2, '4h')); } - - /** - * @test - */ + #[Test] public function shouldResetTimeEstimate(): void { $expectedArray = ['time_estimate' => 0, 'total_time_spent' => 0, 'human_time_estimate' => null, 'human_total_time_spent' => null]; @@ -445,10 +375,7 @@ public function shouldResetTimeEstimate(): void $this->assertEquals($expectedArray, $api->resetTimeEstimate(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldAddSpentTime(): void { $expectedArray = ['time_estimate' => 0, 'total_time_spent' => 14400, 'human_time_estimate' => null, 'human_total_time_spent' => '4h']; @@ -462,10 +389,7 @@ public function shouldAddSpentTime(): void $this->assertEquals($expectedArray, $api->addSpentTime(1, 2, '4h')); } - - /** - * @test - */ + #[Test] public function shouldResetSpentTime(): void { $expectedArray = ['time_estimate' => 0, 'total_time_spent' => 0, 'human_time_estimate' => null, 'human_total_time_spent' => null]; @@ -479,10 +403,7 @@ public function shouldResetSpentTime(): void $this->assertEquals($expectedArray, $api->resetSpentTime(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetIssueTimeStats(): void { $expectedArray = ['time_estimate' => 14400, 'total_time_spent' => 5400, 'human_time_estimate' => '4h', 'human_total_time_spent' => '1h 30m']; @@ -496,10 +417,7 @@ public function shouldGetIssueTimeStats(): void $this->assertEquals($expectedArray, $api->getTimeStats(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldIssueAwardEmoji(): void { $expectedArray = [ @@ -516,10 +434,7 @@ public function shouldIssueAwardEmoji(): void $this->assertEquals($expectedArray, $api->awardEmoji(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldRevokeAwardEmoji(): void { $expectedBool = true; @@ -532,10 +447,7 @@ public function shouldRevokeAwardEmoji(): void $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetIssueClosedByMergeRequests(): void { $expectedArray = [ @@ -552,10 +464,7 @@ public function shouldGetIssueClosedByMergeRequests(): void $this->assertEquals($expectedArray, $api->closedByMergeRequests(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetIssueRelatedMergeRequests(): void { $expectedArray = [ @@ -572,10 +481,7 @@ public function shouldGetIssueRelatedMergeRequests(): void $this->assertEquals($expectedArray, $api->relatedMergeRequests(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetProjectIssuesByAssignee(): void { $expectedArray = [ @@ -592,10 +498,7 @@ public function shouldGetProjectIssuesByAssignee(): void $this->assertEquals($expectedArray, $api->all(1, ['assignee_id' => 1])); } - - /** - * @test - */ + #[Test] public function shouldGetIssueParticipants(): void { $expectedArray = [ @@ -626,10 +529,7 @@ public function shouldGetIssueParticipants(): void $this->assertEquals($expectedArray, $api->showParticipants(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetIssueResourceLabelEvents(): void { $expectedArray = [ @@ -646,10 +546,7 @@ public function shouldGetIssueResourceLabelEvents(): void $this->assertEquals($expectedArray, $api->showResourceLabelEvents(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetIssueResourceLabelEvent(): void { $expectedArray = ['id' => 1, 'resource_type' => 'Issue', 'action' => 'add']; diff --git a/tests/Api/JobsTest.php b/tests/Api/JobsTest.php index b8618f83..edafb8b6 100644 --- a/tests/Api/JobsTest.php +++ b/tests/Api/JobsTest.php @@ -14,14 +14,14 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Jobs; +use PHPUnit\Framework\Attributes\Test; use GuzzleHttp\Psr7\Response; class JobsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllJobs(): void { $expectedArray = [ @@ -40,10 +40,7 @@ public function shouldGetAllJobs(): void $this->assertEquals($expectedArray, $api->all(1, ['scope' => Jobs::SCOPE_PENDING])); } - - /** - * @test - */ + #[Test] public function shouldGetPipelineJobs(): void { $expectedArray = [ @@ -62,10 +59,7 @@ public function shouldGetPipelineJobs(): void $this->assertEquals($expectedArray, $api->pipelineJobs(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING]])); } - - /** - * @test - */ + #[Test] public function shouldGetPipelineJobsIncludingRetried(): void { $expectedArray = [ @@ -86,10 +80,7 @@ public function shouldGetPipelineJobsIncludingRetried(): void $this->assertEquals($expectedArray, $api->pipelineJobs(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING], 'include_retried' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetPipelineBridges(): void { $expectedArray = [ @@ -108,10 +99,7 @@ public function shouldGetPipelineBridges(): void $this->assertEquals($expectedArray, $api->pipelineBridges(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING]])); } - - /** - * @test - */ + #[Test] public function shouldGetJob(): void { $expectedArray = ['id' => 3, 'name' => 'A job']; @@ -125,10 +113,7 @@ public function shouldGetJob(): void $this->assertEquals($expectedArray, $api->show(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetArtifacts(): void { $returnedStream = new Response(200, [], 'foobar'); @@ -141,10 +126,7 @@ public function shouldGetArtifacts(): void $this->assertEquals('foobar', $api->artifacts(1, 3)->getContents()); } - - /** - * @test - */ + #[Test] public function shouldGetArtifactsByJobId(): void { $returnedStream = new Response(200, [], 'foobar'); @@ -157,10 +139,7 @@ public function shouldGetArtifactsByJobId(): void $this->assertEquals('foobar', $api->artifactByJobId(1, 3, 'artifact_path')->getContents()); } - - /** - * @test - */ + #[Test] public function shouldGetArtifactsByRefName(): void { $returnedStream = new Response(200, [], 'foobar'); @@ -175,10 +154,7 @@ public function shouldGetArtifactsByRefName(): void $this->assertEquals('foobar', $api->artifactsByRefName(1, 'master', 'job name')->getContents()); } - - /** - * @test - */ + #[Test] public function shouldGetArtifactByRefName(): void { $returnedStream = new Response(200, [], 'foobar'); @@ -192,10 +168,7 @@ public function shouldGetArtifactByRefName(): void $this->assertEquals('foobar', $api->artifactByRefName(1, 'master', 'job name', 'artifact_path')->getContents()); } - - /** - * @test - */ + #[Test] public function shouldGetTrace(): void { $expectedString = 'some trace'; @@ -208,10 +181,7 @@ public function shouldGetTrace(): void $this->assertEquals($expectedString, $api->trace(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldCancel(): void { $expectedArray = ['id' => 3, 'name' => 'A job']; @@ -225,10 +195,7 @@ public function shouldCancel(): void $this->assertEquals($expectedArray, $api->cancel(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldRetry(): void { $expectedArray = ['id' => 3, 'name' => 'A job']; @@ -242,10 +209,7 @@ public function shouldRetry(): void $this->assertEquals($expectedArray, $api->retry(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldErase(): void { $expectedArray = ['id' => 3, 'name' => 'A job']; @@ -259,10 +223,7 @@ public function shouldErase(): void $this->assertEquals($expectedArray, $api->erase(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldKeepArtifacts(): void { $expectedArray = ['id' => 3, 'name' => 'A job']; @@ -276,10 +237,7 @@ public function shouldKeepArtifacts(): void $this->assertEquals($expectedArray, $api->keepArtifacts(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldPlay(): void { $expectedArray = ['id' => 3, 'name' => 'A job']; diff --git a/tests/Api/KeysTest.php b/tests/Api/KeysTest.php index f148bc73..8509a5f2 100644 --- a/tests/Api/KeysTest.php +++ b/tests/Api/KeysTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Keys; class KeysTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldShowKey(): void { $expectedArray = ['id' => 1, 'title' => 'A key', 'key' => 'ssh-rsa key', 'created_at' => '2016-01-01T01:00:00.000Z']; diff --git a/tests/Api/MergeRequestsTest.php b/tests/Api/MergeRequestsTest.php index 44a376e0..aaed46d9 100644 --- a/tests/Api/MergeRequestsTest.php +++ b/tests/Api/MergeRequestsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\MergeRequests; class MergeRequestsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAll(): void { $expectedArray = $this->getMultipleMergeRequestsData(); @@ -34,10 +33,7 @@ public function shouldGetAll(): void $this->assertEquals($expectedArray, $api->all(1)); } - - /** - * @test - */ + #[Test] public function shouldGetAllWithNoProject(): void { $expectedArray = $this->getMultipleMergeRequestsData(); @@ -51,10 +47,7 @@ public function shouldGetAllWithNoProject(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldGetAllWithParams(): void { $expectedArray = $this->getMultipleMergeRequestsData(); @@ -98,10 +91,7 @@ public function shouldGetAllWithParams(): void 'approved_by_ids' => [1], ])); } - - /** - * @test - */ + #[Test] public function shouldGetAllWithDateTimeParams(): void { $expectedArray = $this->getMultipleMergeRequestsData(); @@ -126,10 +116,7 @@ public function shouldGetAllWithDateTimeParams(): void $api->all(1, ['created_after' => $createdAfter, 'created_before' => $createdBefore]) ); } - - /** - * @test - */ + #[Test] public function shouldShowMergeRequest(): void { $expectedArray = ['id' => 2, 'name' => 'A merge request']; @@ -143,10 +130,7 @@ public function shouldShowMergeRequest(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldShowMergeRequestWithOptionalParameters(): void { $expectedArray = [ @@ -168,10 +152,7 @@ public function shouldShowMergeRequestWithOptionalParameters(): void 'include_rebase_in_progress' => true, ])); } - - /** - * @test - */ + #[Test] public function shouldCreateMergeRequestWithoutOptionalParams(): void { $expectedArray = ['id' => 3, 'title' => 'Merge Request']; @@ -189,10 +170,7 @@ public function shouldCreateMergeRequestWithoutOptionalParams(): void $this->assertEquals($expectedArray, $api->create(1, 'develop', 'master', 'Merge Request')); } - - /** - * @test - */ + #[Test] public function shouldCreateMergeRequestWithOptionalParams(): void { $expectedArray = ['id' => 3, 'title' => 'Merge Request']; @@ -223,10 +201,7 @@ public function shouldCreateMergeRequestWithOptionalParams(): void ) ); } - - /** - * @test - */ + #[Test] public function shouldUpdateMergeRequest(): void { $expectedArray = ['id' => 2, 'title' => 'Updated title']; @@ -244,10 +219,7 @@ public function shouldUpdateMergeRequest(): void 'state_event' => 'close', ])); } - - /** - * @test - */ + #[Test] public function shouldMergeMergeRequest(): void { $expectedArray = ['id' => 2, 'title' => 'Updated title']; @@ -261,10 +233,7 @@ public function shouldMergeMergeRequest(): void $this->assertEquals($expectedArray, $api->merge(1, 2, ['merge_commit_message' => 'Accepted'])); } - - /** - * @test - */ + #[Test] public function shouldGetNotes(): void { $expectedArray = [ @@ -281,10 +250,7 @@ public function shouldGetNotes(): void $this->assertEquals($expectedArray, $api->showNotes(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetNote(): void { $expectedArray = ['id' => 3, 'body' => 'A new note']; @@ -298,10 +264,7 @@ public function shouldGetNote(): void $this->assertEquals($expectedArray, $api->showNote(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldCreateNote(): void { $expectedArray = ['id' => 3, 'body' => 'A new note']; @@ -315,10 +278,7 @@ public function shouldCreateNote(): void $this->assertEquals($expectedArray, $api->addNote(1, 2, 'A new note')); } - - /** - * @test - */ + #[Test] public function shouldUpdateNote(): void { $expectedArray = ['id' => 3, 'body' => 'An edited comment']; @@ -332,10 +292,7 @@ public function shouldUpdateNote(): void $this->assertEquals($expectedArray, $api->updateNote(1, 2, 3, 'An edited comment')); } - - /** - * @test - */ + #[Test] public function shouldRemoveNote(): void { $expectedBool = true; @@ -348,10 +305,7 @@ public function shouldRemoveNote(): void $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetMergeRequestParticipants(): void { $expectedArray = [ @@ -382,10 +336,7 @@ public function shouldGetMergeRequestParticipants(): void $this->assertEquals($expectedArray, $api->showParticipants(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetMergeRequestChanges(): void { $expectedArray = ['id' => 1, 'title' => 'A merge request']; @@ -399,10 +350,7 @@ public function shouldGetMergeRequestChanges(): void $this->assertEquals($expectedArray, $api->changes(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetMergeRequestDiscussions(): void { $expectedArray = [ @@ -419,10 +367,7 @@ public function shouldGetMergeRequestDiscussions(): void $this->assertEquals($expectedArray, $api->showDiscussions(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetMergeRequestDiscussion(): void { $expectedArray = ['id' => 'abc', 'body' => 'A discussion']; @@ -436,10 +381,7 @@ public function shouldGetMergeRequestDiscussion(): void $this->assertEquals($expectedArray, $api->showDiscussion(1, 2, 'abc')); } - - /** - * @test - */ + #[Test] public function shouldCreateDiscussion(): void { $expectedArray = ['id' => 'abc', 'body' => 'A new discussion']; @@ -453,10 +395,7 @@ public function shouldCreateDiscussion(): void $this->assertEquals($expectedArray, $api->addDiscussion(1, 2, ['body' => 'A new discussion'])); } - - /** - * @test - */ + #[Test] public function shouldResolveDiscussion(): void { $expectedArray = ['id' => 'abc', 'resolved' => true]; @@ -470,10 +409,7 @@ public function shouldResolveDiscussion(): void $this->assertEquals($expectedArray, $api->resolveDiscussion(1, 2, 'abc', true)); } - - /** - * @test - */ + #[Test] public function shouldUnresolveDiscussion(): void { $expectedArray = ['id' => 'abc', 'resolved' => false]; @@ -487,10 +423,7 @@ public function shouldUnresolveDiscussion(): void $this->assertEquals($expectedArray, $api->resolveDiscussion(1, 2, 'abc', false)); } - - /** - * @test - */ + #[Test] public function shouldCreateDiscussionNote(): void { $expectedArray = ['id' => 3, 'body' => 'A new discussion note']; @@ -504,10 +437,7 @@ public function shouldCreateDiscussionNote(): void $this->assertEquals($expectedArray, $api->addDiscussionNote(1, 2, 'abc', 'A new discussion note')); } - - /** - * @test - */ + #[Test] public function shouldUpdateDiscussionNote(): void { $expectedArray = ['id' => 3, 'body' => 'An edited discussion note']; @@ -521,10 +451,7 @@ public function shouldUpdateDiscussionNote(): void $this->assertEquals($expectedArray, $api->updateDiscussionNote(1, 2, 'abc', 3, ['body' => 'An edited discussion note'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveDiscussionNote(): void { $expectedBool = true; @@ -537,10 +464,7 @@ public function shouldRemoveDiscussionNote(): void $this->assertEquals($expectedBool, $api->removeDiscussionNote(1, 2, 'abc', 3)); } - - /** - * @test - */ + #[Test] public function shouldGetIssuesClosedByMergeRequest(): void { $expectedArray = ['id' => 1, 'title' => 'A merge request']; @@ -554,10 +478,7 @@ public function shouldGetIssuesClosedByMergeRequest(): void $this->assertEquals($expectedArray, $api->closesIssues(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetMergeRequestByIid(): void { $expectedArray = ['id' => 1, 'title' => 'A merge request']; @@ -571,10 +492,7 @@ public function shouldGetMergeRequestByIid(): void $this->assertEquals($expectedArray, $api->all(1, ['iids' => [2]])); } - - /** - * @test - */ + #[Test] public function shouldApproveMergeRequest(): void { $expectedArray = ['id' => 1, 'title' => 'Approvals API']; @@ -588,10 +506,7 @@ public function shouldApproveMergeRequest(): void $this->assertEquals($expectedArray, $api->approve(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldUnApproveMergeRequest(): void { $expectedArray = ['id' => 1, 'title' => 'Approvals API']; @@ -605,10 +520,7 @@ public function shouldUnApproveMergeRequest(): void $this->assertEquals($expectedArray, $api->unapprove(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetMergeRequestApprovals(): void { $expectedArray = ['id' => 1, 'title' => 'Approvals API']; @@ -622,10 +534,7 @@ public function shouldGetMergeRequestApprovals(): void $this->assertEquals($expectedArray, $api->all(1, ['iids' => [2]])); } - - /** - * @test - */ + #[Test] public function shouldIssueMergeRequestAwardEmoji(): void { $expectedArray = [ @@ -642,10 +551,7 @@ public function shouldIssueMergeRequestAwardEmoji(): void $this->assertEquals($expectedArray, $api->awardEmoji(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldRevokeMergeRequestAwardEmoji(): void { $expectedBool = true; @@ -658,10 +564,7 @@ public function shouldRevokeMergeRequestAwardEmoji(): void $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shoudGetApprovalState(): void { $expectedArray = [ @@ -677,10 +580,7 @@ public function shoudGetApprovalState(): void $this->assertEquals($expectedArray, $api->approvalState(1, 2)); } - - /** - * @test - */ + #[Test] public function shoudGetLevelRules(): void { $expectedArray = [ @@ -707,10 +607,7 @@ public function shoudGetLevelRules(): void $this->assertEquals($expectedArray, $api->levelRules(1, 2)); } - - /** - * @test - */ + #[Test] public function shoudCreateLevelRuleWithoutOptionalParameters(): void { $expectedArray = [ @@ -741,10 +638,7 @@ public function shoudCreateLevelRuleWithoutOptionalParameters(): void $this->assertEquals($expectedArray, $api->createLevelRule(1, 2, 'Foo', 3)); } - - /** - * @test - */ + #[Test] public function shoudCreateLevelRuleWithOptionalParameters(): void { $expectedArray = [ @@ -780,10 +674,7 @@ public function shoudCreateLevelRuleWithOptionalParameters(): void 'group_ids' => [104121], ])); } - - /** - * @test - */ + #[Test] public function shoudUpdateLevelRuleWithoutOptionalParameters(): void { $expectedArray = [ @@ -814,10 +705,7 @@ public function shoudUpdateLevelRuleWithoutOptionalParameters(): void $this->assertEquals($expectedArray, $api->updateLevelRule(1, 2, 20892835, 'Foo', 3)); } - - /** - * @test - */ + #[Test] public function shoudUpdateLevelRuleWithOptionalParameters(): void { $expectedArray = [ @@ -853,10 +741,7 @@ public function shoudUpdateLevelRuleWithOptionalParameters(): void 'group_ids' => [104121], ])); } - - /** - * @test - */ + #[Test] public function shoudDeleteLevelRule(): void { $expectedValue = true; @@ -882,10 +767,7 @@ protected function getApiClass() { return MergeRequests::class; } - - /** - * @test - */ + #[Test] public function shouldRebaseMergeRequest(): void { $expectedArray = ['rebase_in_progress' => true]; diff --git a/tests/Api/MilestonesTest.php b/tests/Api/MilestonesTest.php index bb36c981..696ce965 100644 --- a/tests/Api/MilestonesTest.php +++ b/tests/Api/MilestonesTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Milestones; class MilestonesTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllMilestones(): void { $expectedArray = [ @@ -37,10 +36,7 @@ public function shouldGetAllMilestones(): void $this->assertEquals($expectedArray, $api->all(1)); } - - /** - * @test - */ + #[Test] public function shouldShowMilestone(): void { $expectedArray = ['id' => 1, 'name' => 'A milestone']; @@ -54,10 +50,7 @@ public function shouldShowMilestone(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldCreateMilestone(): void { $expectedArray = ['id' => 3, 'title' => 'A new milestone']; @@ -71,10 +64,7 @@ public function shouldCreateMilestone(): void $this->assertEquals($expectedArray, $api->create(1, ['description' => 'Some text', 'title' => 'A new milestone'])); } - - /** - * @test - */ + #[Test] public function shouldUpdateMilestone(): void { $expectedArray = ['id' => 3, 'title' => 'Updated milestone']; @@ -88,10 +78,7 @@ public function shouldUpdateMilestone(): void $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated milestone', 'due_date' => '2015-04-01', 'state_event' => 'close'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveMilestone(): void { $expectedBool = true; @@ -104,10 +91,7 @@ public function shouldRemoveMilestone(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetMilestonesIssues(): void { $expectedArray = [ @@ -124,10 +108,7 @@ public function shouldGetMilestonesIssues(): void $this->assertEquals($expectedArray, $api->issues(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetMilestonesMergeRequests(): void { $expectedArray = [ diff --git a/tests/Api/PackagesTest.php b/tests/Api/PackagesTest.php index a269aae6..0e71a5d6 100644 --- a/tests/Api/PackagesTest.php +++ b/tests/Api/PackagesTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Packages; final class PackagesTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllPackages(): void { $expectedArray = [ @@ -47,10 +46,7 @@ public function shouldGetAllPackages(): void $this->assertEquals($expectedArray, $api->all(1)); } - - /** - * @test - */ + #[Test] public function shouldShowPackage(): void { $expectedArray = [ @@ -65,10 +61,7 @@ public function shouldShowPackage(): void $this->assertEquals($expectedArray, $api->show(1, 1)); } - - /** - * @test - */ + #[Test] public function shouldGetAllPackageFiles(): void { $expectedArray = [ @@ -85,10 +78,7 @@ public function shouldGetAllPackageFiles(): void $this->assertEquals($expectedArray, $api->allFiles(1, 1)); } - - /** - * @test - */ + #[Test] public function shouldRemovePackage(): void { $expectedBool = true; @@ -101,10 +91,7 @@ public function shouldRemovePackage(): void $this->assertEquals($expectedBool, $api->remove(1, 1)); } - - /** - * @test - */ + #[Test] public function shouldRemovePackageFile(): void { $expectedBool = true; diff --git a/tests/Api/ProjectNamespacesTest.php b/tests/Api/ProjectNamespacesTest.php index 2e1f03a0..32af924b 100644 --- a/tests/Api/ProjectNamespacesTest.php +++ b/tests/Api/ProjectNamespacesTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ProjectNamespaces; class ProjectNamespacesTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllNamespaces(): void { $expectedArray = [ @@ -37,10 +36,7 @@ public function shouldGetAllNamespaces(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldShowNamespace(): void { $expectedArray = ['id' => 1, 'name' => 'internal']; diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index f4dcb808..f5ee3cf0 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -14,14 +14,16 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use DateTime; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Projects; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\DataProvider; class ProjectsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllProjects(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -30,10 +32,7 @@ public function shouldGetAllProjects(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldGetAllProjectsSortedByName(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -49,10 +48,7 @@ public function shouldGetAllProjectsSortedByName(): void $api->all(['page' => 1, 'per_page' => 5, 'order_by' => 'name', 'sort' => 'asc']) ); } - - /** - * @test - */ + #[Test] public function shouldNotNeedPaginationWhenGettingProjects(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -65,10 +61,7 @@ public function shouldNotNeedPaginationWhenGettingProjects(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldGetAccessibleProjects(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -77,10 +70,7 @@ public function shouldGetAccessibleProjects(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldGetOwnedProjects(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -89,10 +79,7 @@ public function shouldGetOwnedProjects(): void $this->assertEquals($expectedArray, $api->all(['owned' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetNotArchivedProjects(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -101,12 +88,8 @@ public function shouldGetNotArchivedProjects(): void $this->assertEquals($expectedArray, $api->all(['archived' => false])); } - - /** - * @test - * - * @dataProvider possibleAccessLevels - */ + #[Test] + #[DataProvider('possibleAccessLevels')] public function shouldGetProjectsWithMinimumAccessLevel($level): void { $expectedArray = $this->getMultipleProjectsData(); @@ -115,10 +98,7 @@ public function shouldGetProjectsWithMinimumAccessLevel($level): void $this->assertEquals($expectedArray, $api->all(['min_access_level' => $level])); } - - /** - * @test - */ + #[Test] public function shouldSearchProjects(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -126,10 +106,7 @@ public function shouldSearchProjects(): void $api = $this->getMultipleProjectsRequestMock('projects', $expectedArray, ['search' => 'a project']); $this->assertEquals($expectedArray, $api->all(['search' => 'a project'])); } - - /** - * @test - */ + #[Test] public function shouldSearchProjectsWithNamespace(): void { $expectedArray = $this->getMultipleProjectsDataWithNamespace(); @@ -137,10 +114,7 @@ public function shouldSearchProjectsWithNamespace(): void $api = $this->getMultipleProjectsRequestMock('projects', $expectedArray, ['search' => 'a_project', 'search_namespaces' => 'true']); $this->assertEquals($expectedArray, $api->all(['search' => 'a_project', 'search_namespaces' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetProjectsAfterId(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -149,10 +123,7 @@ public function shouldGetProjectsAfterId(): void $this->assertEquals($expectedArray, $api->all(['id_after' => 0])); } - - /** - * @test - */ + #[Test] public function shouldGetProjectsWithLastActivityAfter(): void { $unixEpochDateTime = new DateTime('@0'); @@ -163,10 +134,7 @@ public function shouldGetProjectsWithLastActivityAfter(): void $this->assertEquals($expectedArray, $api->all(['last_activity_after' => $unixEpochDateTime])); } - - /** - * @test - */ + #[Test] public function shouldGetProjectsWithLastActivityBefore(): void { $now = new DateTime(); @@ -177,10 +145,7 @@ public function shouldGetProjectsWithLastActivityBefore(): void $this->assertEquals($expectedArray, $api->all(['last_activity_before' => $now])); } - - /** - * @test - */ + #[Test] public function shouldGetProjectsWithoutFailedRepositoryChecksum(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -189,10 +154,7 @@ public function shouldGetProjectsWithoutFailedRepositoryChecksum(): void $this->assertEquals($expectedArray, $api->all(['repository_checksum_failed' => false])); } - - /** - * @test - */ + #[Test] public function shouldGetProjectsWithDefaultRepositoryStorage(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -201,10 +163,7 @@ public function shouldGetProjectsWithDefaultRepositoryStorage(): void $this->assertEquals($expectedArray, $api->all(['repository_storage' => 'default'])); } - - /** - * @test - */ + #[Test] public function shouldGetStarredProjects(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -213,10 +172,7 @@ public function shouldGetStarredProjects(): void $this->assertEquals($expectedArray, $api->all(['starred' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetProjectsWithoutFailedWikiChecksum(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -225,10 +181,7 @@ public function shouldGetProjectsWithoutFailedWikiChecksum(): void $this->assertEquals($expectedArray, $api->all(['wiki_checksum_failed' => false])); } - - /** - * @test - */ + #[Test] public function shouldGetProjectsWithCustomAttributes(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -237,10 +190,7 @@ public function shouldGetProjectsWithCustomAttributes(): void $this->assertEquals($expectedArray, $api->all(['with_custom_attributes' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetProjectsWithPhpProgrammingLanguage(): void { $expectedArray = $this->getMultipleProjectsData(); @@ -249,10 +199,7 @@ public function shouldGetProjectsWithPhpProgrammingLanguage(): void $this->assertEquals($expectedArray, $api->all(['with_programming_language' => 'php'])); } - - /** - * @test - */ + #[Test] public function shouldShowProject(): void { $expectedArray = ['id' => 1, 'name' => 'Project Name']; @@ -265,10 +212,7 @@ public function shouldShowProject(): void $this->assertEquals($expectedArray, $api->show(1)); } - - /** - * @test - */ + #[Test] public function shouldShowProjectWithStatistics(): void { $expectedArray = [ @@ -291,10 +235,7 @@ public function shouldShowProjectWithStatistics(): void $this->assertEquals($expectedArray, $api->show(1, ['statistics' => true])); } - - /** - * @test - */ + #[Test] public function shouldCreateProject(): void { $expectedArray = ['id' => 1, 'name' => 'Project Name']; @@ -309,10 +250,7 @@ public function shouldCreateProject(): void 'issues_enabled' => true, ])); } - - /** - * @test - */ + #[Test] public function shouldUpdateProject(): void { $expectedArray = ['id' => 1, 'name' => 'Updated Name']; @@ -328,10 +266,7 @@ public function shouldUpdateProject(): void 'issues_enabled' => true, ])); } - - /** - * @test - */ + #[Test] public function shouldArchiveProject(): void { $expectedArray = ['id' => 1, 'archived' => true]; @@ -344,10 +279,7 @@ public function shouldArchiveProject(): void $this->assertEquals($expectedArray, $api->archive(1)); } - - /** - * @test - */ + #[Test] public function shouldUnarchiveProject(): void { $expectedArray = ['id' => 1, 'archived' => false]; @@ -360,10 +292,7 @@ public function shouldUnarchiveProject(): void $this->assertEquals($expectedArray, $api->unarchive(1)); } - - /** - * @test - */ + #[Test] public function shouldCreateProjectForUser(): void { $expectedArray = ['id' => 1, 'name' => 'Project Name']; @@ -378,10 +307,7 @@ public function shouldCreateProjectForUser(): void 'issues_enabled' => true, ])); } - - /** - * @test - */ + #[Test] public function shouldRemoveProject(): void { $expectedBool = true; @@ -394,10 +320,7 @@ public function shouldRemoveProject(): void $this->assertEquals($expectedBool, $api->remove(1)); } - - /** - * @test - */ + #[Test] public function shouldGetPipelines(): void { $expectedArray = [ @@ -414,10 +337,7 @@ public function shouldGetPipelines(): void $this->assertEquals($expectedArray, $api->pipelines(1)); } - - /** - * @test - */ + #[Test] public function shouldGetTriggers(): void { $expectedArray = [ @@ -433,10 +353,7 @@ public function shouldGetTriggers(): void $this->assertEquals($expectedArray, $api->triggers(1)); } - - /** - * @test - */ + #[Test] public function shouldGetTrigger(): void { $expectedArray = [ @@ -600,10 +517,7 @@ public function getProjectUsersExpectedArray() ], ]; } - - /** - * @test - */ + #[Test] public function shouldGetBoards(): void { $expectedArray = $this->getProjectIssuesExpectedArray(); @@ -673,10 +587,7 @@ public function getProjectBoardsExpectedArray() ], ]; } - - /** - * @test - */ + #[Test] public function shouldGetIterations(): void { $expectedArray = [ @@ -705,10 +616,7 @@ public function shouldGetIterations(): void $this->assertEquals($expectedArray, $api->iterations(1)); } - - /** - * @test - */ + #[Test] public function shouldCreateTrigger(): void { $expectedArray = [ @@ -725,10 +633,7 @@ public function shouldCreateTrigger(): void $this->assertEquals($expectedArray, $api->createTrigger(1, 'foobar')); } - - /** - * @test - */ + #[Test] public function shouldRemoveTrigger(): void { $expectedBool = true; @@ -741,10 +646,7 @@ public function shouldRemoveTrigger(): void $this->assertEquals($expectedBool, $api->removeTrigger(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldTriggerPipeline(): void { $expectedArray = [ @@ -765,10 +667,7 @@ public function shouldTriggerPipeline(): void $this->assertEquals($expectedArray, $api->triggerPipeline(1, 'master', 'some_token', ['VAR_1' => 'value 1'])); } - - /** - * @test - */ + #[Test] public function shouldGetPipelinesWithBooleanParam(): void { $expectedArray = [ @@ -785,10 +684,7 @@ public function shouldGetPipelinesWithBooleanParam(): void $this->assertEquals($expectedArray, $api->pipelines(1, ['yaml_errors' => false])); } - - /** - * @test - */ + #[Test] public function shouldGetPipelineWithDateParam(): void { $expectedArray = [ @@ -816,10 +712,7 @@ public function shouldGetPipelineWithDateParam(): void 'updated_before' => $updated_before, ])); } - - /** - * @test - */ + #[Test] public function shouldGetPipelinesWithSHA(): void { $expectedArray = [ @@ -836,10 +729,7 @@ public function shouldGetPipelinesWithSHA(): void $this->assertEquals($expectedArray, $api->pipelines(1, ['sha' => '123'])); } - - /** - * @test - */ + #[Test] public function shouldGetPipeline(): void { $expectedArray = [ @@ -856,10 +746,7 @@ public function shouldGetPipeline(): void $this->assertEquals($expectedArray, $api->pipeline(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetPipelineJobs(): void { $expectedArray = [ @@ -876,10 +763,7 @@ public function shouldGetPipelineJobs(): void $this->assertEquals($expectedArray, $api->pipelineJobs(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetPipelineVariables(): void { $expectedArray = [ @@ -895,10 +779,7 @@ public function shouldGetPipelineVariables(): void $this->assertEquals($expectedArray, $api->pipelineVariables(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetPipelineTestReport(): void { $expectedArray = [ @@ -919,10 +800,7 @@ public function shouldGetPipelineTestReport(): void $this->assertEquals($expectedArray, $api->pipelineTestReport(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetPipelineTestReportSummary(): void { $expectedArray = [ @@ -943,10 +821,7 @@ public function shouldGetPipelineTestReportSummary(): void $this->assertEquals($expectedArray, $api->pipelineTestReportSummary(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldCreatePipeline(): void { $expectedArray = [ @@ -961,10 +836,7 @@ public function shouldCreatePipeline(): void $this->assertEquals($expectedArray, $api->createPipeline(1, 'test-pipeline')); } - - /** - * @test - */ + #[Test] public function shouldCreatePipelineWithVariables(): void { $expectedArray = [ @@ -990,10 +862,7 @@ public function shouldCreatePipelineWithVariables(): void $this->assertEquals($expectedArray, $api->createPipeline(1, 'test-pipeline', $variables)); } - - /** - * @test - */ + #[Test] public function shouldRetryPipeline(): void { $expectedArray = [ @@ -1008,10 +877,7 @@ public function shouldRetryPipeline(): void $this->assertEquals($expectedArray, $api->retryPipeline(1, 4)); } - - /** - * @test - */ + #[Test] public function shouldCancelPipeline(): void { $expectedArray = [ @@ -1026,10 +892,7 @@ public function shouldCancelPipeline(): void $this->assertEquals($expectedArray, $api->cancelPipeline(1, 6)); } - - /** - * @test - */ + #[Test] public function shouldDeletePipeline(): void { $expectedBool = true; @@ -1042,10 +905,7 @@ public function shouldDeletePipeline(): void $this->assertEquals($expectedBool, $api->deletePipeline(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetAllMembers(): void { $expectedArray = [ @@ -1061,10 +921,7 @@ public function shouldGetAllMembers(): void $this->assertEquals($expectedArray, $api->allMembers(1)); } - - /** - * @test - */ + #[Test] public function shouldGetAllMember(): void { $expectedArray = ['id' => 2, 'name' => 'Bob']; @@ -1077,10 +934,7 @@ public function shouldGetAllMember(): void $this->assertEquals($expectedArray, $api->allMember(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetMembers(): void { $expectedArray = [ @@ -1096,10 +950,7 @@ public function shouldGetMembers(): void $this->assertEquals($expectedArray, $api->members(1)); } - - /** - * @test - */ + #[Test] public function shouldGetMembersWithQuery(): void { $expectedArray = [ @@ -1114,10 +965,7 @@ public function shouldGetMembersWithQuery(): void $this->assertEquals($expectedArray, $api->members(1, ['query' => 'at'])); } - - /** - * @test - */ + #[Test] public function shouldGetMembersWithNullQuery(): void { $expectedArray = [ @@ -1133,10 +981,7 @@ public function shouldGetMembersWithNullQuery(): void $this->assertEquals($expectedArray, $api->members(1)); } - - /** - * @test - */ + #[Test] public function shouldGetMembersWithPagination(): void { $expectedArray = [ @@ -1155,10 +1000,7 @@ public function shouldGetMembersWithPagination(): void $this->assertEquals($expectedArray, $api->members(1, ['page' => 2, 'per_page' => 15])); } - - /** - * @test - */ + #[Test] public function shouldGetMember(): void { $expectedArray = ['id' => 2, 'name' => 'Matt']; @@ -1171,10 +1013,7 @@ public function shouldGetMember(): void $this->assertEquals($expectedArray, $api->member(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldAddMember(): void { $expectedArray = ['id' => 1, 'name' => 'Matt']; @@ -1187,10 +1026,7 @@ public function shouldAddMember(): void $this->assertEquals($expectedArray, $api->addMember(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldAddMemberWithExpiration(): void { // tomorrow @@ -1209,10 +1045,7 @@ public function shouldAddMemberWithExpiration(): void $this->assertEquals($expectedArray, $api->addMember(1, 3, 3, $expiration)); } - - /** - * @test - */ + #[Test] public function shouldSaveMember(): void { $expectedArray = ['id' => 1, 'name' => 'Matt']; @@ -1225,10 +1058,7 @@ public function shouldSaveMember(): void $this->assertEquals($expectedArray, $api->saveMember(1, 2, 4)); } - - /** - * @test - */ + #[Test] public function shouldSaveMemberWithExpiration(): void { // tomorrow @@ -1247,10 +1077,7 @@ public function shouldSaveMemberWithExpiration(): void $this->assertEquals($expectedArray, $api->saveMember(1, 3, 4, $expiration)); } - - /** - * @test - */ + #[Test] public function shouldRemoveMember(): void { $expectedBool = true; @@ -1263,10 +1090,7 @@ public function shouldRemoveMember(): void $this->assertEquals($expectedBool, $api->removeMember(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetHooks(): void { $expectedArray = [ @@ -1282,10 +1106,7 @@ public function shouldGetHooks(): void $this->assertEquals($expectedArray, $api->hooks(1)); } - - /** - * @test - */ + #[Test] public function shouldGetHook(): void { $expectedArray = ['id' => 2, 'name' => 'Another hook']; @@ -1298,10 +1119,7 @@ public function shouldGetHook(): void $this->assertEquals($expectedArray, $api->hook(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldAddHook(): void { $expectedArray = ['id' => 3, 'name' => 'A new hook', 'url' => 'http://www.example.com/']; @@ -1323,10 +1141,7 @@ public function shouldAddHook(): void ['push_events' => true, 'issues_events' => true, 'merge_requests_events' => true] )); } - - /** - * @test - */ + #[Test] public function shouldAddHookWithOnlyUrl(): void { $expectedArray = ['id' => 3, 'name' => 'A new hook', 'url' => 'http://www.example.com/']; @@ -1339,10 +1154,7 @@ public function shouldAddHookWithOnlyUrl(): void $this->assertEquals($expectedArray, $api->addHook(1, 'http://www.example.com/')); } - - /** - * @test - */ + #[Test] public function shouldAddHookWithoutPushEvents(): void { $expectedArray = ['id' => 3, 'name' => 'A new hook', 'url' => 'http://www.example.com/']; @@ -1355,10 +1167,7 @@ public function shouldAddHookWithoutPushEvents(): void $this->assertEquals($expectedArray, $api->addHook(1, 'http://www.example.com/', ['push_events' => false])); } - - /** - * @test - */ + #[Test] public function shouldUpdateHook(): void { $expectedArray = ['id' => 3, 'name' => 'A new hook', 'url' => 'http://www.example.com/']; @@ -1374,10 +1183,7 @@ public function shouldUpdateHook(): void $api->updateHook(1, 3, ['url' => 'http://www.example-test.com/', 'push_events' => false]) ); } - - /** - * @test - */ + #[Test] public function shouldRemoveHook(): void { $expectedBool = true; @@ -1390,10 +1196,7 @@ public function shouldRemoveHook(): void $this->assertEquals($expectedBool, $api->removeHook(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldTransfer(): void { $expectedArray = [ @@ -1410,10 +1213,7 @@ public function shouldTransfer(): void $this->assertEquals($expectedArray, $api->transfer(1, 'a_namespace')); } - - /** - * @test - */ + #[Test] public function shouldGetDeployKeys(): void { $expectedArray = [ @@ -1429,10 +1229,7 @@ public function shouldGetDeployKeys(): void $this->assertEquals($expectedArray, $api->deployKeys(1)); } - - /** - * @test - */ + #[Test] public function shouldGetDeployKey(): void { $expectedArray = ['id' => 2, 'title' => 'another-key']; @@ -1445,10 +1242,7 @@ public function shouldGetDeployKey(): void $this->assertEquals($expectedArray, $api->deployKey(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldAddKey(): void { $expectedArray = ['id' => 3, 'title' => 'new-key', 'can_push' => false]; @@ -1461,10 +1255,7 @@ public function shouldAddKey(): void $this->assertEquals($expectedArray, $api->addDeployKey(1, 'new-key', '...')); } - - /** - * @test - */ + #[Test] public function shouldAddKeyWithPushOption(): void { $expectedArray = ['id' => 3, 'title' => 'new-key', 'can_push' => true]; @@ -1477,10 +1268,7 @@ public function shouldAddKeyWithPushOption(): void $this->assertEquals($expectedArray, $api->addDeployKey(1, 'new-key', '...', true)); } - - /** - * @test - */ + #[Test] public function shouldDeleteDeployKey(): void { $expectedBool = true; @@ -1493,10 +1281,7 @@ public function shouldDeleteDeployKey(): void $this->assertEquals($expectedBool, $api->deleteDeployKey(1, 3)); } - - /** - * @test - */ + #[Test] public function shoudEnableDeployKey(): void { $expectedBool = true; @@ -1509,10 +1294,7 @@ public function shoudEnableDeployKey(): void $this->assertEquals($expectedBool, $api->enableDeployKey(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetDeployTokens(): void { $expectedArray = [ @@ -1538,10 +1320,7 @@ public function shouldGetDeployTokens(): void $this->assertEquals($expectedArray, $api->deployTokens(1)); } - - /** - * @test - */ + #[Test] public function shouldGetActiveDeployTokens(): void { $expectedArray = [ @@ -1567,10 +1346,7 @@ public function shouldGetActiveDeployTokens(): void $this->assertEquals([], $api->deployTokens(1, true)); } - - /** - * @test - */ + #[Test] public function shouldGetInactiveDeployTokens(): void { $expectedArray = [ @@ -1596,10 +1372,7 @@ public function shouldGetInactiveDeployTokens(): void $this->assertEquals([], $api->deployTokens(1, false)); } - - /** - * @test - */ + #[Test] public function shouldCreateDeployToken(): void { $expectedArray = [ @@ -1641,10 +1414,7 @@ public function shouldCreateDeployToken(): void 'expires_at' => new DateTime('2021-01-01'), ])); } - - /** - * @test - */ + #[Test] public function shouldDeleteDeployToken(): void { $expectedBool = true; @@ -1657,10 +1427,7 @@ public function shouldDeleteDeployToken(): void $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetEvents(): void { $expectedArray = [ @@ -1676,10 +1443,7 @@ public function shouldGetEvents(): void $this->assertEquals($expectedArray, $api->events(1)); } - - /** - * @test - */ + #[Test] public function shouldGetEventsWithDateTimeParams(): void { $expectedArray = [ @@ -1703,10 +1467,7 @@ public function shouldGetEventsWithDateTimeParams(): void $this->assertEquals($expectedArray, $api->events(1, ['after' => $after, 'before' => $before])); } - - /** - * @test - */ + #[Test] public function shouldGetEventsWithPagination(): void { $expectedArray = [ @@ -1725,10 +1486,7 @@ public function shouldGetEventsWithPagination(): void $this->assertEquals($expectedArray, $api->events(1, ['page' => 2, 'per_page' => 15])); } - - /** - * @test - */ + #[Test] public function shouldGetLabels(): void { $expectedArray = [ @@ -1744,10 +1502,7 @@ public function shouldGetLabels(): void $this->assertEquals($expectedArray, $api->labels(1)); } - - /** - * @test - */ + #[Test] public function shouldAddLabel(): void { $expectedArray = ['name' => 'bug', 'color' => '#000000']; @@ -1760,10 +1515,7 @@ public function shouldAddLabel(): void $this->assertEquals($expectedArray, $api->addLabel(1, ['name' => 'wont-fix', 'color' => '#ffffff'])); } - - /** - * @test - */ + #[Test] public function shouldUpdateLabel(): void { $expectedArray = ['name' => 'bug', 'color' => '#00ffff']; @@ -1779,10 +1531,7 @@ public function shouldUpdateLabel(): void $api->updateLabel(1, 123, ['new_name' => 'big-bug', 'color' => '#00ffff']) ); } - - /** - * @test - */ + #[Test] public function shouldRemoveLabel(): void { $expectedBool = true; @@ -1795,10 +1544,7 @@ public function shouldRemoveLabel(): void $this->assertEquals($expectedBool, $api->removeLabel(1, 456)); } - - /** - * @test - */ + #[Test] public function shouldGetLanguages(): void { $expectedArray = ['php' => 100]; @@ -1809,10 +1555,7 @@ public function shouldGetLanguages(): void $this->assertEquals($expectedArray, $api->languages(1)); } - - /** - * @test - */ + #[Test] public function shouldForkWithNamespace(): void { $expectedArray = [ @@ -1829,10 +1572,7 @@ public function shouldForkWithNamespace(): void 'namespace' => 'new_namespace', ])); } - - /** - * @test - */ + #[Test] public function shouldForkWithNamespaceAndPath(): void { $expectedArray = [ @@ -1851,10 +1591,7 @@ public function shouldForkWithNamespaceAndPath(): void 'path' => 'new_path', ])); } - - /** - * @test - */ + #[Test] public function shouldForkWithNamespaceAndPathAndName(): void { $expectedArray = [ @@ -1875,10 +1612,7 @@ public function shouldForkWithNamespaceAndPathAndName(): void 'name' => 'new_name', ])); } - - /** - * @test - */ + #[Test] public function shouldCreateForkRelation(): void { $expectedArray = ['project_id' => 1, 'forked_id' => 2]; @@ -1891,10 +1625,7 @@ public function shouldCreateForkRelation(): void $this->assertEquals($expectedArray, $api->createForkRelation(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldRemoveForkRelation(): void { $expectedBool = true; @@ -1907,10 +1638,7 @@ public function shouldRemoveForkRelation(): void $this->assertEquals($expectedBool, $api->removeForkRelation(2)); } - - /** - * @test - */ + #[Test] public function shouldGetForks(): void { $expectedArray = [ @@ -1935,10 +1663,7 @@ public function shouldGetForks(): void $this->assertEquals($expectedArray, $api->forks(1)); } - - /** - * @test - */ + #[Test] public function shouldGetForksUsingParameters(): void { $expectedArray = [ @@ -2000,10 +1725,7 @@ public function shouldGetForksUsingParameters(): void 'with_custom_attributes' => true, ])); } - - /** - * @test - */ + #[Test] public function shouldSetService(): void { $expectedBool = true; @@ -2016,10 +1738,7 @@ public function shouldSetService(): void $this->assertEquals($expectedBool, $api->setService(1, 'hipchat', ['param' => 'value'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveService(): void { $expectedBool = true; @@ -2032,10 +1751,7 @@ public function shouldRemoveService(): void $this->assertEquals($expectedBool, $api->removeService(1, 'hipchat')); } - - /** - * @test - */ + #[Test] public function shouldGetVariables(): void { $expectedArray = [ @@ -2051,10 +1767,7 @@ public function shouldGetVariables(): void $this->assertEquals($expectedArray, $api->variables(1)); } - - /** - * @test - */ + #[Test] public function shouldGetVariable(): void { $expectedArray = ['key' => 'ftp_username', 'value' => 'ftp']; @@ -2067,10 +1780,7 @@ public function shouldGetVariable(): void $this->assertEquals($expectedArray, $api->variable(1, 'ftp_username')); } - - /** - * @test - */ + #[Test] public function shouldAddVariable(): void { $expectedKey = 'ftp_port'; @@ -2089,10 +1799,7 @@ public function shouldAddVariable(): void $this->assertEquals($expectedArray, $api->addVariable(1, $expectedKey, $expectedValue)); } - - /** - * @test - */ + #[Test] public function shouldAddVariableWithProtected(): void { $expectedArray = [ @@ -2109,10 +1816,7 @@ public function shouldAddVariableWithProtected(): void $this->assertEquals($expectedArray, $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); } - - /** - * @test - */ + #[Test] public function shouldAddVariableWithEnvironment(): void { $expectedArray = [ @@ -2132,10 +1836,7 @@ public function shouldAddVariableWithEnvironment(): void $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging') ); } - - /** - * @test - */ + #[Test] public function shouldAddVariableWithProtectionAndEnvironment(): void { $expectedArray = [ @@ -2156,10 +1857,7 @@ public function shouldAddVariableWithProtectionAndEnvironment(): void $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true, 'staging') ); } - - /** - * @test - */ + #[Test] public function shouldAddVariableWithEnvironmentAndVariableType(): void { $expectedArray = [ @@ -2180,10 +1878,7 @@ public function shouldAddVariableWithEnvironmentAndVariableType(): void $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging', ['variable_type' => 'file']) ); } - - /** - * @test - */ + #[Test] public function shouldAddVariableWithEnvironmentFromParameterList(): void { $expectedArray = [ @@ -2203,10 +1898,7 @@ public function shouldAddVariableWithEnvironmentFromParameterList(): void $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging', ['environment_scope' => 'production']) ); } - - /** - * @test - */ + #[Test] public function shouldUpdateVariable(): void { $expectedKey = 'ftp_port'; @@ -2225,10 +1917,7 @@ public function shouldUpdateVariable(): void $this->assertEquals($expectedArray, $api->updateVariable(1, $expectedKey, $expectedValue)); } - - /** - * @test - */ + #[Test] public function shouldUpdateVariableWithProtected(): void { $expectedArray = [ @@ -2245,10 +1934,7 @@ public function shouldUpdateVariableWithProtected(): void $this->assertEquals($expectedArray, $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); } - - /** - * @test - */ + #[Test] public function shouldUpdateVariableWithEnvironment(): void { $expectedArray = [ @@ -2271,10 +1957,7 @@ public function shouldUpdateVariableWithEnvironment(): void $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging') ); } - - /** - * @test - */ + #[Test] public function shouldUpdateVariableWithProtectedAndEnvironment(): void { $expectedArray = [ @@ -2298,10 +1981,7 @@ public function shouldUpdateVariableWithProtectedAndEnvironment(): void $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true, 'staging') ); } - - /** - * @test - */ + #[Test] public function shouldUpdateVariableWithEnvironmentAndVariableType(): void { $expectedArray = [ @@ -2325,10 +2005,7 @@ public function shouldUpdateVariableWithEnvironmentAndVariableType(): void $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging', ['variable_type' => 'file']) ); } - - /** - * @test - */ + #[Test] public function shouldUpdateVariableWithEnvironmentFromParameterList(): void { $expectedArray = [ @@ -2351,10 +2028,7 @@ public function shouldUpdateVariableWithEnvironmentFromParameterList(): void $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging', ['environment_scope' => 'production']) ); } - - /** - * @test - */ + #[Test] public function shouldRemoveVariable(): void { $expectedBool = true; @@ -2378,10 +2052,7 @@ protected function getMultipleProjectsRequestMock($path, $expectedArray = [], $e return $api; } - - /** - * @test - */ + #[Test] public function shouldGetDeployments(): void { $expectedArray = [ @@ -2397,10 +2068,7 @@ public function shouldGetDeployments(): void $this->assertEquals($expectedArray, $api->deployments(1)); } - - /** - * @test - */ + #[Test] public function shouldGetDeploymentsWithPagination(): void { $expectedArray = [ @@ -2419,10 +2087,7 @@ public function shouldGetDeploymentsWithPagination(): void $this->assertEquals($expectedArray, $api->deployments(1, ['page' => 2, 'per_page' => 15])); } - - /** - * @test - */ + #[Test] public function shouldGetDeploymentsSorted(): void { $expectedArray = [ @@ -2453,10 +2118,7 @@ public function shouldGetDeploymentsSorted(): void $this->assertEquals(\array_reverse($expectedArray), $api->deployments(1, ['order_by' => 'id', 'sort' => 'desc'])); } - - /** - * @test - */ + #[Test] public function shouldGetDeploymentsFiltered(): void { $expectedArray = [ @@ -2526,10 +2188,7 @@ public function getBadgeExpectedArray() ], ]; } - - /** - * @test - */ + #[Test] public function shouldGetBadges(): void { $expectedArray = $this->getBadgeExpectedArray(); @@ -2542,10 +2201,7 @@ public function shouldGetBadges(): void $this->assertEquals($expectedArray, $api->badges(1)); } - - /** - * @test - */ + #[Test] public function shouldGetBadge(): void { $expectedBadgesArray = $this->getBadgeExpectedArray(); @@ -2561,10 +2217,7 @@ public function shouldGetBadge(): void $this->assertEquals($expectedArray, $api->badge(1, 1)); } - - /** - * @test - */ + #[Test] public function shouldAddBadge(): void { $link_url = 'http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}'; @@ -2586,10 +2239,7 @@ public function shouldAddBadge(): void $api->addBadge(1, ['link_url' => $link_url, 'image_url' => $image_url]) ); } - - /** - * @test - */ + #[Test] public function shouldUpdateBadge(): void { $image_url = 'https://shields.io/my/new/badge'; @@ -2605,10 +2255,7 @@ public function shouldUpdateBadge(): void $this->assertEquals($expectedArray, $api->updateBadge(1, 2, ['image_url' => $image_url])); } - - /** - * @test - */ + #[Test] public function shouldRemoveBadge(): void { $expectedBool = true; @@ -2621,10 +2268,7 @@ public function shouldRemoveBadge(): void $this->assertEquals($expectedBool, $api->removeBadge(1, 1)); } - - /** - * @test - */ + #[Test] public function shouldAddProtectedBranch(): void { $expectedArray = [ @@ -2648,10 +2292,7 @@ public function shouldAddProtectedBranch(): void ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addProtectedBranch(1, ['name' => 'master', 'push_access_level' => 0, 'merge_access_level' => 30])); } - - /** - * @test - */ + #[Test] public function shouldRemoveProtectedBranch(): void { $expectedBool = true; @@ -2665,10 +2306,7 @@ public function shouldRemoveProtectedBranch(): void $this->assertEquals($expectedBool, $api->deleteProtectedBranch(1, 'test-branch')); } - - /** - * @test - */ + #[Test] public function shoudGetApprovalsConfiguration(): void { $expectedArray = [ @@ -2690,10 +2328,7 @@ public function shoudGetApprovalsConfiguration(): void $this->assertEquals($expectedArray, $api->approvalsConfiguration(1)); } - - /** - * @test - */ + #[Test] public function shoudGetApprovalsRules(): void { $expectedArray = [ @@ -2718,10 +2353,7 @@ public function shoudGetApprovalsRules(): void $this->assertEquals($expectedArray, $api->approvalsRules(1)); } - - /** - * @test - */ + #[Test] public function shoudCreateApprovalsRule(): void { $expectedArray = [ @@ -2743,10 +2375,7 @@ public function shoudCreateApprovalsRule(): void 'rule_type' => 'any_approver', ])); } - - /** - * @test - */ + #[Test] public function shoudUpdateApprovalsRule(): void { $expectedArray = [ @@ -2765,10 +2394,7 @@ public function shoudUpdateApprovalsRule(): void 'name' => 'Updated Name', ])); } - - /** - * @test - */ + #[Test] public function shoudDeleteApprovalsRule(): void { $expectedBool = true; @@ -2781,10 +2407,7 @@ public function shoudDeleteApprovalsRule(): void $this->assertEquals($expectedBool, $api->deleteApprovalsRule(1, 1)); } - - /** - * @test - */ + #[Test] public function shouldDeleteAllMergedBranches(): void { $expectedBool = true; @@ -2797,10 +2420,7 @@ public function shouldDeleteAllMergedBranches(): void $this->assertEquals($expectedBool, $api->deleteAllMergedBranches(1)); } - - /** - * @test - */ + #[Test] public function shouldGetProtectedBranches(): void { $expectedArray = [ @@ -2832,10 +2452,7 @@ public function shouldGetProtectedBranches(): void $this->assertEquals($expectedArray, $api->protectedBranches(1)); } - - /** - * @test - */ + #[Test] public function shouldGetProjectAccessTokens(): void { $expectedArray = [ @@ -2861,10 +2478,7 @@ public function shouldGetProjectAccessTokens(): void $this->assertEquals($expectedArray, $api->projectAccessTokens(1)); } - - /** - * @test - */ + #[Test] public function shouldGetProjectAccessToken(): void { $expectedArray = [ @@ -2888,10 +2502,7 @@ public function shouldGetProjectAccessToken(): void $this->assertEquals($expectedArray, $api->projectAccessToken(1, 42)); } - - /** - * @test - */ + #[Test] public function shouldCreateProjectAccessToken(): void { $expectedArray = [ @@ -2935,10 +2546,7 @@ public function shouldCreateProjectAccessToken(): void 'expires_at' => new DateTime('2021-01-31'), ])); } - - /** - * @test - */ + #[Test] public function shouldDeleteProjectAccessToken(): void { $expectedBool = true; @@ -2951,10 +2559,7 @@ public function shouldDeleteProjectAccessToken(): void $this->assertEquals($expectedBool, $api->deleteProjectAccessToken(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldUploadAvatar(): void { $emptyPNGContents = 'iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAACYElEQVR42u3UMQEAAAjDMFCO9GEAByQSerQrmQJeagMAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwADAAAwADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMAAzAAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwADMAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAMAAZwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAwAAAAwAMADAAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMADAAAADAAwAMAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAMAAAAMADAAwAOCybrx+H1CTHLYAAAAASUVORK5CYII='; @@ -2970,10 +2575,7 @@ public function shouldUploadAvatar(): void $this->assertEquals($expectedArray, $api->uploadAvatar(1, $fileName)); \unlink($fileName); } - - /** - * @test - */ + #[Test] public function shouldAddProtectedTag(): void { $expectedArray = [ @@ -2995,10 +2597,7 @@ public function shouldAddProtectedTag(): void ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addProtectedTag(1, $params)); } - - /** - * @test - */ + #[Test] public function shouldRemoveProtectedTag(): void { $expectedBool = true; @@ -3017,10 +2616,7 @@ protected function getApiClass() { return Projects::class; } - - /** - * @test - */ + #[Test] public function shouldSearchGroups(): void { $expectedArray = [ diff --git a/tests/Api/RepositoriesTest.php b/tests/Api/RepositoriesTest.php index 0b59ae8d..d437c730 100644 --- a/tests/Api/RepositoriesTest.php +++ b/tests/Api/RepositoriesTest.php @@ -14,13 +14,14 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Repositories; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\DataProvider; class RepositoriesTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetBranches(): void { $expectedArray = [ @@ -37,10 +38,7 @@ public function shouldGetBranches(): void $this->assertEquals($expectedArray, $api->branches(1, ['search' => '^term'])); } - - /** - * @test - */ + #[Test] public function shouldGetBranch(): void { $expectedArray = ['name' => 'master']; @@ -54,10 +52,7 @@ public function shouldGetBranch(): void $this->assertEquals($expectedArray, $api->branch(1, 'master')); } - - /** - * @test - */ + #[Test] public function shouldCreateBranch(): void { $expectedArray = ['name' => 'feature']; @@ -71,10 +66,7 @@ public function shouldCreateBranch(): void $this->assertEquals($expectedArray, $api->createBranch(1, 'feature', 'master')); } - - /** - * @test - */ + #[Test] public function shouldDeleteBranch(): void { $expectedBool = true; @@ -87,10 +79,7 @@ public function shouldDeleteBranch(): void $this->assertEquals($expectedBool, $api->deleteBranch(1, 'feature/TEST-15')); } - - /** - * @test - */ + #[Test] public function shouldProtectBranch(): void { $expectedArray = ['name' => 'master']; @@ -104,10 +93,7 @@ public function shouldProtectBranch(): void $this->assertEquals($expectedArray, $api->protectBranch(1, 'master')); } - - /** - * @test - */ + #[Test] public function shouldProtectBranchWithPermissions(): void { $expectedArray = ['name' => 'master']; @@ -121,10 +107,7 @@ public function shouldProtectBranchWithPermissions(): void $this->assertEquals($expectedArray, $api->protectBranch(1, 'master', true, true)); } - - /** - * @test - */ + #[Test] public function shouldUnprotectBranch(): void { $expectedArray = ['name' => 'master']; @@ -138,10 +121,7 @@ public function shouldUnprotectBranch(): void $this->assertEquals($expectedArray, $api->unprotectBranch(1, 'master')); } - - /** - * @test - */ + #[Test] public function shouldGetTags(): void { $expectedArray = [ @@ -158,10 +138,7 @@ public function shouldGetTags(): void $this->assertEquals($expectedArray, $api->tags(1, ['search' => '^term'])); } - - /** - * @test - */ + #[Test] public function shouldCreateTag(): void { $expectedArray = ['name' => '1.0']; @@ -179,10 +156,7 @@ public function shouldCreateTag(): void $this->assertEquals($expectedArray, $api->createTag(1, '1.0', 'abcd1234', '1.0 release')); } - - /** - * @test - */ + #[Test] public function shouldCreateRelease(): void { $project_id = 1; @@ -204,10 +178,7 @@ public function shouldCreateRelease(): void $this->assertEquals($expectedArray, $api->createRelease($project_id, $tagName, $description)); } - - /** - * @test - */ + #[Test] public function shouldUpdateRelease(): void { $project_id = 1; @@ -229,10 +200,7 @@ public function shouldUpdateRelease(): void $this->assertEquals($expectedArray, $api->updateRelease($project_id, $tagName, $description)); } - - /** - * @test - */ + #[Test] public function shouldGetReleases(): void { $project_id = 1; @@ -254,10 +222,7 @@ public function shouldGetReleases(): void $this->assertEquals($expectedArray, $api->releases($project_id)); } - - /** - * @test - */ + #[Test] public function shouldGetCommits(): void { $expectedArray = [ @@ -274,10 +239,7 @@ public function shouldGetCommits(): void $this->assertEquals($expectedArray, $api->commits(1)); } - - /** - * @test - */ + #[Test] public function shouldGetCommitsWithParams(): void { $expectedArray = [ @@ -294,10 +256,7 @@ public function shouldGetCommitsWithParams(): void $this->assertEquals($expectedArray, $api->commits(1, ['page' => 2, 'per_page' => 25, 'ref_name' => 'master', 'all' => true, 'with_stats' => true, 'path' => 'file_path/file_name'])); } - - /** - * @test - */ + #[Test] public function shouldGetCommitsWithTimeParams(): void { $expectedArray = [ @@ -322,10 +281,7 @@ public function shouldGetCommitsWithTimeParams(): void $this->assertEquals($expectedArray, $api->commits(1, ['since' => $since, 'until' => $until])); } - - /** - * @test - */ + #[Test] public function shouldGetCommit(): void { $expectedArray = ['id' => 'abcd1234', 'title' => 'A commit']; @@ -339,10 +295,7 @@ public function shouldGetCommit(): void $this->assertEquals($expectedArray, $api->commit(1, 'abcd1234')); } - - /** - * @test - */ + #[Test] public function shouldGetCommitRefs(): void { $expectedArray = [ @@ -359,12 +312,8 @@ public function shouldGetCommitRefs(): void $this->assertEquals($expectedArray, $api->commitRefs(1, 'abcd1234')); } - - /** - * @test - * - * @dataProvider dataGetCommitRefsWithParams - */ + #[Test] + #[DataProvider('dataGetCommitRefsWithParams')] public function shouldGetCommitRefsWithParams(string $type, array $expectedArray): void { $api = $this->getApiMock(); @@ -390,10 +339,7 @@ public static function dataGetCommitRefsWithParams(): array ], ]; } - - /** - * @test - */ + #[Test] public function shouldCreateCommit(): void { $expectedArray = ['title' => 'Initial commit.', 'author_name' => 'John Doe', 'author_email' => 'john@example.com']; @@ -424,10 +370,7 @@ public function shouldCreateCommit(): void 'author_email' => 'john@example.com', ])); } - - /** - * @test - */ + #[Test] public function shouldRevertCommit(): void { $expectedArray = ['title' => 'Initial commit.', 'author_name' => 'John Doe', 'author_email' => 'john@example.com']; @@ -441,10 +384,7 @@ public function shouldRevertCommit(): void $this->assertEquals($expectedArray, $api->revertCommit(1, 'develop', 'abcd1234')); } - - /** - * @test - */ + #[Test] public function shouldGetCommitComments(): void { $expectedArray = [ @@ -461,10 +401,7 @@ public function shouldGetCommitComments(): void $this->assertEquals($expectedArray, $api->commitComments(1, 'abcd1234')); } - - /** - * @test - */ + #[Test] public function shouldCreateCommitComment(): void { $expectedArray = ['id' => 2, 'title' => 'A new comment']; @@ -478,10 +415,7 @@ public function shouldCreateCommitComment(): void $this->assertEquals($expectedArray, $api->createCommitComment(1, 'abcd1234', 'A new comment')); } - - /** - * @test - */ + #[Test] public function shouldCreateCommitCommentWithParams(): void { $expectedArray = ['id' => 2, 'title' => 'A new comment']; @@ -503,10 +437,7 @@ public function shouldCreateCommitCommentWithParams(): void 'line_type' => 'old', ])); } - - /** - * @test - */ + #[Test] public function shouldCompareStraight(): void { $expectedArray = ['commit' => 'object']; @@ -520,10 +451,7 @@ public function shouldCompareStraight(): void $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature', true)); } - - /** - * @test - */ + #[Test] public function shouldNotCompareStraight(): void { $expectedArray = ['commit' => 'object']; @@ -537,10 +465,7 @@ public function shouldNotCompareStraight(): void $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature')); } - - /** - * @test - */ + #[Test] public function shouldCompareComplexBranchName(): void { $expectedArray = ['commit' => 'object']; @@ -554,10 +479,7 @@ public function shouldCompareComplexBranchName(): void $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature/760.fake-branch', true)); } - - /** - * @test - */ + #[Test] public function shouldCompareWithFromProjectId(): void { $expectedArray = ['commit' => 'object']; @@ -571,10 +493,7 @@ public function shouldCompareWithFromProjectId(): void $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature', true, '123')); } - - /** - * @test - */ + #[Test] public function shouldGetDiff(): void { $expectedArray = [ @@ -591,10 +510,7 @@ public function shouldGetDiff(): void $this->assertEquals($expectedArray, $api->diff(1, 'abcd1234')); } - - /** - * @test - */ + #[Test] public function shouldGetTree(): void { $expectedArray = [ @@ -611,10 +527,7 @@ public function shouldGetTree(): void $this->assertEquals($expectedArray, $api->tree(1)); } - - /** - * @test - */ + #[Test] public function shouldGetTreeWithParams(): void { $expectedArray = [ @@ -631,10 +544,7 @@ public function shouldGetTreeWithParams(): void $this->assertEquals($expectedArray, $api->tree(1, ['path' => 'dir/', 'ref_name' => 'master'])); } - - /** - * @test - */ + #[Test] public function shouldGetContributors(): void { $expectedArray = [ @@ -651,10 +561,7 @@ public function shouldGetContributors(): void $this->assertEquals($expectedArray, $api->contributors(1)); } - - /** - * @test - */ + #[Test] public function shouldGetMergeBase(): void { $expectedArray = [ @@ -683,10 +590,7 @@ public function shouldGetMergeBase(): void $this->assertEquals($expectedArray, $api->mergeBase(1, ['efgh5678efgh5678efgh5678efgh5678efgh5678', '1234567812345678123456781234567812345678'])); } - - /** - * @test - */ + #[Test] public function shouldCherryPick(): void { $expectedArray = [ diff --git a/tests/Api/RepositoryFilesTest.php b/tests/Api/RepositoryFilesTest.php index babbb33b..6b64719b 100644 --- a/tests/Api/RepositoryFilesTest.php +++ b/tests/Api/RepositoryFilesTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\RepositoryFiles; class RepositoryFilesTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetBlob(): void { $expectedString = 'something in a file'; @@ -33,10 +32,7 @@ public function shouldGetBlob(): void $this->assertEquals($expectedString, $api->getRawFile(1, 'dir/file1.txt', 'abcd1234')); } - - /** - * @test - */ + #[Test] public function shouldGetFile(): void { $expectedArray = ['file_name' => 'file1.txt', 'file_path' => 'dir/file1.txt']; @@ -50,10 +46,7 @@ public function shouldGetFile(): void $this->assertEquals($expectedArray, $api->getFile(1, 'dir/file1.txt', 'abcd1234')); } - - /** - * @test - */ + #[Test] public function shouldCreateFile(): void { $expectedArray = ['file_name' => 'file1.txt', 'file_path' => 'dir/file1.txt']; @@ -77,10 +70,7 @@ public function shouldCreateFile(): void 'commit_message' => 'Added new file', ])); } - - /** - * @test - */ + #[Test] public function shouldCreateFileWithEncoding(): void { $expectedArray = ['file_name' => 'file1.txt', 'file_path' => 'dir/file1.txt']; @@ -106,10 +96,7 @@ public function shouldCreateFileWithEncoding(): void 'encoding' => 'text', ])); } - - /** - * @test - */ + #[Test] public function shouldCreateFileWithAuthor(): void { $expectedArray = ['file_name' => 'file1.txt', 'file_path' => 'dir/file1.txt']; @@ -137,10 +124,7 @@ public function shouldCreateFileWithAuthor(): void 'author_name' => 'GitLab User', ])); } - - /** - * @test - */ + #[Test] public function shouldUpdateFile(): void { $expectedArray = ['file_name' => 'file1.txt', 'file_path' => 'dir/file1.txt']; @@ -164,10 +148,7 @@ public function shouldUpdateFile(): void 'commit_message' => 'Updated new file', ])); } - - /** - * @test - */ + #[Test] public function shouldUpdateFileWithEncoding(): void { $expectedArray = ['file_name' => 'file1.txt', 'file_path' => 'dir/file1.txt']; @@ -193,10 +174,7 @@ public function shouldUpdateFileWithEncoding(): void 'encoding' => 'base64', ])); } - - /** - * @test - */ + #[Test] public function shouldUpdateFileWithAuthor(): void { $expectedArray = ['file_name' => 'file1.txt', 'file_path' => 'dir/file1.txt']; @@ -224,10 +202,7 @@ public function shouldUpdateFileWithAuthor(): void 'author_name' => 'GitLab User', ])); } - - /** - * @test - */ + #[Test] public function shouldDeleteFile(): void { $expectedArray = ['file_name' => 'app/project.rb', 'branch' => 'master']; @@ -249,10 +224,7 @@ public function shouldDeleteFile(): void 'commit_message' => 'Deleted file', ])); } - - /** - * @test - */ + #[Test] public function shouldDeleteFileWithAuthor(): void { $expectedArray = ['file_name' => 'app/project.rb', 'branch' => 'master']; diff --git a/tests/Api/ResourceIterationEventsTest.php b/tests/Api/ResourceIterationEventsTest.php index dc89965a..25a9c0a4 100644 --- a/tests/Api/ResourceIterationEventsTest.php +++ b/tests/Api/ResourceIterationEventsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ResourceIterationEvents; class ResourceIterationEventsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllEvents(): void { $expectedArray = [ @@ -88,10 +87,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all(1, 253)); } - - /** - * @test - */ + #[Test] public function shouldShowEvent(): void { $expectedArray = [ diff --git a/tests/Api/ResourceLabelEventsTest.php b/tests/Api/ResourceLabelEventsTest.php index 47cee1a7..2d69b50b 100644 --- a/tests/Api/ResourceLabelEventsTest.php +++ b/tests/Api/ResourceLabelEventsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ResourceLabelEvents; class ResourceLabelEventsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllEvents(): void { $expectedArray = [ @@ -76,10 +75,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all(1, 253)); } - - /** - * @test - */ + #[Test] public function shouldShowEvent(): void { $expectedArray = [ diff --git a/tests/Api/ResourceMilestoneEventsTest.php b/tests/Api/ResourceMilestoneEventsTest.php index a7918d04..6bcaf976 100644 --- a/tests/Api/ResourceMilestoneEventsTest.php +++ b/tests/Api/ResourceMilestoneEventsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ResourceMilestoneEvents; class ResourceMilestoneEventsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllEvents(): void { $expectedArray = [ @@ -90,10 +89,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all(1, 253)); } - - /** - * @test - */ + #[Test] public function shouldShowEvent(): void { $expectedArray = [ diff --git a/tests/Api/ResourceStateEventsTest.php b/tests/Api/ResourceStateEventsTest.php index 7fd3a0bf..f273495d 100644 --- a/tests/Api/ResourceStateEventsTest.php +++ b/tests/Api/ResourceStateEventsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ResourceStateEvents; class ResourceStateEventsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllEvents(): void { $expectedArray = [ @@ -64,10 +63,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all(1, 11)); } - - /** - * @test - */ + #[Test] public function shouldShowEvent(): void { $expectedArray = [ diff --git a/tests/Api/ResourceWeightEventsTest.php b/tests/Api/ResourceWeightEventsTest.php index 52f07b7e..5321d617 100644 --- a/tests/Api/ResourceWeightEventsTest.php +++ b/tests/Api/ResourceWeightEventsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ResourceWeightEvents; class ResourceWeightEventsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllEvents(): void { $expectedArray = [ @@ -62,10 +61,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all(1, 253)); } - - /** - * @test - */ + #[Test] public function shouldShowEvent(): void { $expectedArray = [ diff --git a/tests/Api/ScheduleTest.php b/tests/Api/ScheduleTest.php index 8fe636d4..1f779478 100644 --- a/tests/Api/ScheduleTest.php +++ b/tests/Api/ScheduleTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Schedules; class ScheduleTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldCreateSchedule(): void { $expectedArray = [ @@ -66,10 +65,7 @@ public function shouldCreateSchedule(): void ] )); } - - /** - * @test - */ + #[Test] public function shouldShowSchedule(): void { $expectedArray = ['id' => 1, 'name' => 'A schedule']; @@ -83,10 +79,7 @@ public function shouldShowSchedule(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldShowAllSchedule(): void { $expectedArray = ['id' => 1, 'name' => 'A schedule']; @@ -100,10 +93,7 @@ public function shouldShowAllSchedule(): void $this->assertEquals($expectedArray, $api->showAll(1)); } - - /** - * @test - */ + #[Test] public function shouldUpdateSchedule(): void { $expectedArray = ['id' => 3, 'title' => 'Updated schedule']; @@ -117,10 +107,7 @@ public function shouldUpdateSchedule(): void $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated schedule', 'due_date' => '2015-04-01', 'state_event' => 'close'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveSchedule(): void { $expectedBool = true; @@ -133,10 +120,7 @@ public function shouldRemoveSchedule(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldCreateScheduleVariable(): void { $expectedArray = [ @@ -157,10 +141,7 @@ public function shouldCreateScheduleVariable(): void $expectedArray )); } - - /** - * @test - */ + #[Test] public function shouldUpdateScheduleVariable(): void { $variabelName = 'FOO_BAR'; @@ -183,10 +164,7 @@ public function shouldUpdateScheduleVariable(): void $expectedArray )); } - - /** - * @test - */ + #[Test] public function shouldRemoveScheduleVariable(): void { $expectedBool = true; @@ -199,10 +177,7 @@ public function shouldRemoveScheduleVariable(): void $this->assertEquals($expectedBool, $api->removeVariable(1, 2, 'FOO_BAR')); } - - /** - * @test - */ + #[Test] public function shouldTakeOwnership(): void { $expectedBool = true; @@ -215,10 +190,7 @@ public function shouldTakeOwnership(): void $this->assertEquals($expectedBool, $api->takeOwnership(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldPlay(): void { $expectedBool = true; diff --git a/tests/Api/SearchTest.php b/tests/Api/SearchTest.php index 0eafc203..443054df 100644 --- a/tests/Api/SearchTest.php +++ b/tests/Api/SearchTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Search; class SearchTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAll(): void { $expectedArray = [ diff --git a/tests/Api/SnippetsTest.php b/tests/Api/SnippetsTest.php index e366e5ec..17273e48 100644 --- a/tests/Api/SnippetsTest.php +++ b/tests/Api/SnippetsTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Snippets; class SnippetsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllSnippets(): void { $expectedArray = [ @@ -37,10 +36,7 @@ public function shouldGetAllSnippets(): void $this->assertEquals($expectedArray, $api->all(1)); } - - /** - * @test - */ + #[Test] public function shouldShowSnippet(): void { $expectedArray = ['id' => 2, 'title' => 'Another snippet']; @@ -54,10 +50,7 @@ public function shouldShowSnippet(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldCreateSnippet(): void { $expectedArray = ['id' => 3, 'title' => 'A new snippet']; @@ -71,10 +64,7 @@ public function shouldCreateSnippet(): void $this->assertEquals($expectedArray, $api->create(1, 'A new snippet', 'file.txt', 'A file', 'public')); } - - /** - * @test - */ + #[Test] public function shouldUpdateSnippet(): void { $expectedArray = ['id' => 3, 'title' => 'Updated snippet']; @@ -88,10 +78,7 @@ public function shouldUpdateSnippet(): void $this->assertEquals($expectedArray, $api->update(1, 3, ['file_name' => 'new_file.txt', 'code' => 'New content', 'title' => 'Updated snippet'])); } - - /** - * @test - */ + #[Test] public function shouldShowContent(): void { $expectedString = 'New content'; @@ -104,10 +91,7 @@ public function shouldShowContent(): void $this->assertEquals($expectedString, $api->content(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldRemoveSnippet(): void { $expectedBool = true; @@ -120,10 +104,7 @@ public function shouldRemoveSnippet(): void $this->assertEquals($expectedBool, $api->remove(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetNotes(): void { $expectedArray = [ @@ -140,10 +121,7 @@ public function shouldGetNotes(): void $this->assertEquals($expectedArray, $api->showNotes(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldGetNote(): void { $expectedArray = ['id' => 3, 'body' => 'A new note']; @@ -157,10 +135,7 @@ public function shouldGetNote(): void $this->assertEquals($expectedArray, $api->showNote(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldCreateNote(): void { $expectedArray = ['id' => 3, 'body' => 'A new note']; @@ -174,10 +149,7 @@ public function shouldCreateNote(): void $this->assertEquals($expectedArray, $api->addNote(1, 2, 'A new note')); } - - /** - * @test - */ + #[Test] public function shouldUpdateNote(): void { $expectedArray = ['id' => 3, 'body' => 'An edited comment']; @@ -191,10 +163,7 @@ public function shouldUpdateNote(): void $this->assertEquals($expectedArray, $api->updateNote(1, 2, 3, 'An edited comment')); } - - /** - * @test - */ + #[Test] public function shouldRemoveNote(): void { $expectedBool = true; @@ -207,10 +176,7 @@ public function shouldRemoveNote(): void $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); } - - /** - * @test - */ + #[Test] public function shouldIssueSnippetAwardEmoji(): void { $expectedArray = [ @@ -227,10 +193,7 @@ public function shouldIssueSnippetAwardEmoji(): void $this->assertEquals($expectedArray, $api->awardEmoji(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldRevokeSnippetAwardEmoji(): void { $expectedBool = true; diff --git a/tests/Api/SystemHooksTest.php b/tests/Api/SystemHooksTest.php index a9037261..a33517a3 100644 --- a/tests/Api/SystemHooksTest.php +++ b/tests/Api/SystemHooksTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\SystemHooks; class SystemHooksTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllHooks(): void { $expectedArray = [ @@ -37,10 +36,7 @@ public function shouldGetAllHooks(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldCreateHook(): void { $expectedArray = ['id' => 3, 'url' => 'http://www.example.net/']; @@ -54,10 +50,7 @@ public function shouldCreateHook(): void $this->assertEquals($expectedArray, $api->create('http://www.example.net/')); } - - /** - * @test - */ + #[Test] public function shouldTestHook(): void { $expectedBool = true; @@ -70,10 +63,7 @@ public function shouldTestHook(): void $this->assertEquals($expectedBool, $api->test(3)); } - - /** - * @test - */ + #[Test] public function shouldRemoveHook(): void { $expectedBool = true; diff --git a/tests/Api/TagsTest.php b/tests/Api/TagsTest.php index 0dff92cc..36c8ce7e 100644 --- a/tests/Api/TagsTest.php +++ b/tests/Api/TagsTest.php @@ -14,13 +14,14 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Tags; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\DataProvider; class TagsTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllTags(): void { $expectedArray = [ @@ -35,10 +36,7 @@ public function shouldGetAllTags(): void ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->all(1)); } - - /** - * @test - */ + #[Test] public function shouldShowTag(): void { $expectedArray = [ @@ -52,10 +50,7 @@ public function shouldShowTag(): void ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->show(1, 'v1.0.0')); } - - /** - * @test - */ + #[Test] public function shouldCreateTag(): void { $expectedArray = [ @@ -76,10 +71,7 @@ public function shouldCreateTag(): void $this->assertEquals($expectedArray, $api->create(1, $params)); } - - /** - * @test - */ + #[Test] public function shouldRemoveTag(): void { $expectedArray = [ @@ -93,12 +85,8 @@ public function shouldRemoveTag(): void ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->remove(1, 'v1.1.0')); } - - /** - * @test - * - * @dataProvider releaseDataProvider - */ + #[Test] + #[DataProvider('releaseDataProvider')] public function shouldCreateRelease(string $releaseName, string $description, array $expectedResult): void { $params = [ @@ -113,12 +101,8 @@ public function shouldCreateRelease(string $releaseName, string $description, ar $this->assertEquals($expectedResult, $api->createRelease(1, $releaseName, $params)); } - - /** - * @test - * - * @dataProvider releaseDataProvider - */ + #[Test] + #[DataProvider('releaseDataProvider')] public function shouldUpdateRelease(string $releaseName, string $description, array $expectedResult): void { $params = [ diff --git a/tests/Api/TestCase.php b/tests/Api/TestCase.php index ca5240ac..c4d5a99d 100644 --- a/tests/Api/TestCase.php +++ b/tests/Api/TestCase.php @@ -14,8 +14,11 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Client; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase as BaseTestCase; +use PHPUnit\Framework\Attributes\Test; use Psr\Http\Client\ClientInterface; abstract class TestCase extends BaseTestCase diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index e1ce8bb8..e13c8711 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -14,13 +14,14 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Users; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\DataProvider; class UsersTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldGetAllUsers(): void { $expectedArray = [ @@ -37,10 +38,7 @@ public function shouldGetAllUsers(): void $this->assertEquals($expectedArray, $api->all()); } - - /** - * @test - */ + #[Test] public function shouldGetActiveUsers(): void { $expectedArray = [ @@ -57,10 +55,7 @@ public function shouldGetActiveUsers(): void $this->assertEquals($expectedArray, $api->all(['active' => true])); } - - /** - * @test - */ + #[Test] public function shouldGetUsersWithDateTimeParams(): void { $expectedArray = [ @@ -88,10 +83,7 @@ public function shouldGetUsersWithDateTimeParams(): void $api->all(['created_after' => $createdAfter, 'created_before' => $createdBefore]) ); } - - /** - * @test - */ + #[Test] public function shouldShowUser(): void { $expectedArray = ['id' => 1, 'name' => 'Matt']; @@ -135,10 +127,7 @@ protected function getUsersMembershipsRequestMock($path, $expectedArray = [], $e return $api; } - - /** - * @test - */ + #[Test] public function shouldShowUsersMemberships(): void { $expectedArray = $this->getUsersMembershipsData(); @@ -147,10 +136,7 @@ public function shouldShowUsersMemberships(): void $this->assertEquals($expectedArray, $api->usersMemberships(1)); } - - /** - * @test - */ + #[Test] public function shouldShowUsersMembershipsWithTypeProject(): void { $expectedArray = [$this->getUsersMembershipsData()[0]]; @@ -159,10 +145,7 @@ public function shouldShowUsersMembershipsWithTypeProject(): void $this->assertEquals($expectedArray, $api->usersMemberships(1, ['type' => 'Project'])); } - - /** - * @test - */ + #[Test] public function shouldShowUsersMembershipsWithTypeNamespace(): void { $expectedArray = [$this->getUsersMembershipsData()[1]]; @@ -191,10 +174,7 @@ protected function getUsersProjectsRequestMock($path, $expectedArray = [], $expe return $api; } - - /** - * @test - */ + #[Test] public function shouldShowUsersProjects(): void { $expectedArray = $this->getUsersProjectsData(); @@ -203,10 +183,7 @@ public function shouldShowUsersProjects(): void $this->assertEquals($expectedArray, $api->usersProjects(1)); } - - /** - * @test - */ + #[Test] public function shouldShowUsersProjectsWithLimit(): void { $expectedArray = [$this->getUsersProjectsData()[0]]; @@ -215,10 +192,7 @@ public function shouldShowUsersProjectsWithLimit(): void $this->assertEquals($expectedArray, $api->usersProjects(1, ['per_page' => 1])); } - - /** - * @test - */ + #[Test] public function shouldGetAllUsersProjectsSortedByName(): void { $expectedArray = $this->getUsersProjectsData(); @@ -234,10 +208,7 @@ public function shouldGetAllUsersProjectsSortedByName(): void $api->usersProjects(1, ['page' => 1, 'per_page' => 5, 'order_by' => 'name', 'sort' => 'asc']) ); } - - /** - * @test - */ + #[Test] public function shouldGetNotArchivedUsersProjects(): void { $expectedArray = $this->getUsersProjectsData(); @@ -246,10 +217,7 @@ public function shouldGetNotArchivedUsersProjects(): void $this->assertEquals($expectedArray, $api->usersProjects(1, ['archived' => false])); } - - /** - * @test - */ + #[Test] public function shouldGetOwnedUsersProjects(): void { $expectedArray = $this->getUsersProjectsData(); @@ -269,12 +237,8 @@ public static function possibleAccessLevels(): array [50], ]; } - - /** - * @test - * - * @dataProvider possibleAccessLevels - */ + #[Test] + #[DataProvider('possibleAccessLevels')] public function shouldGetProjectsWithMinimumAccessLevel($level): void { $expectedArray = $this->getUsersProjectsData(); @@ -283,10 +247,7 @@ public function shouldGetProjectsWithMinimumAccessLevel($level): void $this->assertEquals($expectedArray, $api->usersProjects(1, ['min_access_level' => $level])); } - - /** - * @test - */ + #[Test] public function shouldSearchUsersProjects(): void { $expectedArray = $this->getUsersProjectsData(); @@ -294,10 +255,7 @@ public function shouldSearchUsersProjects(): void $api = $this->getUsersProjectsRequestMock('users/1/projects', $expectedArray, ['search' => 'a project']); $this->assertEquals($expectedArray, $api->usersProjects(1, ['search' => 'a project'])); } - - /** - * @test - */ + #[Test] public function shouldShowUsersStarredProjects(): void { $expectedArray = $this->getUsersProjectsData(); @@ -306,10 +264,7 @@ public function shouldShowUsersStarredProjects(): void $this->assertEquals($expectedArray, $api->usersStarredProjects(1)); } - - /** - * @test - */ + #[Test] public function shouldShowUsersStarredProjectsWithLimit(): void { $expectedArray = [$this->getUsersProjectsData()[0]]; @@ -318,10 +273,7 @@ public function shouldShowUsersStarredProjectsWithLimit(): void $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['per_page' => 1])); } - - /** - * @test - */ + #[Test] public function shouldGetAllUsersStarredProjectsSortedByName(): void { $expectedArray = $this->getUsersProjectsData(); @@ -337,10 +289,7 @@ public function shouldGetAllUsersStarredProjectsSortedByName(): void $api->usersStarredProjects(1, ['page' => 1, 'per_page' => 5, 'order_by' => 'name', 'sort' => 'asc']) ); } - - /** - * @test - */ + #[Test] public function shouldGetNotArchivedUsersStarredProjects(): void { $expectedArray = $this->getUsersProjectsData(); @@ -349,10 +298,7 @@ public function shouldGetNotArchivedUsersStarredProjects(): void $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['archived' => false])); } - - /** - * @test - */ + #[Test] public function shouldGetOwnedUsersStarredProjects(): void { $expectedArray = $this->getUsersProjectsData(); @@ -361,12 +307,8 @@ public function shouldGetOwnedUsersStarredProjects(): void $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['owned' => true])); } - - /** - * @test - * - * @dataProvider possibleAccessLevels - */ + #[Test] + #[DataProvider('possibleAccessLevels')] public function shouldGetStarredProjectsWithMinimumAccessLevel($level): void { $expectedArray = $this->getUsersProjectsData(); @@ -375,10 +317,7 @@ public function shouldGetStarredProjectsWithMinimumAccessLevel($level): void $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['min_access_level' => $level])); } - - /** - * @test - */ + #[Test] public function shouldSearchUsersStarredProjects(): void { $expectedArray = $this->getUsersProjectsData(); @@ -386,10 +325,7 @@ public function shouldSearchUsersStarredProjects(): void $api = $this->getUsersProjectsRequestMock('users/1/starred_projects', $expectedArray, ['search' => 'a project']); $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['search' => 'a project'])); } - - /** - * @test - */ + #[Test] public function shouldCreateUser(): void { $expectedArray = ['id' => 3, 'name' => 'Billy']; @@ -403,10 +339,7 @@ public function shouldCreateUser(): void $this->assertEquals($expectedArray, $api->create('billy@example.com', 'password')); } - - /** - * @test - */ + #[Test] public function shouldCreateUserWithAdditionalInfo(): void { $expectedArray = ['id' => 3, 'name' => 'Billy']; @@ -420,10 +353,7 @@ public function shouldCreateUserWithAdditionalInfo(): void $this->assertEquals($expectedArray, $api->create('billy@example.com', 'password', ['name' => 'Billy', 'bio' => 'A person'])); } - - /** - * @test - */ + #[Test] public function shouldUpdateUser(): void { $expectedArray = ['id' => 3, 'name' => 'Billy Bob']; @@ -448,10 +378,7 @@ public function shouldUpdateUser(): void $this->assertEquals($expectedArray, $api->update(4, [], ['avatar' => '/some/image.jpg'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveUser(): void { $expectedBool = true; @@ -464,10 +391,7 @@ public function shouldRemoveUser(): void $this->assertEquals($expectedBool, $api->remove(1)); } - - /** - * @test - */ + #[Test] public function shouldBlockUser(): void { $expectedBool = true; @@ -480,10 +404,7 @@ public function shouldBlockUser(): void $this->assertEquals($expectedBool, $api->block(1)); } - - /** - * @test - */ + #[Test] public function shouldUnblockUser(): void { $expectedBool = true; @@ -496,10 +417,7 @@ public function shouldUnblockUser(): void $this->assertEquals($expectedBool, $api->unblock(1)); } - - /** - * @test - */ + #[Test] public function shouldActivateUser(): void { $expectedBool = true; @@ -512,10 +430,7 @@ public function shouldActivateUser(): void $this->assertEquals($expectedBool, $api->activate(1)); } - - /** - * @test - */ + #[Test] public function shouldDeactivateUser(): void { $expectedBool = true; @@ -528,10 +443,7 @@ public function shouldDeactivateUser(): void $this->assertEquals($expectedBool, $api->deactivate(1)); } - - /** - * @test - */ + #[Test] public function shouldShowCurrentUser(): void { $expectedArray = ['id' => 1, 'name' => 'Matt']; @@ -545,10 +457,7 @@ public function shouldShowCurrentUser(): void $this->assertEquals($expectedArray, $api->me()); } - - /** - * @test - */ + #[Test] public function shouldGetCurrentUserKeys(): void { $expectedArray = [ @@ -565,10 +474,7 @@ public function shouldGetCurrentUserKeys(): void $this->assertEquals($expectedArray, $api->keys(1)); } - - /** - * @test - */ + #[Test] public function shouldGetCurrentUserKey(): void { $expectedArray = ['id' => 1, 'title' => 'A key']; @@ -582,10 +488,7 @@ public function shouldGetCurrentUserKey(): void $this->assertEquals($expectedArray, $api->key(1)); } - - /** - * @test - */ + #[Test] public function shouldCreateKeyForCurrentUser(): void { $expectedArray = ['id' => 3, 'title' => 'A new key']; @@ -599,10 +502,7 @@ public function shouldCreateKeyForCurrentUser(): void $this->assertEquals($expectedArray, $api->createKey('A new key', '...')); } - - /** - * @test - */ + #[Test] public function shouldDeleteKeyForCurrentUser(): void { $expectedBool = true; @@ -615,10 +515,7 @@ public function shouldDeleteKeyForCurrentUser(): void $this->assertEquals($expectedBool, $api->removeKey(3)); } - - /** - * @test - */ + #[Test] public function shouldGetUserKeys(): void { $expectedArray = [ @@ -635,10 +532,7 @@ public function shouldGetUserKeys(): void $this->assertEquals($expectedArray, $api->userKeys(1)); } - - /** - * @test - */ + #[Test] public function shouldGetUserKey(): void { $expectedArray = ['id' => 2, 'title' => 'Another key']; @@ -652,10 +546,7 @@ public function shouldGetUserKey(): void $this->assertEquals($expectedArray, $api->userKey(1, 2)); } - - /** - * @test - */ + #[Test] public function shouldCreateKeyForUser(): void { $expectedArray = ['id' => 3, 'title' => 'A new key']; @@ -669,10 +560,7 @@ public function shouldCreateKeyForUser(): void $this->assertEquals($expectedArray, $api->createKeyForUser(1, 'A new key', '...')); } - - /** - * @test - */ + #[Test] public function shouldDeleteKeyForUser(): void { $expectedBool = true; @@ -685,10 +573,7 @@ public function shouldDeleteKeyForUser(): void $this->assertEquals($expectedBool, $api->removeUserKey(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetUserEmails(): void { $expectedArray = [ @@ -704,10 +589,7 @@ public function shouldGetUserEmails(): void $this->assertEquals($expectedArray, $api->emails()); } - - /** - * @test - */ + #[Test] public function shouldGetSpecificUserEmail(): void { $expectedArray = ['id' => 1, 'email' => 'foo@bar.baz']; @@ -720,10 +602,7 @@ public function shouldGetSpecificUserEmail(): void $this->assertEquals($expectedArray, $api->email(1)); } - - /** - * @test - */ + #[Test] public function shouldGetEmailsForUser(): void { $expectedArray = [ @@ -740,10 +619,7 @@ public function shouldGetEmailsForUser(): void $this->assertEquals($expectedArray, $api->userEmails(1)); } - - /** - * @test - */ + #[Test] public function shouldCreateEmailForUser(): void { $expectedArray = ['id' => 3, 'email' => 'foo@bar.example']; @@ -757,10 +633,7 @@ public function shouldCreateEmailForUser(): void $this->assertEquals($expectedArray, $api->createEmailForUser(1, 'foo@bar.example')); } - - /** - * @test - */ + #[Test] public function shouldCreateConfirmedEmailForUser(): void { $expectedArray = ['id' => 4, 'email' => 'foo@baz.example']; @@ -774,10 +647,7 @@ public function shouldCreateConfirmedEmailForUser(): void $this->assertEquals($expectedArray, $api->createEmailForUser(1, 'foo@baz.example', true)); } - - /** - * @test - */ + #[Test] public function shouldDeleteEmailForUser(): void { $expectedBool = true; @@ -790,10 +660,7 @@ public function shouldDeleteEmailForUser(): void $this->assertEquals($expectedBool, $api->removeUserEmail(1, 3)); } - - /** - * @test - */ + #[Test] public function shouldGetCurrentUserImpersonationTokens(): void { $expectedArray = [ @@ -810,10 +677,7 @@ public function shouldGetCurrentUserImpersonationTokens(): void $this->assertEquals($expectedArray, $api->userImpersonationTokens(1)); } - - /** - * @test - */ + #[Test] public function shouldGetUserImpersonationToken(): void { $expectedArray = ['id' => 2, 'name' => 'name']; @@ -827,10 +691,7 @@ public function shouldGetUserImpersonationToken(): void $this->assertEquals($expectedArray, $api->userImpersonationToken(1, 1)); } - - /** - * @test - */ + #[Test] public function shouldCreateImpersonationTokenForUser(): void { $expectedArray = ['id' => 1, 'name' => 'name']; @@ -844,10 +705,7 @@ public function shouldCreateImpersonationTokenForUser(): void $this->assertEquals($expectedArray, $api->createImpersonationToken(1, 'name', ['api'])); } - - /** - * @test - */ + #[Test] public function shouldDeleteImpersonationTokenForUser(): void { $expectedBool = true; @@ -860,10 +718,7 @@ public function shouldDeleteImpersonationTokenForUser(): void $this->assertEquals($expectedBool, $api->removeImpersonationToken(1, 1)); } - - /** - * @test - */ + #[Test] public function shouldGetCurrentUserActiveImpersonationTokens(): void { $expectedArray = [ @@ -879,10 +734,7 @@ public function shouldGetCurrentUserActiveImpersonationTokens(): void $this->assertEquals($expectedArray, $api->userImpersonationTokens(1, ['state' => 'active'])); } - - /** - * @test - */ + #[Test] public function shouldGetCurrentUserInactiveImpersonationTokens(): void { $expectedArray = [ @@ -903,10 +755,7 @@ protected function getApiClass() { return Users::class; } - - /** - * @test - */ + #[Test] public function shouldGetEvents(): void { $expectedArray = [ @@ -922,10 +771,7 @@ public function shouldGetEvents(): void $this->assertEquals($expectedArray, $api->events(1)); } - - /** - * @test - */ + #[Test] public function shouldGetEventsWithDateTimeParams(): void { $expectedArray = [ @@ -949,10 +795,7 @@ public function shouldGetEventsWithDateTimeParams(): void $this->assertEquals($expectedArray, $api->events(1, ['after' => $after, 'before' => $before])); } - - /** - * @test - */ + #[Test] public function shouldGetEventsWithPagination(): void { $expectedArray = [ @@ -971,10 +814,7 @@ public function shouldGetEventsWithPagination(): void $this->assertEquals($expectedArray, $api->events(1, ['page' => 2, 'per_page' => 15])); } - - /** - * @test - */ + #[Test] public function getRemoveUserIdentity(): void { $expectedArray = [ diff --git a/tests/Api/VersionTest.php b/tests/Api/VersionTest.php index 4a3a7ad5..f54650c7 100644 --- a/tests/Api/VersionTest.php +++ b/tests/Api/VersionTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Version; class VersionTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldShowVersion(): void { $expectedArray = [ diff --git a/tests/Api/WikiTest.php b/tests/Api/WikiTest.php index b9b46da5..7a8f1454 100644 --- a/tests/Api/WikiTest.php +++ b/tests/Api/WikiTest.php @@ -14,13 +14,12 @@ namespace Gitlab\Tests\Api; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Wiki; class WikiTest extends TestCase { - /** - * @test - */ + #[Test] public function shouldCreateWiki(): void { $expectedArray = [ @@ -49,10 +48,7 @@ public function shouldCreateWiki(): void ] )); } - - /** - * @test - */ + #[Test] public function shouldShowWiki(): void { $expectedArray = [ @@ -69,10 +65,7 @@ public function shouldShowWiki(): void $this->assertEquals($expectedArray, $api->show(1, 'Test-Wiki')); } - - /** - * @test - */ + #[Test] public function shouldShowAllWiki(): void { $expectedArray = [ @@ -92,10 +85,7 @@ public function shouldShowAllWiki(): void $this->assertEquals($expectedArray, $api->showAll(1, $params)); } - - /** - * @test - */ + #[Test] public function shouldUpdateWiki(): void { $expectedArray = [ @@ -114,10 +104,7 @@ public function shouldUpdateWiki(): void $this->assertEquals($expectedArray, $api->update(1, 'Test-Wiki', ['content' => 'This is the test Wiki that has been updated'])); } - - /** - * @test - */ + #[Test] public function shouldRemoveWiki(): void { $expectedBool = true; diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 72bff09d..120e9b3f 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -14,8 +14,11 @@ namespace Gitlab\Tests; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Client; +use PHPUnit\Framework\Attributes\Test; use Http\Client\Common\HttpMethodsClient; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; class ClientTest extends TestCase diff --git a/tests/HttpClient/BuilderTest.php b/tests/HttpClient/BuilderTest.php index 0b017c32..f11bdee2 100644 --- a/tests/HttpClient/BuilderTest.php +++ b/tests/HttpClient/BuilderTest.php @@ -14,12 +14,19 @@ namespace Gitlab\Tests\HttpClient; +use PHPUnit\Framework\Attributes\Test; use Gitlab\HttpClient\Builder; +use PHPUnit\Framework\Attributes\Test; use Http\Client\Common\HttpMethodsClientInterface; +use PHPUnit\Framework\Attributes\Test; use Http\Client\Common\Plugin; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\Test; use Psr\Http\Client\ClientInterface; +use PHPUnit\Framework\Attributes\Test; use Psr\Http\Message\RequestFactoryInterface; +use PHPUnit\Framework\Attributes\Test; use Psr\Http\Message\StreamFactoryInterface; /** diff --git a/tests/HttpClient/Message/ResponseMediatorTest.php b/tests/HttpClient/Message/ResponseMediatorTest.php index 7266ecfa..e4c65e97 100644 --- a/tests/HttpClient/Message/ResponseMediatorTest.php +++ b/tests/HttpClient/Message/ResponseMediatorTest.php @@ -14,10 +14,15 @@ namespace Gitlab\Tests\HttpClient\Message; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Exception\RuntimeException; +use PHPUnit\Framework\Attributes\Test; use Gitlab\HttpClient\Message\ResponseMediator; +use PHPUnit\Framework\Attributes\Test; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; use GuzzleHttp\Psr7\Utils; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; /** diff --git a/tests/HttpClient/Util/QueryStringBuilderTest.php b/tests/HttpClient/Util/QueryStringBuilderTest.php index c9ba33bf..94b29a51 100644 --- a/tests/HttpClient/Util/QueryStringBuilderTest.php +++ b/tests/HttpClient/Util/QueryStringBuilderTest.php @@ -14,15 +14,18 @@ namespace Gitlab\Tests\HttpClient\Util; +use PHPUnit\Framework\Attributes\Test; use Generator; +use PHPUnit\Framework\Attributes\Test; use Gitlab\HttpClient\Util\QueryStringBuilder; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; class QueryStringBuilderTest extends TestCase { - /** - * @dataProvider queryStringProvider - */ + #[DataProvider('queryStringProvider')] public function testBuild(array $query, string $expected): void { $this->assertSame(\sprintf('?%s', $expected), QueryStringBuilder::build($query)); diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index e095c4ea..87c2e620 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -14,8 +14,11 @@ namespace Gitlab\Tests; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Client; +use PHPUnit\Framework\Attributes\Test; use Gitlab\Exception\RuntimeException; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; class IntegrationTest extends TestCase From c597d3a35d65a4a0e650780c13a3120fa9ab9dad Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 23 Feb 2025 17:35:14 +0000 Subject: [PATCH 105/117] Apply fixes from StyleCI --- tests/Api/DeployKeysTest.php | 2 +- tests/Api/DeploymentsTest.php | 7 +- tests/Api/EnvironmentsTest.php | 6 +- tests/Api/EventsTest.php | 4 +- tests/Api/GroupBoardsTest.php | 11 +- tests/Api/GroupsEpicsTest.php | 7 +- tests/Api/GroupsMilestonesTest.php | 16 +- tests/Api/GroupsTest.php | 46 +++++- tests/Api/IssueBoardsTest.php | 11 +- tests/Api/IssueLinksTest.php | 5 +- tests/Api/IssueSubscribeTest.php | 1 - tests/Api/IssuesStatisticsTest.php | 4 +- tests/Api/IssuesTest.php | 36 ++++- tests/Api/JobsTest.php | 18 ++- tests/Api/KeysTest.php | 2 +- tests/Api/MergeRequestsTest.php | 41 ++++- tests/Api/MilestonesTest.php | 8 +- tests/Api/PackagesTest.php | 6 +- tests/Api/ProjectNamespacesTest.php | 3 +- tests/Api/ProjectsTest.php | 141 +++++++++++++++++- tests/Api/RepositoriesTest.php | 36 ++++- tests/Api/RepositoryFilesTest.php | 11 +- tests/Api/ResourceIterationEventsTest.php | 3 +- tests/Api/ResourceLabelEventsTest.php | 3 +- tests/Api/ResourceMilestoneEventsTest.php | 3 +- tests/Api/ResourceStateEventsTest.php | 3 +- tests/Api/ResourceWeightEventsTest.php | 3 +- tests/Api/ScheduleTest.php | 11 +- tests/Api/SearchTest.php | 2 +- tests/Api/SnippetsTest.php | 14 +- tests/Api/SystemHooksTest.php | 5 +- tests/Api/TagsTest.php | 9 +- tests/Api/TestCase.php | 3 - tests/Api/UsersTest.php | 57 ++++++- tests/Api/VersionTest.php | 2 +- tests/Api/WikiTest.php | 6 +- tests/ClientTest.php | 3 - tests/HttpClient/BuilderTest.php | 7 - .../Message/ResponseMediatorTest.php | 5 - .../Util/QueryStringBuilderTest.php | 4 - tests/IntegrationTest.php | 3 - 41 files changed, 500 insertions(+), 68 deletions(-) diff --git a/tests/Api/DeployKeysTest.php b/tests/Api/DeployKeysTest.php index 0a600d96..fabd585b 100644 --- a/tests/Api/DeployKeysTest.php +++ b/tests/Api/DeployKeysTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\DeployKeys; +use PHPUnit\Framework\Attributes\Test; class DeployKeysTest extends TestCase { diff --git a/tests/Api/DeploymentsTest.php b/tests/Api/DeploymentsTest.php index f62f1371..d26b243e 100644 --- a/tests/Api/DeploymentsTest.php +++ b/tests/Api/DeploymentsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Deployments; +use PHPUnit\Framework\Attributes\Test; class DeploymentsTest extends TestCase { @@ -28,6 +28,7 @@ public function shouldGetAllDeployments(): void $this->assertEquals($expectedArray, $api->all(1)); } + #[Test] public function shouldShowDeployment(): void { @@ -250,6 +251,7 @@ protected function getMultipleDeploymentsRequestMock(string $path, array $expect return $api; } + #[Test] public function shouldGetAllDeploymentsSortedByCreatedAt(): void { @@ -271,6 +273,7 @@ protected function getApiClass() { return Deployments::class; } + #[Test] public function shouldAllowDeploymentFilterByStatus(): void { @@ -287,6 +290,7 @@ public function shouldAllowDeploymentFilterByStatus(): void $api->all(1, ['status' => 'success']) ); } + #[Test] public function shouldAllowFilterByEnvironment(): void { @@ -303,6 +307,7 @@ public function shouldAllowFilterByEnvironment(): void $api->all(1, ['environment' => 'production']) ); } + #[Test] public function shouldAllowEmptyArrayIfAllExcludedByFilter(): void { diff --git a/tests/Api/EnvironmentsTest.php b/tests/Api/EnvironmentsTest.php index caeda60d..edfa77e1 100644 --- a/tests/Api/EnvironmentsTest.php +++ b/tests/Api/EnvironmentsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Environments; +use PHPUnit\Framework\Attributes\Test; class EnvironmentsTest extends TestCase { @@ -63,6 +63,7 @@ public function shouldFilterEnvironmentByName(): void ->willReturn($expected); $this->assertEquals($expected, $api->all(1, ['name' => 'review/fix-bar'])); } + #[Test] public function shouldGetSingleEnvironment(): void { @@ -139,6 +140,7 @@ public function shouldGetSingleEnvironment(): void ->willReturn($expected); $this->assertEquals($expected, $api->show(1, 1)); } + #[Test] public function shouldCreateEnvironment(): void { @@ -166,6 +168,7 @@ public function shouldCreateEnvironment(): void $this->assertEquals($expectedArray, $api->create(1, $params)); } + #[Test] public function shouldRemoveEnvironment(): void { @@ -178,6 +181,7 @@ public function shouldRemoveEnvironment(): void ->willReturn($expectedBool); $this->assertEquals($expectedBool, $api->remove(1, 3)); } + #[Test] public function shouldStopEnvironment(): void { diff --git a/tests/Api/EventsTest.php b/tests/Api/EventsTest.php index 5f60bdba..ddc870e9 100644 --- a/tests/Api/EventsTest.php +++ b/tests/Api/EventsTest.php @@ -13,8 +13,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Events; +use PHPUnit\Framework\Attributes\Test; class EventsTest extends TestCase { @@ -22,6 +22,7 @@ protected function getApiClass() { return Events::class; } + #[Test] public function shouldGetAllEvents(): void { @@ -39,6 +40,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldGetEventsAfter(): void { diff --git a/tests/Api/GroupBoardsTest.php b/tests/Api/GroupBoardsTest.php index 45c5c849..bcea57b6 100644 --- a/tests/Api/GroupBoardsTest.php +++ b/tests/Api/GroupBoardsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\GroupsBoards; +use PHPUnit\Framework\Attributes\Test; class GroupBoardsTest extends TestCase { @@ -36,6 +36,7 @@ public function shouldGetAllBoards(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldShowIssueBoard(): void { @@ -50,6 +51,7 @@ public function shouldShowIssueBoard(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } + #[Test] public function shouldCreateIssueBoard(): void { @@ -64,6 +66,7 @@ public function shouldCreateIssueBoard(): void $this->assertEquals($expectedArray, $api->create(1, ['name' => 'A new issue board'])); } + #[Test] public function shouldUpdateIssueBoard(): void { @@ -78,6 +81,7 @@ public function shouldUpdateIssueBoard(): void $this->assertEquals($expectedArray, $api->update(1, 2, ['name' => 'A renamed issue board', 'labels' => 'foo'])); } + #[Test] public function shouldRemoveIssueBoard(): void { @@ -91,6 +95,7 @@ public function shouldRemoveIssueBoard(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } + #[Test] public function shouldGetAllLists(): void { @@ -123,6 +128,7 @@ public function shouldGetAllLists(): void $this->assertEquals($expectedArray, $api->allLists(1, 2)); } + #[Test] public function shouldGetList(): void { @@ -147,6 +153,7 @@ public function shouldGetList(): void $this->assertEquals($expectedArray, $api->showList(1, 2, 3)); } + #[Test] public function shouldCreateList(): void { @@ -171,6 +178,7 @@ public function shouldCreateList(): void $this->assertEquals($expectedArray, $api->createList(1, 2, 4)); } + #[Test] public function shouldUpdateList(): void { @@ -195,6 +203,7 @@ public function shouldUpdateList(): void $this->assertEquals($expectedArray, $api->updateList(5, 2, 3, 1)); } + #[Test] public function shouldDeleteList(): void { diff --git a/tests/Api/GroupsEpicsTest.php b/tests/Api/GroupsEpicsTest.php index 586caedf..5ce33fb6 100644 --- a/tests/Api/GroupsEpicsTest.php +++ b/tests/Api/GroupsEpicsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\GroupsEpics; +use PHPUnit\Framework\Attributes\Test; class GroupsEpicsTest extends TestCase { @@ -36,6 +36,7 @@ public function shouldGetAllEpics(): void $this->assertEquals($expectedArray, $api->all(1)); } + #[Test] public function shouldShowEpic(): void { @@ -50,6 +51,7 @@ public function shouldShowEpic(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } + #[Test] public function shouldCreateEpic(): void { @@ -64,6 +66,7 @@ public function shouldCreateEpic(): void $this->assertEquals($expectedArray, $api->create(1, ['description' => 'Some text', 'title' => 'A new epic'])); } + #[Test] public function shouldUpdateEpic(): void { @@ -78,6 +81,7 @@ public function shouldUpdateEpic(): void $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated epic', 'description' => 'Updated description', 'state_event' => 'close'])); } + #[Test] public function shouldRemoveEpic(): void { @@ -91,6 +95,7 @@ public function shouldRemoveEpic(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } + #[Test] public function shouldGetEpicsIssues(): void { diff --git a/tests/Api/GroupsMilestonesTest.php b/tests/Api/GroupsMilestonesTest.php index a96c823b..827487e9 100644 --- a/tests/Api/GroupsMilestonesTest.php +++ b/tests/Api/GroupsMilestonesTest.php @@ -14,10 +14,10 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\GroupsMilestones; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\Test; class GroupsMilestonesTest extends TestCase { @@ -38,6 +38,7 @@ public function shouldGetAllMilestones(): void $this->assertEquals($expectedArray, $api->all(1)); } + #[Test] public function shouldGetAllMilestonesWithParameterOneIidsValue(): void { @@ -49,6 +50,7 @@ public function shouldGetAllMilestonesWithParameterOneIidsValue(): void $api->all(1, ['iids' => [456]]); } + #[Test] public function shouldGetAllMilestonesWithParameterTwoIidsValues(): void { @@ -68,6 +70,7 @@ public static function getAllMilestonesWithParameterStateDataProvider() GroupsMilestones::STATE_CLOSED => [GroupsMilestones::STATE_CLOSED], ]; } + #[Test] #[DataProvider('getAllMilestonesWithParameterStateDataProvider')] public function shouldGetAllMilestonesWithParameterState(string $state): void @@ -80,6 +83,7 @@ public function shouldGetAllMilestonesWithParameterState(string $state): void $api->all(1, ['state' => $state]); } + #[Test] public function shouldGetAllMilestonesWithParameterSearch(): void { @@ -93,6 +97,7 @@ public function shouldGetAllMilestonesWithParameterSearch(): void $api->all(1, ['search' => $searchValue]); } + #[Test] public function shouldGetAllMilestonesWithParameterUpdatedBefore(): void { @@ -106,6 +111,7 @@ public function shouldGetAllMilestonesWithParameterUpdatedBefore(): void $api->all(1, ['updated_before' => $updatedBefore]); } + #[Test] public function shouldGetAllMilestonesWithParameterUpdatedAfter(): void { @@ -119,6 +125,7 @@ public function shouldGetAllMilestonesWithParameterUpdatedAfter(): void $api->all(1, ['updated_after' => $updatedAfter]); } + #[Test] public function shouldShowMilestone(): void { @@ -133,6 +140,7 @@ public function shouldShowMilestone(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } + #[Test] public function shouldCreateMilestone(): void { @@ -147,6 +155,7 @@ public function shouldCreateMilestone(): void $this->assertEquals($expectedArray, $api->create(1, ['description' => 'Some text', 'title' => 'A new milestone'])); } + #[Test] public function shouldUpdateMilestone(): void { @@ -161,6 +170,7 @@ public function shouldUpdateMilestone(): void $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated milestone', 'due_date' => '2015-04-01', 'state_event' => 'close'])); } + #[Test] public function shouldRemoveMilestone(): void { @@ -174,6 +184,7 @@ public function shouldRemoveMilestone(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } + #[Test] public function shouldGetMilestonesIssues(): void { @@ -191,6 +202,7 @@ public function shouldGetMilestonesIssues(): void $this->assertEquals($expectedArray, $api->issues(1, 3)); } + #[Test] public function shouldGetMilestonesMergeRequests(): void { diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index 58d9fdca..e3534bb4 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -14,10 +14,10 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use DateTime; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Groups; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\Test; class GroupsTest extends TestCase { @@ -38,6 +38,7 @@ public function shouldGetAllGroups(): void $this->assertEquals($expectedArray, $api->all(['page' => 1, 'per_page' => 10])); } + #[Test] public function shouldGetAllGroupsWithBooleanParam(): void { @@ -55,6 +56,7 @@ public function shouldGetAllGroupsWithBooleanParam(): void $this->assertEquals($expectedArray, $api->all(['all_available' => false])); } + #[Test] public function shouldGetAllTopLevelGroupsWithoutSubgroups(): void { @@ -72,6 +74,7 @@ public function shouldGetAllTopLevelGroupsWithoutSubgroups(): void $this->assertEquals($expectedArray, $api->all(['top_level_only' => true])); } + #[Test] public function shouldGetAllGroupProjectsWithBooleanParam(): void { @@ -89,6 +92,7 @@ public function shouldGetAllGroupProjectsWithBooleanParam(): void $this->assertEquals($expectedArray, $api->projects(1, ['archived' => false])); } + #[Test] public function shouldNotNeedPaginationWhenGettingGroups(): void { @@ -106,6 +110,7 @@ public function shouldNotNeedPaginationWhenGettingGroups(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldShowGroup(): void { @@ -120,6 +125,7 @@ public function shouldShowGroup(): void $this->assertEquals($expectedArray, $api->show(1)); } + #[Test] public function shouldCreateGroup(): void { @@ -134,6 +140,7 @@ public function shouldCreateGroup(): void $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group')); } + #[Test] public function shouldCreateGroupWithDescriptionAndVisibility(): void { @@ -148,6 +155,7 @@ public function shouldCreateGroupWithDescriptionAndVisibility(): void $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group', 'Description', 'public')); } + #[Test] public function shouldCreateGroupWithDescriptionVisibilityAndParentId(): void { @@ -162,6 +170,7 @@ public function shouldCreateGroupWithDescriptionVisibilityAndParentId(): void $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group', 'Description', 'public', null, null, 666)); } + #[Test] public function shouldUpdateGroup(): void { @@ -176,6 +185,7 @@ public function shouldUpdateGroup(): void $this->assertEquals($expectedArray, $api->update(3, ['name' => 'Group name', 'path' => 'group-path'])); } + #[Test] public function shouldTransferProjectToGroup(): void { @@ -189,6 +199,7 @@ public function shouldTransferProjectToGroup(): void $this->assertEquals($expectedBool, $api->transfer(1, 2)); } + #[Test] public function shouldGetAllMembers(): void { @@ -206,6 +217,7 @@ public function shouldGetAllMembers(): void $this->assertEquals($expectedArray, $api->allMembers(1)); } + #[Test] public function shouldGetAllMember(): void { @@ -219,6 +231,7 @@ public function shouldGetAllMember(): void $this->assertEquals($expectedArray, $api->allMember(1, 2)); } + #[Test] public function shouldGetMembers(): void { @@ -236,6 +249,7 @@ public function shouldGetMembers(): void $this->assertEquals($expectedArray, $api->members(1)); } + #[Test] public function shouldAddMember(): void { @@ -253,6 +267,7 @@ public function shouldAddMember(): void $this->assertEquals($expectedArray, $api->addMember(1, 2, 10, ['expires_at' => $tomorrow])); } + #[Test] public function shouldSaveMember(): void { @@ -267,6 +282,7 @@ public function shouldSaveMember(): void $this->assertEquals($expectedArray, $api->saveMember(1, 2, 4)); } + #[Test] public function shouldRemoveMember(): void { @@ -280,6 +296,7 @@ public function shouldRemoveMember(): void $this->assertEquals($expectedBool, $api->removeMember(1, 2)); } + #[Test] public function shouldRemoveGroup(): void { @@ -293,6 +310,7 @@ public function shouldRemoveGroup(): void $this->assertEquals($expectedBool, $api->remove(1)); } + #[Test] public function shouldGetAllSubgroups(): void { @@ -310,6 +328,7 @@ public function shouldGetAllSubgroups(): void $this->assertEquals($expectedArray, $api->subgroups(1, ['page' => 1, 'per_page' => 10])); } + #[Test] public function shouldGetAllIssues(): void { @@ -328,6 +347,7 @@ public function shouldGetAllIssues(): void $this->assertEquals($expectedArray, $api->issues(1, ['page' => 1, 'per_page' => 10])); } + #[Test] public function shouldGetLabels(): void { @@ -345,6 +365,7 @@ public function shouldGetLabels(): void $this->assertEquals($expectedArray, $api->labels(1)); } + #[Test] public function shouldAddLabel(): void { @@ -359,6 +380,7 @@ public function shouldAddLabel(): void $this->assertEquals($expectedArray, $api->addLabel(1, ['name' => 'wont-fix', 'color' => '#ffffff'])); } + #[Test] public function shouldUpdateLabel(): void { @@ -373,6 +395,7 @@ public function shouldUpdateLabel(): void $this->assertEquals($expectedArray, $api->updateLabel(1, 123, ['new_name' => 'big-bug', 'color' => '#00ffff'])); } + #[Test] public function shouldRemoveLabel(): void { @@ -403,6 +426,7 @@ public function shouldGetVariables(): void $this->assertEquals($expectedArray, $api->variables(1)); } + #[Test] public function shouldGetVariable(): void { @@ -437,6 +461,7 @@ public function shouldAddVariable(): void $this->assertEquals($expectedArray, $api->addVariable(1, $expectedKey, $expectedValue)); } + #[Test] public function shouldAddVariableWithProtected(): void { @@ -455,6 +480,7 @@ public function shouldAddVariableWithProtected(): void $this->assertEquals($expectedArray, $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); } + #[Test] public function shouldUpdateVariable(): void { @@ -475,6 +501,7 @@ public function shouldUpdateVariable(): void $this->assertEquals($expectedArray, $api->updateVariable(1, $expectedKey, $expectedValue)); } + #[Test] public function shouldUpdateVariableWithProtected(): void { @@ -493,6 +520,7 @@ public function shouldUpdateVariableWithProtected(): void $this->assertEquals($expectedArray, $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); } + #[Test] public function shouldRemoveVariable(): void { @@ -511,6 +539,7 @@ protected function getApiClass() { return Groups::class; } + #[Test] public function shouldGetAllGroupProjectsWithIssuesEnabled(): void { @@ -528,6 +557,7 @@ public function shouldGetAllGroupProjectsWithIssuesEnabled(): void $this->assertEquals($expectedArray, $api->projects(1, ['with_issues_enabled' => true])); } + #[Test] public function shouldGetAllGroupProjectsWithMergeRequestsEnabled(): void { @@ -545,6 +575,7 @@ public function shouldGetAllGroupProjectsWithMergeRequestsEnabled(): void $this->assertEquals($expectedArray, $api->projects(1, ['with_merge_requests_enabled' => true])); } + #[Test] public function shouldGetAllGroupProjectsSharedToGroup(): void { @@ -562,6 +593,7 @@ public function shouldGetAllGroupProjectsSharedToGroup(): void $this->assertEquals($expectedArray, $api->projects(1, ['with_shared' => true])); } + #[Test] public function shouldGetAllGroupProjectsIncludingSubsgroups(): void { @@ -579,6 +611,7 @@ public function shouldGetAllGroupProjectsIncludingSubsgroups(): void $this->assertEquals($expectedArray, $api->projects(1, ['include_subgroups' => true])); } + #[Test] public function shouldGetAllGroupProjectsIncludingCustomAttributes(): void { @@ -596,6 +629,7 @@ public function shouldGetAllGroupProjectsIncludingCustomAttributes(): void $this->assertEquals($expectedArray, $api->projects(1, ['with_custom_attributes' => true])); } + #[Test] public function shouldGetIterations(): void { @@ -625,6 +659,7 @@ public function shouldGetIterations(): void $this->assertEquals($expectedArray, $api->iterations(1)); } + #[Test] public function shouldGetPackages(): void { @@ -662,6 +697,7 @@ public function shouldGetPackages(): void $this->assertEquals($expectedArray, $api->packages(1)); } + #[Test] public function shouldGetGroupMergeRequests(): void { @@ -679,6 +715,7 @@ public function shouldGetGroupMergeRequests(): void $this->assertEquals($expectedArray, $api->mergeRequests(1, [])); } + #[Test] public function shouldGetDeployTokens(): void { @@ -705,6 +742,7 @@ public function shouldGetDeployTokens(): void $this->assertEquals($expectedArray, $api->deployTokens(1)); } + #[Test] public function shouldGetActiveDeployTokens(): void { @@ -731,6 +769,7 @@ public function shouldGetActiveDeployTokens(): void $this->assertEquals([], $api->deployTokens(1, true)); } + #[Test] public function shouldGetInactiveDeployTokens(): void { @@ -757,6 +796,7 @@ public function shouldGetInactiveDeployTokens(): void $this->assertEquals([], $api->deployTokens(1, false)); } + #[Test] public function shouldCreateDeployToken(): void { @@ -799,6 +839,7 @@ public function shouldCreateDeployToken(): void 'expires_at' => new DateTime('2021-01-01'), ])); } + #[Test] public function shouldDeleteDeployToken(): void { @@ -812,6 +853,7 @@ public function shouldDeleteDeployToken(): void $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); } + #[Test] public function shouldSearchGroups(): void { diff --git a/tests/Api/IssueBoardsTest.php b/tests/Api/IssueBoardsTest.php index a41b19e2..2638a8ab 100644 --- a/tests/Api/IssueBoardsTest.php +++ b/tests/Api/IssueBoardsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\IssueBoards; +use PHPUnit\Framework\Attributes\Test; class IssueBoardsTest extends TestCase { @@ -36,6 +36,7 @@ public function shouldGetAllBoards(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldShowIssueBoard(): void { @@ -50,6 +51,7 @@ public function shouldShowIssueBoard(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } + #[Test] public function shouldCreateIssueBoard(): void { @@ -64,6 +66,7 @@ public function shouldCreateIssueBoard(): void $this->assertEquals($expectedArray, $api->create(1, ['name' => 'A new issue board'])); } + #[Test] public function shouldUpdateIssueBoard(): void { @@ -78,6 +81,7 @@ public function shouldUpdateIssueBoard(): void $this->assertEquals($expectedArray, $api->update(1, 2, ['name' => 'A renamed issue board', 'labels' => 'foo'])); } + #[Test] public function shouldRemoveIssueBoard(): void { @@ -91,6 +95,7 @@ public function shouldRemoveIssueBoard(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } + #[Test] public function shouldGetAllLists(): void { @@ -123,6 +128,7 @@ public function shouldGetAllLists(): void $this->assertEquals($expectedArray, $api->allLists(1, 2)); } + #[Test] public function shouldGetList(): void { @@ -147,6 +153,7 @@ public function shouldGetList(): void $this->assertEquals($expectedArray, $api->showList(1, 2, 3)); } + #[Test] public function shouldCreateList(): void { @@ -171,6 +178,7 @@ public function shouldCreateList(): void $this->assertEquals($expectedArray, $api->createList(1, 2, 4)); } + #[Test] public function shouldUpdateList(): void { @@ -195,6 +203,7 @@ public function shouldUpdateList(): void $this->assertEquals($expectedArray, $api->updateList(5, 2, 3, 1)); } + #[Test] public function shouldDeleteList(): void { diff --git a/tests/Api/IssueLinksTest.php b/tests/Api/IssueLinksTest.php index b6ad78f9..b9f4207c 100644 --- a/tests/Api/IssueLinksTest.php +++ b/tests/Api/IssueLinksTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\IssueLinks; +use PHPUnit\Framework\Attributes\Test; class IssueLinksTest extends TestCase { @@ -26,6 +26,7 @@ protected function getApiClass() { return IssueLinks::class; } + #[Test] public function shouldGetIssueLinks(): void { @@ -43,6 +44,7 @@ public function shouldGetIssueLinks(): void $this->assertEquals($expectedArray, $api->all(1, 10)); } + #[Test] public function shouldCreateIssueLink(): void { @@ -60,6 +62,7 @@ public function shouldCreateIssueLink(): void $this->assertEquals($expectedArray, $api->create(1, 10, 2, 20)); } + #[Test] public function shouldRemoveIssueLink(): void { diff --git a/tests/Api/IssueSubscribeTest.php b/tests/Api/IssueSubscribeTest.php index 674a1724..dea23ec0 100644 --- a/tests/Api/IssueSubscribeTest.php +++ b/tests/Api/IssueSubscribeTest.php @@ -14,7 +14,6 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Issues; /** diff --git a/tests/Api/IssuesStatisticsTest.php b/tests/Api/IssuesStatisticsTest.php index 88cc0d07..60800c70 100644 --- a/tests/Api/IssuesStatisticsTest.php +++ b/tests/Api/IssuesStatisticsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\IssuesStatistics; +use PHPUnit\Framework\Attributes\Test; class IssuesStatisticsTest extends TestCase { @@ -64,6 +64,7 @@ public function shouldGetAll(): void 'confidential' => false, ])); } + #[Test] public function shouldGetProject(): void { @@ -77,6 +78,7 @@ public function shouldGetProject(): void $this->assertEquals($expectedArray, $api->project(1, [])); } + #[Test] public function shouldGetGroup(): void { diff --git a/tests/Api/IssuesTest.php b/tests/Api/IssuesTest.php index 0c9abc72..3c32b9a8 100644 --- a/tests/Api/IssuesTest.php +++ b/tests/Api/IssuesTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Issues; +use PHPUnit\Framework\Attributes\Test; class IssuesTest extends TestCase { @@ -36,6 +36,7 @@ public function shouldGetAllIssues(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldGetAllGroupIssues(): void { @@ -53,6 +54,7 @@ public function shouldGetAllGroupIssues(): void $this->assertEquals($expectedArray, $api->group(1)); } + #[Test] public function shouldGetGroupIssuesWithPagination(): void { @@ -70,6 +72,7 @@ public function shouldGetGroupIssuesWithPagination(): void $this->assertEquals($expectedArray, $api->group(1, ['page' => 2, 'per_page' => 5])); } + #[Test] public function shouldGetGroupIssuesWithParams(): void { @@ -87,6 +90,7 @@ public function shouldGetGroupIssuesWithParams(): void $this->assertEquals($expectedArray, $api->group(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_title' => 'Title', 'assignee_id' => 1])); } + #[Test] public function shouldGetProjectIssuesWithPagination(): void { @@ -104,6 +108,7 @@ public function shouldGetProjectIssuesWithPagination(): void $this->assertEquals($expectedArray, $api->all(1, ['page' => 2, 'per_page' => 5])); } + #[Test] public function shouldGetProjectIssuesWithParams(): void { @@ -121,6 +126,7 @@ public function shouldGetProjectIssuesWithParams(): void $this->assertEquals($expectedArray, $api->all(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_id' => 1, 'assignee_id' => 2])); } + #[Test] public function shouldShowIssue(): void { @@ -135,6 +141,7 @@ public function shouldShowIssue(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } + #[Test] public function shouldCreateIssue(): void { @@ -149,6 +156,7 @@ public function shouldCreateIssue(): void $this->assertEquals($expectedArray, $api->create(1, ['title' => 'A new issue', 'labels' => 'foo,bar'])); } + #[Test] public function shouldUpdateIssue(): void { @@ -163,6 +171,7 @@ public function shouldUpdateIssue(): void $this->assertEquals($expectedArray, $api->update(1, 2, ['title' => 'A renamed issue', 'labels' => 'foo'])); } + #[Test] public function shouldReorderIssue(): void { @@ -175,6 +184,7 @@ public function shouldReorderIssue(): void ; $this->assertEquals($expectedArray, $api->reorder(1, 2, ['move_after_id' => 3, 'move_before_id' => 4])); } + #[Test] public function shouldMoveIssue(): void { @@ -189,6 +199,7 @@ public function shouldMoveIssue(): void $this->assertEquals($expectedArray, $api->move(1, 2, 3)); } + #[Test] public function shouldGetNotes(): void { @@ -206,6 +217,7 @@ public function shouldGetNotes(): void $this->assertEquals($expectedArray, $api->showNotes(1, 2)); } + #[Test] public function shouldGetNote(): void { @@ -220,6 +232,7 @@ public function shouldGetNote(): void $this->assertEquals($expectedArray, $api->showNote(1, 2, 3)); } + #[Test] public function shouldCreateNote(): void { @@ -234,6 +247,7 @@ public function shouldCreateNote(): void $this->assertEquals($expectedArray, $api->addNote(1, 2, 'A new note')); } + #[Test] public function shouldUpdateNote(): void { @@ -248,6 +262,7 @@ public function shouldUpdateNote(): void $this->assertEquals($expectedArray, $api->updateNote(1, 2, 3, 'An edited comment')); } + #[Test] public function shouldRemoveNote(): void { @@ -261,6 +276,7 @@ public function shouldRemoveNote(): void $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); } + #[Test] public function shouldGetIssueDiscussions(): void { @@ -278,6 +294,7 @@ public function shouldGetIssueDiscussions(): void $this->assertEquals($expectedArray, $api->showDiscussions(1, 2)); } + #[Test] public function shouldGetIssueDiscussion(): void { @@ -292,6 +309,7 @@ public function shouldGetIssueDiscussion(): void $this->assertEquals($expectedArray, $api->showDiscussion(1, 2, 'abc')); } + #[Test] public function shouldCreateDiscussion(): void { @@ -306,6 +324,7 @@ public function shouldCreateDiscussion(): void $this->assertEquals($expectedArray, $api->addDiscussion(1, 2, 'A new discussion')); } + #[Test] public function shouldCreateDiscussionNote(): void { @@ -320,6 +339,7 @@ public function shouldCreateDiscussionNote(): void $this->assertEquals($expectedArray, $api->addDiscussionNote(1, 2, 'abc', 'A new discussion note')); } + #[Test] public function shouldUpdateDiscussionNote(): void { @@ -334,6 +354,7 @@ public function shouldUpdateDiscussionNote(): void $this->assertEquals($expectedArray, $api->updateDiscussionNote(1, 2, 'abc', 3, 'An edited discussion note')); } + #[Test] public function shouldRemoveDiscussionNote(): void { @@ -347,6 +368,7 @@ public function shouldRemoveDiscussionNote(): void $this->assertEquals($expectedBool, $api->removeDiscussionNote(1, 2, 'abc', 3)); } + #[Test] public function shouldSetTimeEstimate(): void { @@ -361,6 +383,7 @@ public function shouldSetTimeEstimate(): void $this->assertEquals($expectedArray, $api->setTimeEstimate(1, 2, '4h')); } + #[Test] public function shouldResetTimeEstimate(): void { @@ -375,6 +398,7 @@ public function shouldResetTimeEstimate(): void $this->assertEquals($expectedArray, $api->resetTimeEstimate(1, 2)); } + #[Test] public function shouldAddSpentTime(): void { @@ -389,6 +413,7 @@ public function shouldAddSpentTime(): void $this->assertEquals($expectedArray, $api->addSpentTime(1, 2, '4h')); } + #[Test] public function shouldResetSpentTime(): void { @@ -403,6 +428,7 @@ public function shouldResetSpentTime(): void $this->assertEquals($expectedArray, $api->resetSpentTime(1, 2)); } + #[Test] public function shouldGetIssueTimeStats(): void { @@ -417,6 +443,7 @@ public function shouldGetIssueTimeStats(): void $this->assertEquals($expectedArray, $api->getTimeStats(1, 2)); } + #[Test] public function shouldIssueAwardEmoji(): void { @@ -434,6 +461,7 @@ public function shouldIssueAwardEmoji(): void $this->assertEquals($expectedArray, $api->awardEmoji(1, 2)); } + #[Test] public function shouldRevokeAwardEmoji(): void { @@ -447,6 +475,7 @@ public function shouldRevokeAwardEmoji(): void $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); } + #[Test] public function shouldGetIssueClosedByMergeRequests(): void { @@ -464,6 +493,7 @@ public function shouldGetIssueClosedByMergeRequests(): void $this->assertEquals($expectedArray, $api->closedByMergeRequests(1, 2)); } + #[Test] public function shouldGetIssueRelatedMergeRequests(): void { @@ -481,6 +511,7 @@ public function shouldGetIssueRelatedMergeRequests(): void $this->assertEquals($expectedArray, $api->relatedMergeRequests(1, 2)); } + #[Test] public function shouldGetProjectIssuesByAssignee(): void { @@ -498,6 +529,7 @@ public function shouldGetProjectIssuesByAssignee(): void $this->assertEquals($expectedArray, $api->all(1, ['assignee_id' => 1])); } + #[Test] public function shouldGetIssueParticipants(): void { @@ -529,6 +561,7 @@ public function shouldGetIssueParticipants(): void $this->assertEquals($expectedArray, $api->showParticipants(1, 2)); } + #[Test] public function shouldGetIssueResourceLabelEvents(): void { @@ -546,6 +579,7 @@ public function shouldGetIssueResourceLabelEvents(): void $this->assertEquals($expectedArray, $api->showResourceLabelEvents(1, 2)); } + #[Test] public function shouldGetIssueResourceLabelEvent(): void { diff --git a/tests/Api/JobsTest.php b/tests/Api/JobsTest.php index edafb8b6..4239049c 100644 --- a/tests/Api/JobsTest.php +++ b/tests/Api/JobsTest.php @@ -14,10 +14,10 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Jobs; -use PHPUnit\Framework\Attributes\Test; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\Test; class JobsTest extends TestCase { @@ -40,6 +40,7 @@ public function shouldGetAllJobs(): void $this->assertEquals($expectedArray, $api->all(1, ['scope' => Jobs::SCOPE_PENDING])); } + #[Test] public function shouldGetPipelineJobs(): void { @@ -59,6 +60,7 @@ public function shouldGetPipelineJobs(): void $this->assertEquals($expectedArray, $api->pipelineJobs(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING]])); } + #[Test] public function shouldGetPipelineJobsIncludingRetried(): void { @@ -80,6 +82,7 @@ public function shouldGetPipelineJobsIncludingRetried(): void $this->assertEquals($expectedArray, $api->pipelineJobs(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING], 'include_retried' => true])); } + #[Test] public function shouldGetPipelineBridges(): void { @@ -99,6 +102,7 @@ public function shouldGetPipelineBridges(): void $this->assertEquals($expectedArray, $api->pipelineBridges(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING]])); } + #[Test] public function shouldGetJob(): void { @@ -113,6 +117,7 @@ public function shouldGetJob(): void $this->assertEquals($expectedArray, $api->show(1, 3)); } + #[Test] public function shouldGetArtifacts(): void { @@ -126,6 +131,7 @@ public function shouldGetArtifacts(): void $this->assertEquals('foobar', $api->artifacts(1, 3)->getContents()); } + #[Test] public function shouldGetArtifactsByJobId(): void { @@ -139,6 +145,7 @@ public function shouldGetArtifactsByJobId(): void $this->assertEquals('foobar', $api->artifactByJobId(1, 3, 'artifact_path')->getContents()); } + #[Test] public function shouldGetArtifactsByRefName(): void { @@ -154,6 +161,7 @@ public function shouldGetArtifactsByRefName(): void $this->assertEquals('foobar', $api->artifactsByRefName(1, 'master', 'job name')->getContents()); } + #[Test] public function shouldGetArtifactByRefName(): void { @@ -168,6 +176,7 @@ public function shouldGetArtifactByRefName(): void $this->assertEquals('foobar', $api->artifactByRefName(1, 'master', 'job name', 'artifact_path')->getContents()); } + #[Test] public function shouldGetTrace(): void { @@ -181,6 +190,7 @@ public function shouldGetTrace(): void $this->assertEquals($expectedString, $api->trace(1, 3)); } + #[Test] public function shouldCancel(): void { @@ -195,6 +205,7 @@ public function shouldCancel(): void $this->assertEquals($expectedArray, $api->cancel(1, 3)); } + #[Test] public function shouldRetry(): void { @@ -209,6 +220,7 @@ public function shouldRetry(): void $this->assertEquals($expectedArray, $api->retry(1, 3)); } + #[Test] public function shouldErase(): void { @@ -223,6 +235,7 @@ public function shouldErase(): void $this->assertEquals($expectedArray, $api->erase(1, 3)); } + #[Test] public function shouldKeepArtifacts(): void { @@ -237,6 +250,7 @@ public function shouldKeepArtifacts(): void $this->assertEquals($expectedArray, $api->keepArtifacts(1, 3)); } + #[Test] public function shouldPlay(): void { diff --git a/tests/Api/KeysTest.php b/tests/Api/KeysTest.php index 8509a5f2..b3d9f561 100644 --- a/tests/Api/KeysTest.php +++ b/tests/Api/KeysTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Keys; +use PHPUnit\Framework\Attributes\Test; class KeysTest extends TestCase { diff --git a/tests/Api/MergeRequestsTest.php b/tests/Api/MergeRequestsTest.php index aaed46d9..f31f4961 100644 --- a/tests/Api/MergeRequestsTest.php +++ b/tests/Api/MergeRequestsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\MergeRequests; +use PHPUnit\Framework\Attributes\Test; class MergeRequestsTest extends TestCase { @@ -33,6 +33,7 @@ public function shouldGetAll(): void $this->assertEquals($expectedArray, $api->all(1)); } + #[Test] public function shouldGetAllWithNoProject(): void { @@ -47,6 +48,7 @@ public function shouldGetAllWithNoProject(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldGetAllWithParams(): void { @@ -91,6 +93,7 @@ public function shouldGetAllWithParams(): void 'approved_by_ids' => [1], ])); } + #[Test] public function shouldGetAllWithDateTimeParams(): void { @@ -116,6 +119,7 @@ public function shouldGetAllWithDateTimeParams(): void $api->all(1, ['created_after' => $createdAfter, 'created_before' => $createdBefore]) ); } + #[Test] public function shouldShowMergeRequest(): void { @@ -130,6 +134,7 @@ public function shouldShowMergeRequest(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } + #[Test] public function shouldShowMergeRequestWithOptionalParameters(): void { @@ -152,6 +157,7 @@ public function shouldShowMergeRequestWithOptionalParameters(): void 'include_rebase_in_progress' => true, ])); } + #[Test] public function shouldCreateMergeRequestWithoutOptionalParams(): void { @@ -170,6 +176,7 @@ public function shouldCreateMergeRequestWithoutOptionalParams(): void $this->assertEquals($expectedArray, $api->create(1, 'develop', 'master', 'Merge Request')); } + #[Test] public function shouldCreateMergeRequestWithOptionalParams(): void { @@ -201,6 +208,7 @@ public function shouldCreateMergeRequestWithOptionalParams(): void ) ); } + #[Test] public function shouldUpdateMergeRequest(): void { @@ -219,6 +227,7 @@ public function shouldUpdateMergeRequest(): void 'state_event' => 'close', ])); } + #[Test] public function shouldMergeMergeRequest(): void { @@ -233,6 +242,7 @@ public function shouldMergeMergeRequest(): void $this->assertEquals($expectedArray, $api->merge(1, 2, ['merge_commit_message' => 'Accepted'])); } + #[Test] public function shouldGetNotes(): void { @@ -250,6 +260,7 @@ public function shouldGetNotes(): void $this->assertEquals($expectedArray, $api->showNotes(1, 2)); } + #[Test] public function shouldGetNote(): void { @@ -264,6 +275,7 @@ public function shouldGetNote(): void $this->assertEquals($expectedArray, $api->showNote(1, 2, 3)); } + #[Test] public function shouldCreateNote(): void { @@ -278,6 +290,7 @@ public function shouldCreateNote(): void $this->assertEquals($expectedArray, $api->addNote(1, 2, 'A new note')); } + #[Test] public function shouldUpdateNote(): void { @@ -292,6 +305,7 @@ public function shouldUpdateNote(): void $this->assertEquals($expectedArray, $api->updateNote(1, 2, 3, 'An edited comment')); } + #[Test] public function shouldRemoveNote(): void { @@ -305,6 +319,7 @@ public function shouldRemoveNote(): void $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); } + #[Test] public function shouldGetMergeRequestParticipants(): void { @@ -336,6 +351,7 @@ public function shouldGetMergeRequestParticipants(): void $this->assertEquals($expectedArray, $api->showParticipants(1, 2)); } + #[Test] public function shouldGetMergeRequestChanges(): void { @@ -350,6 +366,7 @@ public function shouldGetMergeRequestChanges(): void $this->assertEquals($expectedArray, $api->changes(1, 2)); } + #[Test] public function shouldGetMergeRequestDiscussions(): void { @@ -367,6 +384,7 @@ public function shouldGetMergeRequestDiscussions(): void $this->assertEquals($expectedArray, $api->showDiscussions(1, 2)); } + #[Test] public function shouldGetMergeRequestDiscussion(): void { @@ -381,6 +399,7 @@ public function shouldGetMergeRequestDiscussion(): void $this->assertEquals($expectedArray, $api->showDiscussion(1, 2, 'abc')); } + #[Test] public function shouldCreateDiscussion(): void { @@ -395,6 +414,7 @@ public function shouldCreateDiscussion(): void $this->assertEquals($expectedArray, $api->addDiscussion(1, 2, ['body' => 'A new discussion'])); } + #[Test] public function shouldResolveDiscussion(): void { @@ -409,6 +429,7 @@ public function shouldResolveDiscussion(): void $this->assertEquals($expectedArray, $api->resolveDiscussion(1, 2, 'abc', true)); } + #[Test] public function shouldUnresolveDiscussion(): void { @@ -423,6 +444,7 @@ public function shouldUnresolveDiscussion(): void $this->assertEquals($expectedArray, $api->resolveDiscussion(1, 2, 'abc', false)); } + #[Test] public function shouldCreateDiscussionNote(): void { @@ -437,6 +459,7 @@ public function shouldCreateDiscussionNote(): void $this->assertEquals($expectedArray, $api->addDiscussionNote(1, 2, 'abc', 'A new discussion note')); } + #[Test] public function shouldUpdateDiscussionNote(): void { @@ -451,6 +474,7 @@ public function shouldUpdateDiscussionNote(): void $this->assertEquals($expectedArray, $api->updateDiscussionNote(1, 2, 'abc', 3, ['body' => 'An edited discussion note'])); } + #[Test] public function shouldRemoveDiscussionNote(): void { @@ -464,6 +488,7 @@ public function shouldRemoveDiscussionNote(): void $this->assertEquals($expectedBool, $api->removeDiscussionNote(1, 2, 'abc', 3)); } + #[Test] public function shouldGetIssuesClosedByMergeRequest(): void { @@ -478,6 +503,7 @@ public function shouldGetIssuesClosedByMergeRequest(): void $this->assertEquals($expectedArray, $api->closesIssues(1, 2)); } + #[Test] public function shouldGetMergeRequestByIid(): void { @@ -492,6 +518,7 @@ public function shouldGetMergeRequestByIid(): void $this->assertEquals($expectedArray, $api->all(1, ['iids' => [2]])); } + #[Test] public function shouldApproveMergeRequest(): void { @@ -506,6 +533,7 @@ public function shouldApproveMergeRequest(): void $this->assertEquals($expectedArray, $api->approve(1, 2)); } + #[Test] public function shouldUnApproveMergeRequest(): void { @@ -520,6 +548,7 @@ public function shouldUnApproveMergeRequest(): void $this->assertEquals($expectedArray, $api->unapprove(1, 2)); } + #[Test] public function shouldGetMergeRequestApprovals(): void { @@ -534,6 +563,7 @@ public function shouldGetMergeRequestApprovals(): void $this->assertEquals($expectedArray, $api->all(1, ['iids' => [2]])); } + #[Test] public function shouldIssueMergeRequestAwardEmoji(): void { @@ -551,6 +581,7 @@ public function shouldIssueMergeRequestAwardEmoji(): void $this->assertEquals($expectedArray, $api->awardEmoji(1, 2)); } + #[Test] public function shouldRevokeMergeRequestAwardEmoji(): void { @@ -564,6 +595,7 @@ public function shouldRevokeMergeRequestAwardEmoji(): void $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); } + #[Test] public function shoudGetApprovalState(): void { @@ -580,6 +612,7 @@ public function shoudGetApprovalState(): void $this->assertEquals($expectedArray, $api->approvalState(1, 2)); } + #[Test] public function shoudGetLevelRules(): void { @@ -607,6 +640,7 @@ public function shoudGetLevelRules(): void $this->assertEquals($expectedArray, $api->levelRules(1, 2)); } + #[Test] public function shoudCreateLevelRuleWithoutOptionalParameters(): void { @@ -638,6 +672,7 @@ public function shoudCreateLevelRuleWithoutOptionalParameters(): void $this->assertEquals($expectedArray, $api->createLevelRule(1, 2, 'Foo', 3)); } + #[Test] public function shoudCreateLevelRuleWithOptionalParameters(): void { @@ -674,6 +709,7 @@ public function shoudCreateLevelRuleWithOptionalParameters(): void 'group_ids' => [104121], ])); } + #[Test] public function shoudUpdateLevelRuleWithoutOptionalParameters(): void { @@ -705,6 +741,7 @@ public function shoudUpdateLevelRuleWithoutOptionalParameters(): void $this->assertEquals($expectedArray, $api->updateLevelRule(1, 2, 20892835, 'Foo', 3)); } + #[Test] public function shoudUpdateLevelRuleWithOptionalParameters(): void { @@ -741,6 +778,7 @@ public function shoudUpdateLevelRuleWithOptionalParameters(): void 'group_ids' => [104121], ])); } + #[Test] public function shoudDeleteLevelRule(): void { @@ -767,6 +805,7 @@ protected function getApiClass() { return MergeRequests::class; } + #[Test] public function shouldRebaseMergeRequest(): void { diff --git a/tests/Api/MilestonesTest.php b/tests/Api/MilestonesTest.php index 696ce965..e1d0e6c3 100644 --- a/tests/Api/MilestonesTest.php +++ b/tests/Api/MilestonesTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Milestones; +use PHPUnit\Framework\Attributes\Test; class MilestonesTest extends TestCase { @@ -36,6 +36,7 @@ public function shouldGetAllMilestones(): void $this->assertEquals($expectedArray, $api->all(1)); } + #[Test] public function shouldShowMilestone(): void { @@ -50,6 +51,7 @@ public function shouldShowMilestone(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } + #[Test] public function shouldCreateMilestone(): void { @@ -64,6 +66,7 @@ public function shouldCreateMilestone(): void $this->assertEquals($expectedArray, $api->create(1, ['description' => 'Some text', 'title' => 'A new milestone'])); } + #[Test] public function shouldUpdateMilestone(): void { @@ -78,6 +81,7 @@ public function shouldUpdateMilestone(): void $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated milestone', 'due_date' => '2015-04-01', 'state_event' => 'close'])); } + #[Test] public function shouldRemoveMilestone(): void { @@ -91,6 +95,7 @@ public function shouldRemoveMilestone(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } + #[Test] public function shouldGetMilestonesIssues(): void { @@ -108,6 +113,7 @@ public function shouldGetMilestonesIssues(): void $this->assertEquals($expectedArray, $api->issues(1, 3)); } + #[Test] public function shouldGetMilestonesMergeRequests(): void { diff --git a/tests/Api/PackagesTest.php b/tests/Api/PackagesTest.php index 0e71a5d6..657c35d0 100644 --- a/tests/Api/PackagesTest.php +++ b/tests/Api/PackagesTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Packages; +use PHPUnit\Framework\Attributes\Test; final class PackagesTest extends TestCase { @@ -46,6 +46,7 @@ public function shouldGetAllPackages(): void $this->assertEquals($expectedArray, $api->all(1)); } + #[Test] public function shouldShowPackage(): void { @@ -61,6 +62,7 @@ public function shouldShowPackage(): void $this->assertEquals($expectedArray, $api->show(1, 1)); } + #[Test] public function shouldGetAllPackageFiles(): void { @@ -78,6 +80,7 @@ public function shouldGetAllPackageFiles(): void $this->assertEquals($expectedArray, $api->allFiles(1, 1)); } + #[Test] public function shouldRemovePackage(): void { @@ -91,6 +94,7 @@ public function shouldRemovePackage(): void $this->assertEquals($expectedBool, $api->remove(1, 1)); } + #[Test] public function shouldRemovePackageFile(): void { diff --git a/tests/Api/ProjectNamespacesTest.php b/tests/Api/ProjectNamespacesTest.php index 32af924b..b731b68c 100644 --- a/tests/Api/ProjectNamespacesTest.php +++ b/tests/Api/ProjectNamespacesTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ProjectNamespaces; +use PHPUnit\Framework\Attributes\Test; class ProjectNamespacesTest extends TestCase { @@ -36,6 +36,7 @@ public function shouldGetAllNamespaces(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldShowNamespace(): void { diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index f5ee3cf0..162fdfa4 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -14,12 +14,12 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use DateTime; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Projects; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\Test; class ProjectsTest extends TestCase { @@ -32,6 +32,7 @@ public function shouldGetAllProjects(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldGetAllProjectsSortedByName(): void { @@ -48,6 +49,7 @@ public function shouldGetAllProjectsSortedByName(): void $api->all(['page' => 1, 'per_page' => 5, 'order_by' => 'name', 'sort' => 'asc']) ); } + #[Test] public function shouldNotNeedPaginationWhenGettingProjects(): void { @@ -61,6 +63,7 @@ public function shouldNotNeedPaginationWhenGettingProjects(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldGetAccessibleProjects(): void { @@ -70,6 +73,7 @@ public function shouldGetAccessibleProjects(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldGetOwnedProjects(): void { @@ -79,6 +83,7 @@ public function shouldGetOwnedProjects(): void $this->assertEquals($expectedArray, $api->all(['owned' => true])); } + #[Test] public function shouldGetNotArchivedProjects(): void { @@ -88,6 +93,7 @@ public function shouldGetNotArchivedProjects(): void $this->assertEquals($expectedArray, $api->all(['archived' => false])); } + #[Test] #[DataProvider('possibleAccessLevels')] public function shouldGetProjectsWithMinimumAccessLevel($level): void @@ -98,6 +104,7 @@ public function shouldGetProjectsWithMinimumAccessLevel($level): void $this->assertEquals($expectedArray, $api->all(['min_access_level' => $level])); } + #[Test] public function shouldSearchProjects(): void { @@ -106,6 +113,7 @@ public function shouldSearchProjects(): void $api = $this->getMultipleProjectsRequestMock('projects', $expectedArray, ['search' => 'a project']); $this->assertEquals($expectedArray, $api->all(['search' => 'a project'])); } + #[Test] public function shouldSearchProjectsWithNamespace(): void { @@ -114,6 +122,7 @@ public function shouldSearchProjectsWithNamespace(): void $api = $this->getMultipleProjectsRequestMock('projects', $expectedArray, ['search' => 'a_project', 'search_namespaces' => 'true']); $this->assertEquals($expectedArray, $api->all(['search' => 'a_project', 'search_namespaces' => true])); } + #[Test] public function shouldGetProjectsAfterId(): void { @@ -123,6 +132,7 @@ public function shouldGetProjectsAfterId(): void $this->assertEquals($expectedArray, $api->all(['id_after' => 0])); } + #[Test] public function shouldGetProjectsWithLastActivityAfter(): void { @@ -134,6 +144,7 @@ public function shouldGetProjectsWithLastActivityAfter(): void $this->assertEquals($expectedArray, $api->all(['last_activity_after' => $unixEpochDateTime])); } + #[Test] public function shouldGetProjectsWithLastActivityBefore(): void { @@ -145,6 +156,7 @@ public function shouldGetProjectsWithLastActivityBefore(): void $this->assertEquals($expectedArray, $api->all(['last_activity_before' => $now])); } + #[Test] public function shouldGetProjectsWithoutFailedRepositoryChecksum(): void { @@ -154,6 +166,7 @@ public function shouldGetProjectsWithoutFailedRepositoryChecksum(): void $this->assertEquals($expectedArray, $api->all(['repository_checksum_failed' => false])); } + #[Test] public function shouldGetProjectsWithDefaultRepositoryStorage(): void { @@ -163,6 +176,7 @@ public function shouldGetProjectsWithDefaultRepositoryStorage(): void $this->assertEquals($expectedArray, $api->all(['repository_storage' => 'default'])); } + #[Test] public function shouldGetStarredProjects(): void { @@ -172,6 +186,7 @@ public function shouldGetStarredProjects(): void $this->assertEquals($expectedArray, $api->all(['starred' => true])); } + #[Test] public function shouldGetProjectsWithoutFailedWikiChecksum(): void { @@ -181,6 +196,7 @@ public function shouldGetProjectsWithoutFailedWikiChecksum(): void $this->assertEquals($expectedArray, $api->all(['wiki_checksum_failed' => false])); } + #[Test] public function shouldGetProjectsWithCustomAttributes(): void { @@ -190,6 +206,7 @@ public function shouldGetProjectsWithCustomAttributes(): void $this->assertEquals($expectedArray, $api->all(['with_custom_attributes' => true])); } + #[Test] public function shouldGetProjectsWithPhpProgrammingLanguage(): void { @@ -199,6 +216,7 @@ public function shouldGetProjectsWithPhpProgrammingLanguage(): void $this->assertEquals($expectedArray, $api->all(['with_programming_language' => 'php'])); } + #[Test] public function shouldShowProject(): void { @@ -212,6 +230,7 @@ public function shouldShowProject(): void $this->assertEquals($expectedArray, $api->show(1)); } + #[Test] public function shouldShowProjectWithStatistics(): void { @@ -235,6 +254,7 @@ public function shouldShowProjectWithStatistics(): void $this->assertEquals($expectedArray, $api->show(1, ['statistics' => true])); } + #[Test] public function shouldCreateProject(): void { @@ -250,6 +270,7 @@ public function shouldCreateProject(): void 'issues_enabled' => true, ])); } + #[Test] public function shouldUpdateProject(): void { @@ -266,6 +287,7 @@ public function shouldUpdateProject(): void 'issues_enabled' => true, ])); } + #[Test] public function shouldArchiveProject(): void { @@ -279,6 +301,7 @@ public function shouldArchiveProject(): void $this->assertEquals($expectedArray, $api->archive(1)); } + #[Test] public function shouldUnarchiveProject(): void { @@ -292,6 +315,7 @@ public function shouldUnarchiveProject(): void $this->assertEquals($expectedArray, $api->unarchive(1)); } + #[Test] public function shouldCreateProjectForUser(): void { @@ -307,6 +331,7 @@ public function shouldCreateProjectForUser(): void 'issues_enabled' => true, ])); } + #[Test] public function shouldRemoveProject(): void { @@ -320,6 +345,7 @@ public function shouldRemoveProject(): void $this->assertEquals($expectedBool, $api->remove(1)); } + #[Test] public function shouldGetPipelines(): void { @@ -337,6 +363,7 @@ public function shouldGetPipelines(): void $this->assertEquals($expectedArray, $api->pipelines(1)); } + #[Test] public function shouldGetTriggers(): void { @@ -353,6 +380,7 @@ public function shouldGetTriggers(): void $this->assertEquals($expectedArray, $api->triggers(1)); } + #[Test] public function shouldGetTrigger(): void { @@ -517,6 +545,7 @@ public function getProjectUsersExpectedArray() ], ]; } + #[Test] public function shouldGetBoards(): void { @@ -587,6 +616,7 @@ public function getProjectBoardsExpectedArray() ], ]; } + #[Test] public function shouldGetIterations(): void { @@ -616,6 +646,7 @@ public function shouldGetIterations(): void $this->assertEquals($expectedArray, $api->iterations(1)); } + #[Test] public function shouldCreateTrigger(): void { @@ -633,6 +664,7 @@ public function shouldCreateTrigger(): void $this->assertEquals($expectedArray, $api->createTrigger(1, 'foobar')); } + #[Test] public function shouldRemoveTrigger(): void { @@ -646,6 +678,7 @@ public function shouldRemoveTrigger(): void $this->assertEquals($expectedBool, $api->removeTrigger(1, 2)); } + #[Test] public function shouldTriggerPipeline(): void { @@ -667,6 +700,7 @@ public function shouldTriggerPipeline(): void $this->assertEquals($expectedArray, $api->triggerPipeline(1, 'master', 'some_token', ['VAR_1' => 'value 1'])); } + #[Test] public function shouldGetPipelinesWithBooleanParam(): void { @@ -684,6 +718,7 @@ public function shouldGetPipelinesWithBooleanParam(): void $this->assertEquals($expectedArray, $api->pipelines(1, ['yaml_errors' => false])); } + #[Test] public function shouldGetPipelineWithDateParam(): void { @@ -712,6 +747,7 @@ public function shouldGetPipelineWithDateParam(): void 'updated_before' => $updated_before, ])); } + #[Test] public function shouldGetPipelinesWithSHA(): void { @@ -729,6 +765,7 @@ public function shouldGetPipelinesWithSHA(): void $this->assertEquals($expectedArray, $api->pipelines(1, ['sha' => '123'])); } + #[Test] public function shouldGetPipeline(): void { @@ -746,6 +783,7 @@ public function shouldGetPipeline(): void $this->assertEquals($expectedArray, $api->pipeline(1, 3)); } + #[Test] public function shouldGetPipelineJobs(): void { @@ -763,6 +801,7 @@ public function shouldGetPipelineJobs(): void $this->assertEquals($expectedArray, $api->pipelineJobs(1, 3)); } + #[Test] public function shouldGetPipelineVariables(): void { @@ -779,6 +818,7 @@ public function shouldGetPipelineVariables(): void $this->assertEquals($expectedArray, $api->pipelineVariables(1, 3)); } + #[Test] public function shouldGetPipelineTestReport(): void { @@ -800,6 +840,7 @@ public function shouldGetPipelineTestReport(): void $this->assertEquals($expectedArray, $api->pipelineTestReport(1, 3)); } + #[Test] public function shouldGetPipelineTestReportSummary(): void { @@ -821,6 +862,7 @@ public function shouldGetPipelineTestReportSummary(): void $this->assertEquals($expectedArray, $api->pipelineTestReportSummary(1, 3)); } + #[Test] public function shouldCreatePipeline(): void { @@ -836,6 +878,7 @@ public function shouldCreatePipeline(): void $this->assertEquals($expectedArray, $api->createPipeline(1, 'test-pipeline')); } + #[Test] public function shouldCreatePipelineWithVariables(): void { @@ -862,6 +905,7 @@ public function shouldCreatePipelineWithVariables(): void $this->assertEquals($expectedArray, $api->createPipeline(1, 'test-pipeline', $variables)); } + #[Test] public function shouldRetryPipeline(): void { @@ -877,6 +921,7 @@ public function shouldRetryPipeline(): void $this->assertEquals($expectedArray, $api->retryPipeline(1, 4)); } + #[Test] public function shouldCancelPipeline(): void { @@ -892,6 +937,7 @@ public function shouldCancelPipeline(): void $this->assertEquals($expectedArray, $api->cancelPipeline(1, 6)); } + #[Test] public function shouldDeletePipeline(): void { @@ -905,6 +951,7 @@ public function shouldDeletePipeline(): void $this->assertEquals($expectedBool, $api->deletePipeline(1, 3)); } + #[Test] public function shouldGetAllMembers(): void { @@ -921,6 +968,7 @@ public function shouldGetAllMembers(): void $this->assertEquals($expectedArray, $api->allMembers(1)); } + #[Test] public function shouldGetAllMember(): void { @@ -934,6 +982,7 @@ public function shouldGetAllMember(): void $this->assertEquals($expectedArray, $api->allMember(1, 2)); } + #[Test] public function shouldGetMembers(): void { @@ -950,6 +999,7 @@ public function shouldGetMembers(): void $this->assertEquals($expectedArray, $api->members(1)); } + #[Test] public function shouldGetMembersWithQuery(): void { @@ -965,6 +1015,7 @@ public function shouldGetMembersWithQuery(): void $this->assertEquals($expectedArray, $api->members(1, ['query' => 'at'])); } + #[Test] public function shouldGetMembersWithNullQuery(): void { @@ -981,6 +1032,7 @@ public function shouldGetMembersWithNullQuery(): void $this->assertEquals($expectedArray, $api->members(1)); } + #[Test] public function shouldGetMembersWithPagination(): void { @@ -1000,6 +1052,7 @@ public function shouldGetMembersWithPagination(): void $this->assertEquals($expectedArray, $api->members(1, ['page' => 2, 'per_page' => 15])); } + #[Test] public function shouldGetMember(): void { @@ -1013,6 +1066,7 @@ public function shouldGetMember(): void $this->assertEquals($expectedArray, $api->member(1, 2)); } + #[Test] public function shouldAddMember(): void { @@ -1026,6 +1080,7 @@ public function shouldAddMember(): void $this->assertEquals($expectedArray, $api->addMember(1, 2, 3)); } + #[Test] public function shouldAddMemberWithExpiration(): void { @@ -1045,6 +1100,7 @@ public function shouldAddMemberWithExpiration(): void $this->assertEquals($expectedArray, $api->addMember(1, 3, 3, $expiration)); } + #[Test] public function shouldSaveMember(): void { @@ -1058,6 +1114,7 @@ public function shouldSaveMember(): void $this->assertEquals($expectedArray, $api->saveMember(1, 2, 4)); } + #[Test] public function shouldSaveMemberWithExpiration(): void { @@ -1077,6 +1134,7 @@ public function shouldSaveMemberWithExpiration(): void $this->assertEquals($expectedArray, $api->saveMember(1, 3, 4, $expiration)); } + #[Test] public function shouldRemoveMember(): void { @@ -1090,6 +1148,7 @@ public function shouldRemoveMember(): void $this->assertEquals($expectedBool, $api->removeMember(1, 2)); } + #[Test] public function shouldGetHooks(): void { @@ -1106,6 +1165,7 @@ public function shouldGetHooks(): void $this->assertEquals($expectedArray, $api->hooks(1)); } + #[Test] public function shouldGetHook(): void { @@ -1119,6 +1179,7 @@ public function shouldGetHook(): void $this->assertEquals($expectedArray, $api->hook(1, 2)); } + #[Test] public function shouldAddHook(): void { @@ -1141,6 +1202,7 @@ public function shouldAddHook(): void ['push_events' => true, 'issues_events' => true, 'merge_requests_events' => true] )); } + #[Test] public function shouldAddHookWithOnlyUrl(): void { @@ -1154,6 +1216,7 @@ public function shouldAddHookWithOnlyUrl(): void $this->assertEquals($expectedArray, $api->addHook(1, 'http://www.example.com/')); } + #[Test] public function shouldAddHookWithoutPushEvents(): void { @@ -1167,6 +1230,7 @@ public function shouldAddHookWithoutPushEvents(): void $this->assertEquals($expectedArray, $api->addHook(1, 'http://www.example.com/', ['push_events' => false])); } + #[Test] public function shouldUpdateHook(): void { @@ -1183,6 +1247,7 @@ public function shouldUpdateHook(): void $api->updateHook(1, 3, ['url' => 'http://www.example-test.com/', 'push_events' => false]) ); } + #[Test] public function shouldRemoveHook(): void { @@ -1196,6 +1261,7 @@ public function shouldRemoveHook(): void $this->assertEquals($expectedBool, $api->removeHook(1, 2)); } + #[Test] public function shouldTransfer(): void { @@ -1213,6 +1279,7 @@ public function shouldTransfer(): void $this->assertEquals($expectedArray, $api->transfer(1, 'a_namespace')); } + #[Test] public function shouldGetDeployKeys(): void { @@ -1229,6 +1296,7 @@ public function shouldGetDeployKeys(): void $this->assertEquals($expectedArray, $api->deployKeys(1)); } + #[Test] public function shouldGetDeployKey(): void { @@ -1242,6 +1310,7 @@ public function shouldGetDeployKey(): void $this->assertEquals($expectedArray, $api->deployKey(1, 2)); } + #[Test] public function shouldAddKey(): void { @@ -1255,6 +1324,7 @@ public function shouldAddKey(): void $this->assertEquals($expectedArray, $api->addDeployKey(1, 'new-key', '...')); } + #[Test] public function shouldAddKeyWithPushOption(): void { @@ -1268,6 +1338,7 @@ public function shouldAddKeyWithPushOption(): void $this->assertEquals($expectedArray, $api->addDeployKey(1, 'new-key', '...', true)); } + #[Test] public function shouldDeleteDeployKey(): void { @@ -1281,6 +1352,7 @@ public function shouldDeleteDeployKey(): void $this->assertEquals($expectedBool, $api->deleteDeployKey(1, 3)); } + #[Test] public function shoudEnableDeployKey(): void { @@ -1294,6 +1366,7 @@ public function shoudEnableDeployKey(): void $this->assertEquals($expectedBool, $api->enableDeployKey(1, 3)); } + #[Test] public function shouldGetDeployTokens(): void { @@ -1320,6 +1393,7 @@ public function shouldGetDeployTokens(): void $this->assertEquals($expectedArray, $api->deployTokens(1)); } + #[Test] public function shouldGetActiveDeployTokens(): void { @@ -1346,6 +1420,7 @@ public function shouldGetActiveDeployTokens(): void $this->assertEquals([], $api->deployTokens(1, true)); } + #[Test] public function shouldGetInactiveDeployTokens(): void { @@ -1372,6 +1447,7 @@ public function shouldGetInactiveDeployTokens(): void $this->assertEquals([], $api->deployTokens(1, false)); } + #[Test] public function shouldCreateDeployToken(): void { @@ -1414,6 +1490,7 @@ public function shouldCreateDeployToken(): void 'expires_at' => new DateTime('2021-01-01'), ])); } + #[Test] public function shouldDeleteDeployToken(): void { @@ -1427,6 +1504,7 @@ public function shouldDeleteDeployToken(): void $this->assertEquals($expectedBool, $api->deleteDeployToken(1, 2)); } + #[Test] public function shouldGetEvents(): void { @@ -1443,6 +1521,7 @@ public function shouldGetEvents(): void $this->assertEquals($expectedArray, $api->events(1)); } + #[Test] public function shouldGetEventsWithDateTimeParams(): void { @@ -1467,6 +1546,7 @@ public function shouldGetEventsWithDateTimeParams(): void $this->assertEquals($expectedArray, $api->events(1, ['after' => $after, 'before' => $before])); } + #[Test] public function shouldGetEventsWithPagination(): void { @@ -1486,6 +1566,7 @@ public function shouldGetEventsWithPagination(): void $this->assertEquals($expectedArray, $api->events(1, ['page' => 2, 'per_page' => 15])); } + #[Test] public function shouldGetLabels(): void { @@ -1502,6 +1583,7 @@ public function shouldGetLabels(): void $this->assertEquals($expectedArray, $api->labels(1)); } + #[Test] public function shouldAddLabel(): void { @@ -1515,6 +1597,7 @@ public function shouldAddLabel(): void $this->assertEquals($expectedArray, $api->addLabel(1, ['name' => 'wont-fix', 'color' => '#ffffff'])); } + #[Test] public function shouldUpdateLabel(): void { @@ -1531,6 +1614,7 @@ public function shouldUpdateLabel(): void $api->updateLabel(1, 123, ['new_name' => 'big-bug', 'color' => '#00ffff']) ); } + #[Test] public function shouldRemoveLabel(): void { @@ -1544,6 +1628,7 @@ public function shouldRemoveLabel(): void $this->assertEquals($expectedBool, $api->removeLabel(1, 456)); } + #[Test] public function shouldGetLanguages(): void { @@ -1555,6 +1640,7 @@ public function shouldGetLanguages(): void $this->assertEquals($expectedArray, $api->languages(1)); } + #[Test] public function shouldForkWithNamespace(): void { @@ -1572,6 +1658,7 @@ public function shouldForkWithNamespace(): void 'namespace' => 'new_namespace', ])); } + #[Test] public function shouldForkWithNamespaceAndPath(): void { @@ -1591,6 +1678,7 @@ public function shouldForkWithNamespaceAndPath(): void 'path' => 'new_path', ])); } + #[Test] public function shouldForkWithNamespaceAndPathAndName(): void { @@ -1612,6 +1700,7 @@ public function shouldForkWithNamespaceAndPathAndName(): void 'name' => 'new_name', ])); } + #[Test] public function shouldCreateForkRelation(): void { @@ -1625,6 +1714,7 @@ public function shouldCreateForkRelation(): void $this->assertEquals($expectedArray, $api->createForkRelation(1, 2)); } + #[Test] public function shouldRemoveForkRelation(): void { @@ -1638,6 +1728,7 @@ public function shouldRemoveForkRelation(): void $this->assertEquals($expectedBool, $api->removeForkRelation(2)); } + #[Test] public function shouldGetForks(): void { @@ -1663,6 +1754,7 @@ public function shouldGetForks(): void $this->assertEquals($expectedArray, $api->forks(1)); } + #[Test] public function shouldGetForksUsingParameters(): void { @@ -1725,6 +1817,7 @@ public function shouldGetForksUsingParameters(): void 'with_custom_attributes' => true, ])); } + #[Test] public function shouldSetService(): void { @@ -1738,6 +1831,7 @@ public function shouldSetService(): void $this->assertEquals($expectedBool, $api->setService(1, 'hipchat', ['param' => 'value'])); } + #[Test] public function shouldRemoveService(): void { @@ -1751,6 +1845,7 @@ public function shouldRemoveService(): void $this->assertEquals($expectedBool, $api->removeService(1, 'hipchat')); } + #[Test] public function shouldGetVariables(): void { @@ -1767,6 +1862,7 @@ public function shouldGetVariables(): void $this->assertEquals($expectedArray, $api->variables(1)); } + #[Test] public function shouldGetVariable(): void { @@ -1780,6 +1876,7 @@ public function shouldGetVariable(): void $this->assertEquals($expectedArray, $api->variable(1, 'ftp_username')); } + #[Test] public function shouldAddVariable(): void { @@ -1799,6 +1896,7 @@ public function shouldAddVariable(): void $this->assertEquals($expectedArray, $api->addVariable(1, $expectedKey, $expectedValue)); } + #[Test] public function shouldAddVariableWithProtected(): void { @@ -1816,6 +1914,7 @@ public function shouldAddVariableWithProtected(): void $this->assertEquals($expectedArray, $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); } + #[Test] public function shouldAddVariableWithEnvironment(): void { @@ -1836,6 +1935,7 @@ public function shouldAddVariableWithEnvironment(): void $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging') ); } + #[Test] public function shouldAddVariableWithProtectionAndEnvironment(): void { @@ -1857,6 +1957,7 @@ public function shouldAddVariableWithProtectionAndEnvironment(): void $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true, 'staging') ); } + #[Test] public function shouldAddVariableWithEnvironmentAndVariableType(): void { @@ -1878,6 +1979,7 @@ public function shouldAddVariableWithEnvironmentAndVariableType(): void $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging', ['variable_type' => 'file']) ); } + #[Test] public function shouldAddVariableWithEnvironmentFromParameterList(): void { @@ -1898,6 +2000,7 @@ public function shouldAddVariableWithEnvironmentFromParameterList(): void $api->addVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging', ['environment_scope' => 'production']) ); } + #[Test] public function shouldUpdateVariable(): void { @@ -1917,6 +2020,7 @@ public function shouldUpdateVariable(): void $this->assertEquals($expectedArray, $api->updateVariable(1, $expectedKey, $expectedValue)); } + #[Test] public function shouldUpdateVariableWithProtected(): void { @@ -1934,6 +2038,7 @@ public function shouldUpdateVariableWithProtected(): void $this->assertEquals($expectedArray, $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true)); } + #[Test] public function shouldUpdateVariableWithEnvironment(): void { @@ -1957,6 +2062,7 @@ public function shouldUpdateVariableWithEnvironment(): void $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging') ); } + #[Test] public function shouldUpdateVariableWithProtectedAndEnvironment(): void { @@ -1981,6 +2087,7 @@ public function shouldUpdateVariableWithProtectedAndEnvironment(): void $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', true, 'staging') ); } + #[Test] public function shouldUpdateVariableWithEnvironmentAndVariableType(): void { @@ -2005,6 +2112,7 @@ public function shouldUpdateVariableWithEnvironmentAndVariableType(): void $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging', ['variable_type' => 'file']) ); } + #[Test] public function shouldUpdateVariableWithEnvironmentFromParameterList(): void { @@ -2028,6 +2136,7 @@ public function shouldUpdateVariableWithEnvironmentFromParameterList(): void $api->updateVariable(1, 'DEPLOY_SERVER', 'stage.example.com', null, 'staging', ['environment_scope' => 'production']) ); } + #[Test] public function shouldRemoveVariable(): void { @@ -2052,6 +2161,7 @@ protected function getMultipleProjectsRequestMock($path, $expectedArray = [], $e return $api; } + #[Test] public function shouldGetDeployments(): void { @@ -2068,6 +2178,7 @@ public function shouldGetDeployments(): void $this->assertEquals($expectedArray, $api->deployments(1)); } + #[Test] public function shouldGetDeploymentsWithPagination(): void { @@ -2087,6 +2198,7 @@ public function shouldGetDeploymentsWithPagination(): void $this->assertEquals($expectedArray, $api->deployments(1, ['page' => 2, 'per_page' => 15])); } + #[Test] public function shouldGetDeploymentsSorted(): void { @@ -2118,6 +2230,7 @@ public function shouldGetDeploymentsSorted(): void $this->assertEquals(\array_reverse($expectedArray), $api->deployments(1, ['order_by' => 'id', 'sort' => 'desc'])); } + #[Test] public function shouldGetDeploymentsFiltered(): void { @@ -2188,6 +2301,7 @@ public function getBadgeExpectedArray() ], ]; } + #[Test] public function shouldGetBadges(): void { @@ -2201,6 +2315,7 @@ public function shouldGetBadges(): void $this->assertEquals($expectedArray, $api->badges(1)); } + #[Test] public function shouldGetBadge(): void { @@ -2217,6 +2332,7 @@ public function shouldGetBadge(): void $this->assertEquals($expectedArray, $api->badge(1, 1)); } + #[Test] public function shouldAddBadge(): void { @@ -2239,6 +2355,7 @@ public function shouldAddBadge(): void $api->addBadge(1, ['link_url' => $link_url, 'image_url' => $image_url]) ); } + #[Test] public function shouldUpdateBadge(): void { @@ -2255,6 +2372,7 @@ public function shouldUpdateBadge(): void $this->assertEquals($expectedArray, $api->updateBadge(1, 2, ['image_url' => $image_url])); } + #[Test] public function shouldRemoveBadge(): void { @@ -2268,6 +2386,7 @@ public function shouldRemoveBadge(): void $this->assertEquals($expectedBool, $api->removeBadge(1, 1)); } + #[Test] public function shouldAddProtectedBranch(): void { @@ -2292,6 +2411,7 @@ public function shouldAddProtectedBranch(): void ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addProtectedBranch(1, ['name' => 'master', 'push_access_level' => 0, 'merge_access_level' => 30])); } + #[Test] public function shouldRemoveProtectedBranch(): void { @@ -2306,6 +2426,7 @@ public function shouldRemoveProtectedBranch(): void $this->assertEquals($expectedBool, $api->deleteProtectedBranch(1, 'test-branch')); } + #[Test] public function shoudGetApprovalsConfiguration(): void { @@ -2328,6 +2449,7 @@ public function shoudGetApprovalsConfiguration(): void $this->assertEquals($expectedArray, $api->approvalsConfiguration(1)); } + #[Test] public function shoudGetApprovalsRules(): void { @@ -2353,6 +2475,7 @@ public function shoudGetApprovalsRules(): void $this->assertEquals($expectedArray, $api->approvalsRules(1)); } + #[Test] public function shoudCreateApprovalsRule(): void { @@ -2375,6 +2498,7 @@ public function shoudCreateApprovalsRule(): void 'rule_type' => 'any_approver', ])); } + #[Test] public function shoudUpdateApprovalsRule(): void { @@ -2394,6 +2518,7 @@ public function shoudUpdateApprovalsRule(): void 'name' => 'Updated Name', ])); } + #[Test] public function shoudDeleteApprovalsRule(): void { @@ -2407,6 +2532,7 @@ public function shoudDeleteApprovalsRule(): void $this->assertEquals($expectedBool, $api->deleteApprovalsRule(1, 1)); } + #[Test] public function shouldDeleteAllMergedBranches(): void { @@ -2420,6 +2546,7 @@ public function shouldDeleteAllMergedBranches(): void $this->assertEquals($expectedBool, $api->deleteAllMergedBranches(1)); } + #[Test] public function shouldGetProtectedBranches(): void { @@ -2452,6 +2579,7 @@ public function shouldGetProtectedBranches(): void $this->assertEquals($expectedArray, $api->protectedBranches(1)); } + #[Test] public function shouldGetProjectAccessTokens(): void { @@ -2478,6 +2606,7 @@ public function shouldGetProjectAccessTokens(): void $this->assertEquals($expectedArray, $api->projectAccessTokens(1)); } + #[Test] public function shouldGetProjectAccessToken(): void { @@ -2502,6 +2631,7 @@ public function shouldGetProjectAccessToken(): void $this->assertEquals($expectedArray, $api->projectAccessToken(1, 42)); } + #[Test] public function shouldCreateProjectAccessToken(): void { @@ -2546,6 +2676,7 @@ public function shouldCreateProjectAccessToken(): void 'expires_at' => new DateTime('2021-01-31'), ])); } + #[Test] public function shouldDeleteProjectAccessToken(): void { @@ -2559,6 +2690,7 @@ public function shouldDeleteProjectAccessToken(): void $this->assertEquals($expectedBool, $api->deleteProjectAccessToken(1, 2)); } + #[Test] public function shouldUploadAvatar(): void { @@ -2575,6 +2707,7 @@ public function shouldUploadAvatar(): void $this->assertEquals($expectedArray, $api->uploadAvatar(1, $fileName)); \unlink($fileName); } + #[Test] public function shouldAddProtectedTag(): void { @@ -2597,6 +2730,7 @@ public function shouldAddProtectedTag(): void ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->addProtectedTag(1, $params)); } + #[Test] public function shouldRemoveProtectedTag(): void { @@ -2616,6 +2750,7 @@ protected function getApiClass() { return Projects::class; } + #[Test] public function shouldSearchGroups(): void { diff --git a/tests/Api/RepositoriesTest.php b/tests/Api/RepositoriesTest.php index d437c730..6f7db5d8 100644 --- a/tests/Api/RepositoriesTest.php +++ b/tests/Api/RepositoriesTest.php @@ -14,10 +14,10 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Repositories; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\Test; class RepositoriesTest extends TestCase { @@ -38,6 +38,7 @@ public function shouldGetBranches(): void $this->assertEquals($expectedArray, $api->branches(1, ['search' => '^term'])); } + #[Test] public function shouldGetBranch(): void { @@ -52,6 +53,7 @@ public function shouldGetBranch(): void $this->assertEquals($expectedArray, $api->branch(1, 'master')); } + #[Test] public function shouldCreateBranch(): void { @@ -66,6 +68,7 @@ public function shouldCreateBranch(): void $this->assertEquals($expectedArray, $api->createBranch(1, 'feature', 'master')); } + #[Test] public function shouldDeleteBranch(): void { @@ -79,6 +82,7 @@ public function shouldDeleteBranch(): void $this->assertEquals($expectedBool, $api->deleteBranch(1, 'feature/TEST-15')); } + #[Test] public function shouldProtectBranch(): void { @@ -93,6 +97,7 @@ public function shouldProtectBranch(): void $this->assertEquals($expectedArray, $api->protectBranch(1, 'master')); } + #[Test] public function shouldProtectBranchWithPermissions(): void { @@ -107,6 +112,7 @@ public function shouldProtectBranchWithPermissions(): void $this->assertEquals($expectedArray, $api->protectBranch(1, 'master', true, true)); } + #[Test] public function shouldUnprotectBranch(): void { @@ -121,6 +127,7 @@ public function shouldUnprotectBranch(): void $this->assertEquals($expectedArray, $api->unprotectBranch(1, 'master')); } + #[Test] public function shouldGetTags(): void { @@ -138,6 +145,7 @@ public function shouldGetTags(): void $this->assertEquals($expectedArray, $api->tags(1, ['search' => '^term'])); } + #[Test] public function shouldCreateTag(): void { @@ -156,6 +164,7 @@ public function shouldCreateTag(): void $this->assertEquals($expectedArray, $api->createTag(1, '1.0', 'abcd1234', '1.0 release')); } + #[Test] public function shouldCreateRelease(): void { @@ -178,6 +187,7 @@ public function shouldCreateRelease(): void $this->assertEquals($expectedArray, $api->createRelease($project_id, $tagName, $description)); } + #[Test] public function shouldUpdateRelease(): void { @@ -200,6 +210,7 @@ public function shouldUpdateRelease(): void $this->assertEquals($expectedArray, $api->updateRelease($project_id, $tagName, $description)); } + #[Test] public function shouldGetReleases(): void { @@ -222,6 +233,7 @@ public function shouldGetReleases(): void $this->assertEquals($expectedArray, $api->releases($project_id)); } + #[Test] public function shouldGetCommits(): void { @@ -239,6 +251,7 @@ public function shouldGetCommits(): void $this->assertEquals($expectedArray, $api->commits(1)); } + #[Test] public function shouldGetCommitsWithParams(): void { @@ -256,6 +269,7 @@ public function shouldGetCommitsWithParams(): void $this->assertEquals($expectedArray, $api->commits(1, ['page' => 2, 'per_page' => 25, 'ref_name' => 'master', 'all' => true, 'with_stats' => true, 'path' => 'file_path/file_name'])); } + #[Test] public function shouldGetCommitsWithTimeParams(): void { @@ -281,6 +295,7 @@ public function shouldGetCommitsWithTimeParams(): void $this->assertEquals($expectedArray, $api->commits(1, ['since' => $since, 'until' => $until])); } + #[Test] public function shouldGetCommit(): void { @@ -295,6 +310,7 @@ public function shouldGetCommit(): void $this->assertEquals($expectedArray, $api->commit(1, 'abcd1234')); } + #[Test] public function shouldGetCommitRefs(): void { @@ -312,6 +328,7 @@ public function shouldGetCommitRefs(): void $this->assertEquals($expectedArray, $api->commitRefs(1, 'abcd1234')); } + #[Test] #[DataProvider('dataGetCommitRefsWithParams')] public function shouldGetCommitRefsWithParams(string $type, array $expectedArray): void @@ -339,6 +356,7 @@ public static function dataGetCommitRefsWithParams(): array ], ]; } + #[Test] public function shouldCreateCommit(): void { @@ -370,6 +388,7 @@ public function shouldCreateCommit(): void 'author_email' => 'john@example.com', ])); } + #[Test] public function shouldRevertCommit(): void { @@ -384,6 +403,7 @@ public function shouldRevertCommit(): void $this->assertEquals($expectedArray, $api->revertCommit(1, 'develop', 'abcd1234')); } + #[Test] public function shouldGetCommitComments(): void { @@ -401,6 +421,7 @@ public function shouldGetCommitComments(): void $this->assertEquals($expectedArray, $api->commitComments(1, 'abcd1234')); } + #[Test] public function shouldCreateCommitComment(): void { @@ -415,6 +436,7 @@ public function shouldCreateCommitComment(): void $this->assertEquals($expectedArray, $api->createCommitComment(1, 'abcd1234', 'A new comment')); } + #[Test] public function shouldCreateCommitCommentWithParams(): void { @@ -437,6 +459,7 @@ public function shouldCreateCommitCommentWithParams(): void 'line_type' => 'old', ])); } + #[Test] public function shouldCompareStraight(): void { @@ -451,6 +474,7 @@ public function shouldCompareStraight(): void $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature', true)); } + #[Test] public function shouldNotCompareStraight(): void { @@ -465,6 +489,7 @@ public function shouldNotCompareStraight(): void $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature')); } + #[Test] public function shouldCompareComplexBranchName(): void { @@ -479,6 +504,7 @@ public function shouldCompareComplexBranchName(): void $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature/760.fake-branch', true)); } + #[Test] public function shouldCompareWithFromProjectId(): void { @@ -493,6 +519,7 @@ public function shouldCompareWithFromProjectId(): void $this->assertEquals($expectedArray, $api->compare(1, 'master', 'feature', true, '123')); } + #[Test] public function shouldGetDiff(): void { @@ -510,6 +537,7 @@ public function shouldGetDiff(): void $this->assertEquals($expectedArray, $api->diff(1, 'abcd1234')); } + #[Test] public function shouldGetTree(): void { @@ -527,6 +555,7 @@ public function shouldGetTree(): void $this->assertEquals($expectedArray, $api->tree(1)); } + #[Test] public function shouldGetTreeWithParams(): void { @@ -544,6 +573,7 @@ public function shouldGetTreeWithParams(): void $this->assertEquals($expectedArray, $api->tree(1, ['path' => 'dir/', 'ref_name' => 'master'])); } + #[Test] public function shouldGetContributors(): void { @@ -561,6 +591,7 @@ public function shouldGetContributors(): void $this->assertEquals($expectedArray, $api->contributors(1)); } + #[Test] public function shouldGetMergeBase(): void { @@ -590,6 +621,7 @@ public function shouldGetMergeBase(): void $this->assertEquals($expectedArray, $api->mergeBase(1, ['efgh5678efgh5678efgh5678efgh5678efgh5678', '1234567812345678123456781234567812345678'])); } + #[Test] public function shouldCherryPick(): void { diff --git a/tests/Api/RepositoryFilesTest.php b/tests/Api/RepositoryFilesTest.php index 6b64719b..bf90ec42 100644 --- a/tests/Api/RepositoryFilesTest.php +++ b/tests/Api/RepositoryFilesTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\RepositoryFiles; +use PHPUnit\Framework\Attributes\Test; class RepositoryFilesTest extends TestCase { @@ -32,6 +32,7 @@ public function shouldGetBlob(): void $this->assertEquals($expectedString, $api->getRawFile(1, 'dir/file1.txt', 'abcd1234')); } + #[Test] public function shouldGetFile(): void { @@ -46,6 +47,7 @@ public function shouldGetFile(): void $this->assertEquals($expectedArray, $api->getFile(1, 'dir/file1.txt', 'abcd1234')); } + #[Test] public function shouldCreateFile(): void { @@ -70,6 +72,7 @@ public function shouldCreateFile(): void 'commit_message' => 'Added new file', ])); } + #[Test] public function shouldCreateFileWithEncoding(): void { @@ -96,6 +99,7 @@ public function shouldCreateFileWithEncoding(): void 'encoding' => 'text', ])); } + #[Test] public function shouldCreateFileWithAuthor(): void { @@ -124,6 +128,7 @@ public function shouldCreateFileWithAuthor(): void 'author_name' => 'GitLab User', ])); } + #[Test] public function shouldUpdateFile(): void { @@ -148,6 +153,7 @@ public function shouldUpdateFile(): void 'commit_message' => 'Updated new file', ])); } + #[Test] public function shouldUpdateFileWithEncoding(): void { @@ -174,6 +180,7 @@ public function shouldUpdateFileWithEncoding(): void 'encoding' => 'base64', ])); } + #[Test] public function shouldUpdateFileWithAuthor(): void { @@ -202,6 +209,7 @@ public function shouldUpdateFileWithAuthor(): void 'author_name' => 'GitLab User', ])); } + #[Test] public function shouldDeleteFile(): void { @@ -224,6 +232,7 @@ public function shouldDeleteFile(): void 'commit_message' => 'Deleted file', ])); } + #[Test] public function shouldDeleteFileWithAuthor(): void { diff --git a/tests/Api/ResourceIterationEventsTest.php b/tests/Api/ResourceIterationEventsTest.php index 25a9c0a4..28b86ecd 100644 --- a/tests/Api/ResourceIterationEventsTest.php +++ b/tests/Api/ResourceIterationEventsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ResourceIterationEvents; +use PHPUnit\Framework\Attributes\Test; class ResourceIterationEventsTest extends TestCase { @@ -87,6 +87,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all(1, 253)); } + #[Test] public function shouldShowEvent(): void { diff --git a/tests/Api/ResourceLabelEventsTest.php b/tests/Api/ResourceLabelEventsTest.php index 2d69b50b..8a2651ef 100644 --- a/tests/Api/ResourceLabelEventsTest.php +++ b/tests/Api/ResourceLabelEventsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ResourceLabelEvents; +use PHPUnit\Framework\Attributes\Test; class ResourceLabelEventsTest extends TestCase { @@ -75,6 +75,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all(1, 253)); } + #[Test] public function shouldShowEvent(): void { diff --git a/tests/Api/ResourceMilestoneEventsTest.php b/tests/Api/ResourceMilestoneEventsTest.php index 6bcaf976..4fb35335 100644 --- a/tests/Api/ResourceMilestoneEventsTest.php +++ b/tests/Api/ResourceMilestoneEventsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ResourceMilestoneEvents; +use PHPUnit\Framework\Attributes\Test; class ResourceMilestoneEventsTest extends TestCase { @@ -89,6 +89,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all(1, 253)); } + #[Test] public function shouldShowEvent(): void { diff --git a/tests/Api/ResourceStateEventsTest.php b/tests/Api/ResourceStateEventsTest.php index f273495d..cad7b710 100644 --- a/tests/Api/ResourceStateEventsTest.php +++ b/tests/Api/ResourceStateEventsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ResourceStateEvents; +use PHPUnit\Framework\Attributes\Test; class ResourceStateEventsTest extends TestCase { @@ -63,6 +63,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all(1, 11)); } + #[Test] public function shouldShowEvent(): void { diff --git a/tests/Api/ResourceWeightEventsTest.php b/tests/Api/ResourceWeightEventsTest.php index 5321d617..d554de7d 100644 --- a/tests/Api/ResourceWeightEventsTest.php +++ b/tests/Api/ResourceWeightEventsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\ResourceWeightEvents; +use PHPUnit\Framework\Attributes\Test; class ResourceWeightEventsTest extends TestCase { @@ -61,6 +61,7 @@ public function shouldGetAllEvents(): void $this->assertEquals($expectedArray, $api->all(1, 253)); } + #[Test] public function shouldShowEvent(): void { diff --git a/tests/Api/ScheduleTest.php b/tests/Api/ScheduleTest.php index 1f779478..e535ead4 100644 --- a/tests/Api/ScheduleTest.php +++ b/tests/Api/ScheduleTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Schedules; +use PHPUnit\Framework\Attributes\Test; class ScheduleTest extends TestCase { @@ -65,6 +65,7 @@ public function shouldCreateSchedule(): void ] )); } + #[Test] public function shouldShowSchedule(): void { @@ -79,6 +80,7 @@ public function shouldShowSchedule(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } + #[Test] public function shouldShowAllSchedule(): void { @@ -93,6 +95,7 @@ public function shouldShowAllSchedule(): void $this->assertEquals($expectedArray, $api->showAll(1)); } + #[Test] public function shouldUpdateSchedule(): void { @@ -107,6 +110,7 @@ public function shouldUpdateSchedule(): void $this->assertEquals($expectedArray, $api->update(1, 3, ['title' => 'Updated schedule', 'due_date' => '2015-04-01', 'state_event' => 'close'])); } + #[Test] public function shouldRemoveSchedule(): void { @@ -120,6 +124,7 @@ public function shouldRemoveSchedule(): void $this->assertEquals($expectedBool, $api->remove(1, 2)); } + #[Test] public function shouldCreateScheduleVariable(): void { @@ -141,6 +146,7 @@ public function shouldCreateScheduleVariable(): void $expectedArray )); } + #[Test] public function shouldUpdateScheduleVariable(): void { @@ -164,6 +170,7 @@ public function shouldUpdateScheduleVariable(): void $expectedArray )); } + #[Test] public function shouldRemoveScheduleVariable(): void { @@ -177,6 +184,7 @@ public function shouldRemoveScheduleVariable(): void $this->assertEquals($expectedBool, $api->removeVariable(1, 2, 'FOO_BAR')); } + #[Test] public function shouldTakeOwnership(): void { @@ -190,6 +198,7 @@ public function shouldTakeOwnership(): void $this->assertEquals($expectedBool, $api->takeOwnership(1, 2)); } + #[Test] public function shouldPlay(): void { diff --git a/tests/Api/SearchTest.php b/tests/Api/SearchTest.php index 443054df..3d52b13f 100644 --- a/tests/Api/SearchTest.php +++ b/tests/Api/SearchTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Search; +use PHPUnit\Framework\Attributes\Test; class SearchTest extends TestCase { diff --git a/tests/Api/SnippetsTest.php b/tests/Api/SnippetsTest.php index 17273e48..96032f52 100644 --- a/tests/Api/SnippetsTest.php +++ b/tests/Api/SnippetsTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Snippets; +use PHPUnit\Framework\Attributes\Test; class SnippetsTest extends TestCase { @@ -36,6 +36,7 @@ public function shouldGetAllSnippets(): void $this->assertEquals($expectedArray, $api->all(1)); } + #[Test] public function shouldShowSnippet(): void { @@ -50,6 +51,7 @@ public function shouldShowSnippet(): void $this->assertEquals($expectedArray, $api->show(1, 2)); } + #[Test] public function shouldCreateSnippet(): void { @@ -64,6 +66,7 @@ public function shouldCreateSnippet(): void $this->assertEquals($expectedArray, $api->create(1, 'A new snippet', 'file.txt', 'A file', 'public')); } + #[Test] public function shouldUpdateSnippet(): void { @@ -78,6 +81,7 @@ public function shouldUpdateSnippet(): void $this->assertEquals($expectedArray, $api->update(1, 3, ['file_name' => 'new_file.txt', 'code' => 'New content', 'title' => 'Updated snippet'])); } + #[Test] public function shouldShowContent(): void { @@ -91,6 +95,7 @@ public function shouldShowContent(): void $this->assertEquals($expectedString, $api->content(1, 3)); } + #[Test] public function shouldRemoveSnippet(): void { @@ -104,6 +109,7 @@ public function shouldRemoveSnippet(): void $this->assertEquals($expectedBool, $api->remove(1, 3)); } + #[Test] public function shouldGetNotes(): void { @@ -121,6 +127,7 @@ public function shouldGetNotes(): void $this->assertEquals($expectedArray, $api->showNotes(1, 2)); } + #[Test] public function shouldGetNote(): void { @@ -135,6 +142,7 @@ public function shouldGetNote(): void $this->assertEquals($expectedArray, $api->showNote(1, 2, 3)); } + #[Test] public function shouldCreateNote(): void { @@ -149,6 +157,7 @@ public function shouldCreateNote(): void $this->assertEquals($expectedArray, $api->addNote(1, 2, 'A new note')); } + #[Test] public function shouldUpdateNote(): void { @@ -163,6 +172,7 @@ public function shouldUpdateNote(): void $this->assertEquals($expectedArray, $api->updateNote(1, 2, 3, 'An edited comment')); } + #[Test] public function shouldRemoveNote(): void { @@ -176,6 +186,7 @@ public function shouldRemoveNote(): void $this->assertEquals($expectedBool, $api->removeNote(1, 2, 3)); } + #[Test] public function shouldIssueSnippetAwardEmoji(): void { @@ -193,6 +204,7 @@ public function shouldIssueSnippetAwardEmoji(): void $this->assertEquals($expectedArray, $api->awardEmoji(1, 2)); } + #[Test] public function shouldRevokeSnippetAwardEmoji(): void { diff --git a/tests/Api/SystemHooksTest.php b/tests/Api/SystemHooksTest.php index a33517a3..1a441995 100644 --- a/tests/Api/SystemHooksTest.php +++ b/tests/Api/SystemHooksTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\SystemHooks; +use PHPUnit\Framework\Attributes\Test; class SystemHooksTest extends TestCase { @@ -36,6 +36,7 @@ public function shouldGetAllHooks(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldCreateHook(): void { @@ -50,6 +51,7 @@ public function shouldCreateHook(): void $this->assertEquals($expectedArray, $api->create('http://www.example.net/')); } + #[Test] public function shouldTestHook(): void { @@ -63,6 +65,7 @@ public function shouldTestHook(): void $this->assertEquals($expectedBool, $api->test(3)); } + #[Test] public function shouldRemoveHook(): void { diff --git a/tests/Api/TagsTest.php b/tests/Api/TagsTest.php index 36c8ce7e..d8ee09c0 100644 --- a/tests/Api/TagsTest.php +++ b/tests/Api/TagsTest.php @@ -14,10 +14,10 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Tags; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\Test; class TagsTest extends TestCase { @@ -36,6 +36,7 @@ public function shouldGetAllTags(): void ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->all(1)); } + #[Test] public function shouldShowTag(): void { @@ -50,6 +51,7 @@ public function shouldShowTag(): void ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->show(1, 'v1.0.0')); } + #[Test] public function shouldCreateTag(): void { @@ -71,6 +73,7 @@ public function shouldCreateTag(): void $this->assertEquals($expectedArray, $api->create(1, $params)); } + #[Test] public function shouldRemoveTag(): void { @@ -85,6 +88,7 @@ public function shouldRemoveTag(): void ->willReturn($expectedArray); $this->assertEquals($expectedArray, $api->remove(1, 'v1.1.0')); } + #[Test] #[DataProvider('releaseDataProvider')] public function shouldCreateRelease(string $releaseName, string $description, array $expectedResult): void @@ -101,6 +105,7 @@ public function shouldCreateRelease(string $releaseName, string $description, ar $this->assertEquals($expectedResult, $api->createRelease(1, $releaseName, $params)); } + #[Test] #[DataProvider('releaseDataProvider')] public function shouldUpdateRelease(string $releaseName, string $description, array $expectedResult): void diff --git a/tests/Api/TestCase.php b/tests/Api/TestCase.php index c4d5a99d..ca5240ac 100644 --- a/tests/Api/TestCase.php +++ b/tests/Api/TestCase.php @@ -14,11 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Client; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase as BaseTestCase; -use PHPUnit\Framework\Attributes\Test; use Psr\Http\Client\ClientInterface; abstract class TestCase extends BaseTestCase diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index e13c8711..c1f15a0d 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -14,10 +14,10 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Users; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\Test; class UsersTest extends TestCase { @@ -38,6 +38,7 @@ public function shouldGetAllUsers(): void $this->assertEquals($expectedArray, $api->all()); } + #[Test] public function shouldGetActiveUsers(): void { @@ -55,6 +56,7 @@ public function shouldGetActiveUsers(): void $this->assertEquals($expectedArray, $api->all(['active' => true])); } + #[Test] public function shouldGetUsersWithDateTimeParams(): void { @@ -83,6 +85,7 @@ public function shouldGetUsersWithDateTimeParams(): void $api->all(['created_after' => $createdAfter, 'created_before' => $createdBefore]) ); } + #[Test] public function shouldShowUser(): void { @@ -127,6 +130,7 @@ protected function getUsersMembershipsRequestMock($path, $expectedArray = [], $e return $api; } + #[Test] public function shouldShowUsersMemberships(): void { @@ -136,6 +140,7 @@ public function shouldShowUsersMemberships(): void $this->assertEquals($expectedArray, $api->usersMemberships(1)); } + #[Test] public function shouldShowUsersMembershipsWithTypeProject(): void { @@ -145,6 +150,7 @@ public function shouldShowUsersMembershipsWithTypeProject(): void $this->assertEquals($expectedArray, $api->usersMemberships(1, ['type' => 'Project'])); } + #[Test] public function shouldShowUsersMembershipsWithTypeNamespace(): void { @@ -174,6 +180,7 @@ protected function getUsersProjectsRequestMock($path, $expectedArray = [], $expe return $api; } + #[Test] public function shouldShowUsersProjects(): void { @@ -183,6 +190,7 @@ public function shouldShowUsersProjects(): void $this->assertEquals($expectedArray, $api->usersProjects(1)); } + #[Test] public function shouldShowUsersProjectsWithLimit(): void { @@ -192,6 +200,7 @@ public function shouldShowUsersProjectsWithLimit(): void $this->assertEquals($expectedArray, $api->usersProjects(1, ['per_page' => 1])); } + #[Test] public function shouldGetAllUsersProjectsSortedByName(): void { @@ -208,6 +217,7 @@ public function shouldGetAllUsersProjectsSortedByName(): void $api->usersProjects(1, ['page' => 1, 'per_page' => 5, 'order_by' => 'name', 'sort' => 'asc']) ); } + #[Test] public function shouldGetNotArchivedUsersProjects(): void { @@ -217,6 +227,7 @@ public function shouldGetNotArchivedUsersProjects(): void $this->assertEquals($expectedArray, $api->usersProjects(1, ['archived' => false])); } + #[Test] public function shouldGetOwnedUsersProjects(): void { @@ -237,6 +248,7 @@ public static function possibleAccessLevels(): array [50], ]; } + #[Test] #[DataProvider('possibleAccessLevels')] public function shouldGetProjectsWithMinimumAccessLevel($level): void @@ -247,6 +259,7 @@ public function shouldGetProjectsWithMinimumAccessLevel($level): void $this->assertEquals($expectedArray, $api->usersProjects(1, ['min_access_level' => $level])); } + #[Test] public function shouldSearchUsersProjects(): void { @@ -255,6 +268,7 @@ public function shouldSearchUsersProjects(): void $api = $this->getUsersProjectsRequestMock('users/1/projects', $expectedArray, ['search' => 'a project']); $this->assertEquals($expectedArray, $api->usersProjects(1, ['search' => 'a project'])); } + #[Test] public function shouldShowUsersStarredProjects(): void { @@ -264,6 +278,7 @@ public function shouldShowUsersStarredProjects(): void $this->assertEquals($expectedArray, $api->usersStarredProjects(1)); } + #[Test] public function shouldShowUsersStarredProjectsWithLimit(): void { @@ -273,6 +288,7 @@ public function shouldShowUsersStarredProjectsWithLimit(): void $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['per_page' => 1])); } + #[Test] public function shouldGetAllUsersStarredProjectsSortedByName(): void { @@ -289,6 +305,7 @@ public function shouldGetAllUsersStarredProjectsSortedByName(): void $api->usersStarredProjects(1, ['page' => 1, 'per_page' => 5, 'order_by' => 'name', 'sort' => 'asc']) ); } + #[Test] public function shouldGetNotArchivedUsersStarredProjects(): void { @@ -298,6 +315,7 @@ public function shouldGetNotArchivedUsersStarredProjects(): void $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['archived' => false])); } + #[Test] public function shouldGetOwnedUsersStarredProjects(): void { @@ -307,6 +325,7 @@ public function shouldGetOwnedUsersStarredProjects(): void $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['owned' => true])); } + #[Test] #[DataProvider('possibleAccessLevels')] public function shouldGetStarredProjectsWithMinimumAccessLevel($level): void @@ -317,6 +336,7 @@ public function shouldGetStarredProjectsWithMinimumAccessLevel($level): void $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['min_access_level' => $level])); } + #[Test] public function shouldSearchUsersStarredProjects(): void { @@ -325,6 +345,7 @@ public function shouldSearchUsersStarredProjects(): void $api = $this->getUsersProjectsRequestMock('users/1/starred_projects', $expectedArray, ['search' => 'a project']); $this->assertEquals($expectedArray, $api->usersStarredProjects(1, ['search' => 'a project'])); } + #[Test] public function shouldCreateUser(): void { @@ -339,6 +360,7 @@ public function shouldCreateUser(): void $this->assertEquals($expectedArray, $api->create('billy@example.com', 'password')); } + #[Test] public function shouldCreateUserWithAdditionalInfo(): void { @@ -353,6 +375,7 @@ public function shouldCreateUserWithAdditionalInfo(): void $this->assertEquals($expectedArray, $api->create('billy@example.com', 'password', ['name' => 'Billy', 'bio' => 'A person'])); } + #[Test] public function shouldUpdateUser(): void { @@ -378,6 +401,7 @@ public function shouldUpdateUser(): void $this->assertEquals($expectedArray, $api->update(4, [], ['avatar' => '/some/image.jpg'])); } + #[Test] public function shouldRemoveUser(): void { @@ -391,6 +415,7 @@ public function shouldRemoveUser(): void $this->assertEquals($expectedBool, $api->remove(1)); } + #[Test] public function shouldBlockUser(): void { @@ -404,6 +429,7 @@ public function shouldBlockUser(): void $this->assertEquals($expectedBool, $api->block(1)); } + #[Test] public function shouldUnblockUser(): void { @@ -417,6 +443,7 @@ public function shouldUnblockUser(): void $this->assertEquals($expectedBool, $api->unblock(1)); } + #[Test] public function shouldActivateUser(): void { @@ -430,6 +457,7 @@ public function shouldActivateUser(): void $this->assertEquals($expectedBool, $api->activate(1)); } + #[Test] public function shouldDeactivateUser(): void { @@ -443,6 +471,7 @@ public function shouldDeactivateUser(): void $this->assertEquals($expectedBool, $api->deactivate(1)); } + #[Test] public function shouldShowCurrentUser(): void { @@ -457,6 +486,7 @@ public function shouldShowCurrentUser(): void $this->assertEquals($expectedArray, $api->me()); } + #[Test] public function shouldGetCurrentUserKeys(): void { @@ -474,6 +504,7 @@ public function shouldGetCurrentUserKeys(): void $this->assertEquals($expectedArray, $api->keys(1)); } + #[Test] public function shouldGetCurrentUserKey(): void { @@ -488,6 +519,7 @@ public function shouldGetCurrentUserKey(): void $this->assertEquals($expectedArray, $api->key(1)); } + #[Test] public function shouldCreateKeyForCurrentUser(): void { @@ -502,6 +534,7 @@ public function shouldCreateKeyForCurrentUser(): void $this->assertEquals($expectedArray, $api->createKey('A new key', '...')); } + #[Test] public function shouldDeleteKeyForCurrentUser(): void { @@ -515,6 +548,7 @@ public function shouldDeleteKeyForCurrentUser(): void $this->assertEquals($expectedBool, $api->removeKey(3)); } + #[Test] public function shouldGetUserKeys(): void { @@ -532,6 +566,7 @@ public function shouldGetUserKeys(): void $this->assertEquals($expectedArray, $api->userKeys(1)); } + #[Test] public function shouldGetUserKey(): void { @@ -546,6 +581,7 @@ public function shouldGetUserKey(): void $this->assertEquals($expectedArray, $api->userKey(1, 2)); } + #[Test] public function shouldCreateKeyForUser(): void { @@ -560,6 +596,7 @@ public function shouldCreateKeyForUser(): void $this->assertEquals($expectedArray, $api->createKeyForUser(1, 'A new key', '...')); } + #[Test] public function shouldDeleteKeyForUser(): void { @@ -573,6 +610,7 @@ public function shouldDeleteKeyForUser(): void $this->assertEquals($expectedBool, $api->removeUserKey(1, 3)); } + #[Test] public function shouldGetUserEmails(): void { @@ -589,6 +627,7 @@ public function shouldGetUserEmails(): void $this->assertEquals($expectedArray, $api->emails()); } + #[Test] public function shouldGetSpecificUserEmail(): void { @@ -602,6 +641,7 @@ public function shouldGetSpecificUserEmail(): void $this->assertEquals($expectedArray, $api->email(1)); } + #[Test] public function shouldGetEmailsForUser(): void { @@ -619,6 +659,7 @@ public function shouldGetEmailsForUser(): void $this->assertEquals($expectedArray, $api->userEmails(1)); } + #[Test] public function shouldCreateEmailForUser(): void { @@ -633,6 +674,7 @@ public function shouldCreateEmailForUser(): void $this->assertEquals($expectedArray, $api->createEmailForUser(1, 'foo@bar.example')); } + #[Test] public function shouldCreateConfirmedEmailForUser(): void { @@ -647,6 +689,7 @@ public function shouldCreateConfirmedEmailForUser(): void $this->assertEquals($expectedArray, $api->createEmailForUser(1, 'foo@baz.example', true)); } + #[Test] public function shouldDeleteEmailForUser(): void { @@ -660,6 +703,7 @@ public function shouldDeleteEmailForUser(): void $this->assertEquals($expectedBool, $api->removeUserEmail(1, 3)); } + #[Test] public function shouldGetCurrentUserImpersonationTokens(): void { @@ -677,6 +721,7 @@ public function shouldGetCurrentUserImpersonationTokens(): void $this->assertEquals($expectedArray, $api->userImpersonationTokens(1)); } + #[Test] public function shouldGetUserImpersonationToken(): void { @@ -691,6 +736,7 @@ public function shouldGetUserImpersonationToken(): void $this->assertEquals($expectedArray, $api->userImpersonationToken(1, 1)); } + #[Test] public function shouldCreateImpersonationTokenForUser(): void { @@ -705,6 +751,7 @@ public function shouldCreateImpersonationTokenForUser(): void $this->assertEquals($expectedArray, $api->createImpersonationToken(1, 'name', ['api'])); } + #[Test] public function shouldDeleteImpersonationTokenForUser(): void { @@ -718,6 +765,7 @@ public function shouldDeleteImpersonationTokenForUser(): void $this->assertEquals($expectedBool, $api->removeImpersonationToken(1, 1)); } + #[Test] public function shouldGetCurrentUserActiveImpersonationTokens(): void { @@ -734,6 +782,7 @@ public function shouldGetCurrentUserActiveImpersonationTokens(): void $this->assertEquals($expectedArray, $api->userImpersonationTokens(1, ['state' => 'active'])); } + #[Test] public function shouldGetCurrentUserInactiveImpersonationTokens(): void { @@ -755,6 +804,7 @@ protected function getApiClass() { return Users::class; } + #[Test] public function shouldGetEvents(): void { @@ -771,6 +821,7 @@ public function shouldGetEvents(): void $this->assertEquals($expectedArray, $api->events(1)); } + #[Test] public function shouldGetEventsWithDateTimeParams(): void { @@ -795,6 +846,7 @@ public function shouldGetEventsWithDateTimeParams(): void $this->assertEquals($expectedArray, $api->events(1, ['after' => $after, 'before' => $before])); } + #[Test] public function shouldGetEventsWithPagination(): void { @@ -814,6 +866,7 @@ public function shouldGetEventsWithPagination(): void $this->assertEquals($expectedArray, $api->events(1, ['page' => 2, 'per_page' => 15])); } + #[Test] public function getRemoveUserIdentity(): void { diff --git a/tests/Api/VersionTest.php b/tests/Api/VersionTest.php index f54650c7..927dbef1 100644 --- a/tests/Api/VersionTest.php +++ b/tests/Api/VersionTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Version; +use PHPUnit\Framework\Attributes\Test; class VersionTest extends TestCase { diff --git a/tests/Api/WikiTest.php b/tests/Api/WikiTest.php index 7a8f1454..4c4444eb 100644 --- a/tests/Api/WikiTest.php +++ b/tests/Api/WikiTest.php @@ -14,8 +14,8 @@ namespace Gitlab\Tests\Api; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Api\Wiki; +use PHPUnit\Framework\Attributes\Test; class WikiTest extends TestCase { @@ -48,6 +48,7 @@ public function shouldCreateWiki(): void ] )); } + #[Test] public function shouldShowWiki(): void { @@ -65,6 +66,7 @@ public function shouldShowWiki(): void $this->assertEquals($expectedArray, $api->show(1, 'Test-Wiki')); } + #[Test] public function shouldShowAllWiki(): void { @@ -85,6 +87,7 @@ public function shouldShowAllWiki(): void $this->assertEquals($expectedArray, $api->showAll(1, $params)); } + #[Test] public function shouldUpdateWiki(): void { @@ -104,6 +107,7 @@ public function shouldUpdateWiki(): void $this->assertEquals($expectedArray, $api->update(1, 'Test-Wiki', ['content' => 'This is the test Wiki that has been updated'])); } + #[Test] public function shouldRemoveWiki(): void { diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 120e9b3f..72bff09d 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -14,11 +14,8 @@ namespace Gitlab\Tests; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Client; -use PHPUnit\Framework\Attributes\Test; use Http\Client\Common\HttpMethodsClient; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; class ClientTest extends TestCase diff --git a/tests/HttpClient/BuilderTest.php b/tests/HttpClient/BuilderTest.php index f11bdee2..0b017c32 100644 --- a/tests/HttpClient/BuilderTest.php +++ b/tests/HttpClient/BuilderTest.php @@ -14,19 +14,12 @@ namespace Gitlab\Tests\HttpClient; -use PHPUnit\Framework\Attributes\Test; use Gitlab\HttpClient\Builder; -use PHPUnit\Framework\Attributes\Test; use Http\Client\Common\HttpMethodsClientInterface; -use PHPUnit\Framework\Attributes\Test; use Http\Client\Common\Plugin; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\Test; use Psr\Http\Client\ClientInterface; -use PHPUnit\Framework\Attributes\Test; use Psr\Http\Message\RequestFactoryInterface; -use PHPUnit\Framework\Attributes\Test; use Psr\Http\Message\StreamFactoryInterface; /** diff --git a/tests/HttpClient/Message/ResponseMediatorTest.php b/tests/HttpClient/Message/ResponseMediatorTest.php index e4c65e97..7266ecfa 100644 --- a/tests/HttpClient/Message/ResponseMediatorTest.php +++ b/tests/HttpClient/Message/ResponseMediatorTest.php @@ -14,15 +14,10 @@ namespace Gitlab\Tests\HttpClient\Message; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Exception\RuntimeException; -use PHPUnit\Framework\Attributes\Test; use Gitlab\HttpClient\Message\ResponseMediator; -use PHPUnit\Framework\Attributes\Test; use GuzzleHttp\Psr7\Response; -use PHPUnit\Framework\Attributes\Test; use GuzzleHttp\Psr7\Utils; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; /** diff --git a/tests/HttpClient/Util/QueryStringBuilderTest.php b/tests/HttpClient/Util/QueryStringBuilderTest.php index 94b29a51..e3466897 100644 --- a/tests/HttpClient/Util/QueryStringBuilderTest.php +++ b/tests/HttpClient/Util/QueryStringBuilderTest.php @@ -14,13 +14,9 @@ namespace Gitlab\Tests\HttpClient\Util; -use PHPUnit\Framework\Attributes\Test; use Generator; -use PHPUnit\Framework\Attributes\Test; use Gitlab\HttpClient\Util\QueryStringBuilder; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; class QueryStringBuilderTest extends TestCase diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index 87c2e620..e095c4ea 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -14,11 +14,8 @@ namespace Gitlab\Tests; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Client; -use PHPUnit\Framework\Attributes\Test; use Gitlab\Exception\RuntimeException; -use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; class IntegrationTest extends TestCase From dc64dfb18afac97b2b52ec476030fe60d93dbbe4 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 17:37:25 +0000 Subject: [PATCH 106/117] Allow PHPUnit 11 --- tests/Api/EnvironmentsTest.php | 2 +- tests/Api/GroupsMilestonesTest.php | 1 - tests/Api/GroupsTest.php | 1 - tests/Api/JobsTest.php | 1 - tests/Api/ProjectsTest.php | 20 +++----------------- tests/Api/RepositoriesTest.php | 1 - tests/Api/TagsTest.php | 1 - tests/Api/UsersTest.php | 1 - tests/HttpClient/BuilderTest.php | 5 ++--- vendor-bin/phpunit/composer.json | 2 +- 10 files changed, 7 insertions(+), 28 deletions(-) diff --git a/tests/Api/EnvironmentsTest.php b/tests/Api/EnvironmentsTest.php index edfa77e1..e0a0d205 100644 --- a/tests/Api/EnvironmentsTest.php +++ b/tests/Api/EnvironmentsTest.php @@ -45,7 +45,7 @@ public function shouldGetAllEnvironments(): void $this->assertEquals($expectedArray, $api->all(1)); } - /** @test */ + #[Test] public function shouldFilterEnvironmentByName(): void { $expected = [ diff --git a/tests/Api/GroupsMilestonesTest.php b/tests/Api/GroupsMilestonesTest.php index 827487e9..bce1a684 100644 --- a/tests/Api/GroupsMilestonesTest.php +++ b/tests/Api/GroupsMilestonesTest.php @@ -17,7 +17,6 @@ use Gitlab\Api\GroupsMilestones; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\Attributes\Test; class GroupsMilestonesTest extends TestCase { diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index e3534bb4..ebb53db5 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -17,7 +17,6 @@ use DateTime; use Gitlab\Api\Groups; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\Attributes\Test; class GroupsTest extends TestCase { diff --git a/tests/Api/JobsTest.php b/tests/Api/JobsTest.php index 4239049c..3db71c80 100644 --- a/tests/Api/JobsTest.php +++ b/tests/Api/JobsTest.php @@ -17,7 +17,6 @@ use Gitlab\Api\Jobs; use GuzzleHttp\Psr7\Response; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\Attributes\Test; class JobsTest extends TestCase { diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 162fdfa4..9eafc60b 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -18,8 +18,6 @@ use Gitlab\Api\Projects; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\Attributes\Test; class ProjectsTest extends TestCase { @@ -399,11 +397,7 @@ public function shouldGetTrigger(): void $this->assertEquals($expectedArray, $api->trigger(1, 3)); } - /** - * Check we can request project issues. - * - * @test - */ + #[Test] public function shouldGetProjectIssues(): void { $expectedArray = $this->getProjectIssuesExpectedArray(); @@ -417,11 +411,7 @@ public function shouldGetProjectIssues(): void $this->assertEquals($expectedArray, $api->issues(1)); } - /** - * Check we can request project issues. - * - * @test - */ + #[Test] public function shouldGetProjectUsers(): void { $expectedArray = $this->getProjectUsersExpectedArray(); @@ -435,11 +425,7 @@ public function shouldGetProjectUsers(): void $this->assertEquals($expectedArray, $api->users(1)); } - /** - * Check we can request project issues with query parameters. - * - * @test - */ + #[Test] public function shouldGetProjectIssuesParameters(): void { $expectedArray = $this->getProjectIssuesExpectedArray(); diff --git a/tests/Api/RepositoriesTest.php b/tests/Api/RepositoriesTest.php index 6f7db5d8..b58fa61d 100644 --- a/tests/Api/RepositoriesTest.php +++ b/tests/Api/RepositoriesTest.php @@ -17,7 +17,6 @@ use Gitlab\Api\Repositories; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\Attributes\Test; class RepositoriesTest extends TestCase { diff --git a/tests/Api/TagsTest.php b/tests/Api/TagsTest.php index d8ee09c0..24696ecc 100644 --- a/tests/Api/TagsTest.php +++ b/tests/Api/TagsTest.php @@ -17,7 +17,6 @@ use Gitlab\Api\Tags; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\Attributes\Test; class TagsTest extends TestCase { diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index c1f15a0d..a3da91c8 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -17,7 +17,6 @@ use Gitlab\Api\Users; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\Attributes\Test; class UsersTest extends TestCase { diff --git a/tests/HttpClient/BuilderTest.php b/tests/HttpClient/BuilderTest.php index 0b017c32..7408c83b 100644 --- a/tests/HttpClient/BuilderTest.php +++ b/tests/HttpClient/BuilderTest.php @@ -21,6 +21,7 @@ use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestFactoryInterface; use Psr\Http\Message\StreamFactoryInterface; +use PHPUnit\Framework\Attributes\Before; /** * @author Fabien Bourigault @@ -32,9 +33,7 @@ class BuilderTest extends TestCase */ private $subject; - /** - * @before - */ + #[Before] public function initBuilder(): void { $this->subject = new Builder( diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index 00cbd40a..21464a1e 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -1,7 +1,7 @@ { "require": { "php": "^8.1", - "phpunit/phpunit": "^10.5.45" + "phpunit/phpunit": "^10.5.45 || ^11.5.9" }, "config": { "preferred-install": "dist" From 685b67a37014ac33ad65f4fce6881a861cefff12 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 23 Feb 2025 17:37:36 +0000 Subject: [PATCH 107/117] Apply fixes from StyleCI --- tests/HttpClient/BuilderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/HttpClient/BuilderTest.php b/tests/HttpClient/BuilderTest.php index 7408c83b..b27306e1 100644 --- a/tests/HttpClient/BuilderTest.php +++ b/tests/HttpClient/BuilderTest.php @@ -17,11 +17,11 @@ use Gitlab\HttpClient\Builder; use Http\Client\Common\HttpMethodsClientInterface; use Http\Client\Common\Plugin; +use PHPUnit\Framework\Attributes\Before; use PHPUnit\Framework\TestCase; use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestFactoryInterface; use Psr\Http\Message\StreamFactoryInterface; -use PHPUnit\Framework\Attributes\Before; /** * @author Fabien Bourigault From dd9b08ddc2957bcbabb18c0b1f18a5ae3fd42f97 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 18:15:12 +0000 Subject: [PATCH 108/117] Update composer.json --- vendor-bin/phpstan/composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json index e93f63d9..a1bd73c4 100644 --- a/vendor-bin/phpstan/composer.json +++ b/vendor-bin/phpstan/composer.json @@ -3,8 +3,7 @@ "php": "^8.1", "phpstan/phpstan": "2.1.6", "phpstan/phpstan-deprecation-rules": "2.0.1", - "phpstan/phpstan-strict-rules": "2.0.3", - "ergebnis/phpstan-rules": "2.8.0" + "phpstan/phpstan-strict-rules": "2.0.3" }, "config": { "preferred-install": "dist" From aabd6cc56c183fd0cdde03ae48351c0de82d3cd6 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 18:19:43 +0000 Subject: [PATCH 109/117] Added more types --- src/Api/AbstractApi.php | 12 +- src/Api/DeployKeys.php | 2 +- src/Api/Deployments.php | 4 +- src/Api/Environments.php | 10 +- src/Api/Events.php | 2 +- src/Api/Groups.php | 70 +++---- src/Api/GroupsBoards.php | 20 +- src/Api/GroupsEpics.php | 12 +- src/Api/GroupsMilestones.php | 14 +- src/Api/IssueBoards.php | 20 +- src/Api/IssueLinks.php | 6 +- src/Api/Issues.php | 66 +++---- src/Api/IssuesStatistics.php | 6 +- src/Api/Jobs.php | 28 +-- src/Api/Keys.php | 2 +- src/Api/MergeRequests.php | 64 +++---- src/Api/Milestones.php | 14 +- src/Api/Packages.php | 12 +- src/Api/ProjectNamespaces.php | 4 +- src/Api/Projects.php | 198 ++++++++++---------- src/Api/Repositories.php | 54 +++--- src/Api/RepositoryFiles.php | 10 +- src/Api/ResourceIterationEvents.php | 4 +- src/Api/ResourceLabelEvents.php | 4 +- src/Api/ResourceMilestoneEvents.php | 4 +- src/Api/ResourceStateEvents.php | 4 +- src/Api/ResourceWeightEvents.php | 4 +- src/Api/Schedules.php | 20 +- src/Api/Search.php | 2 +- src/Api/Snippets.php | 26 +-- src/Api/SystemHooks.php | 8 +- src/Api/Tags.php | 12 +- src/Api/Users.php | 66 +++---- src/Api/Version.php | 2 +- src/Api/Wiki.php | 10 +- src/HttpClient/Message/ResponseMediator.php | 2 +- src/HttpClient/Plugin/History.php | 2 +- tests/Api/ProjectsTest.php | 6 +- tests/Api/RepositoryFilesTest.php | 2 +- tests/Api/TestCase.php | 4 +- tests/HttpClient/BuilderTest.php | 2 +- 41 files changed, 407 insertions(+), 407 deletions(-) diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index 8a98e4c5..8bacebba 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -80,7 +80,7 @@ protected function getAsResponse(string $uri, array $params = [], array $headers * * @return mixed */ - protected function get(string $uri, array $params = [], array $headers = []) + protected function get(string $uri, array $params = [], array $headers = []): mixed { $response = $this->getAsResponse($uri, $params, $headers); @@ -95,7 +95,7 @@ protected function get(string $uri, array $params = [], array $headers = []) * * @return mixed */ - protected function post(string $uri, array $params = [], array $headers = [], array $files = [], array $uriParams = []) + protected function post(string $uri, array $params = [], array $headers = [], array $files = [], array $uriParams = []): mixed { if (0 < \count($files)) { $builder = $this->createMultipartStreamBuilder($params, $files); @@ -121,7 +121,7 @@ protected function post(string $uri, array $params = [], array $headers = [], ar * * @return mixed */ - protected function put(string $uri, array $params = [], array $headers = [], array $files = []) + protected function put(string $uri, array $params = [], array $headers = [], array $files = []): mixed { if (0 < \count($files)) { $builder = $this->createMultipartStreamBuilder($params, $files); @@ -147,7 +147,7 @@ protected function put(string $uri, array $params = [], array $headers = [], arr * * @return mixed */ - protected function patch(string $uri, array $params = [], array $headers = [], array $files = []) + protected function patch(string $uri, array $params = [], array $headers = [], array $files = []): mixed { if (0 < \count($files)) { $builder = $this->createMultipartStreamBuilder($params, $files); @@ -172,7 +172,7 @@ protected function patch(string $uri, array $params = [], array $headers = [], a * * @return mixed */ - protected function putFile(string $uri, string $file, array $headers = [], array $uriParams = []) + protected function putFile(string $uri, string $file, array $headers = [], array $uriParams = []): mixed { $resource = self::tryFopen($file, 'r'); $body = $this->client->getStreamFactory()->createStreamFromResource($resource); @@ -192,7 +192,7 @@ protected function putFile(string $uri, string $file, array $headers = [], array * * @return mixed */ - protected function delete(string $uri, array $params = [], array $headers = []) + protected function delete(string $uri, array $params = [], array $headers = []): mixed { $body = self::prepareJsonBody($params); diff --git a/src/Api/DeployKeys.php b/src/Api/DeployKeys.php index a86547a6..da181e29 100644 --- a/src/Api/DeployKeys.php +++ b/src/Api/DeployKeys.php @@ -19,7 +19,7 @@ class DeployKeys extends AbstractApi /** * @return mixed */ - public function all(array $parameters = []) + public function all(array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); diff --git a/src/Api/Deployments.php b/src/Api/Deployments.php index 7987f4da..a3a50538 100644 --- a/src/Api/Deployments.php +++ b/src/Api/Deployments.php @@ -30,7 +30,7 @@ class Deployments extends AbstractApi * * @return mixed */ - public function all(int|string $project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('order_by') @@ -51,7 +51,7 @@ public function all(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function show(int|string $project_id, int $deployment_id) + public function show(int|string $project_id, int $deployment_id): mixed { return $this->get($this->getProjectPath($project_id, 'deployments/'.$deployment_id)); } diff --git a/src/Api/Environments.php b/src/Api/Environments.php index 22cab930..94ec4d19 100644 --- a/src/Api/Environments.php +++ b/src/Api/Environments.php @@ -21,7 +21,7 @@ class Environments extends AbstractApi /** * @return mixed */ - public function all(int|string $project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('name') @@ -45,7 +45,7 @@ public function all(int|string $project_id, array $parameters = []) * * @return mixed */ - public function create(int|string $project_id, array $parameters = []) + public function create(int|string $project_id, array $parameters = []): mixed { $resolver = new OptionsResolver(); $resolver->setDefined('name') @@ -62,7 +62,7 @@ public function create(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function remove(int|string $project_id, int $environment_id) + public function remove(int|string $project_id, int $environment_id): mixed { return $this->delete($this->getProjectPath($project_id, 'environments/'.$environment_id)); } @@ -70,7 +70,7 @@ public function remove(int|string $project_id, int $environment_id) /** * @return mixed */ - public function stop(int|string $project_id, int $environment_id) + public function stop(int|string $project_id, int $environment_id): mixed { return $this->post($this->getProjectPath($project_id, 'environments/'.self::encodePath($environment_id).'/stop')); } @@ -78,7 +78,7 @@ public function stop(int|string $project_id, int $environment_id) /** * @return mixed */ - public function show(int|string $project_id, int $environment_id) + public function show(int|string $project_id, int $environment_id): mixed { return $this->get($this->getProjectPath($project_id, 'environments/'.self::encodePath($environment_id))); } diff --git a/src/Api/Events.php b/src/Api/Events.php index b8826e0a..92f44adb 100644 --- a/src/Api/Events.php +++ b/src/Api/Events.php @@ -31,7 +31,7 @@ class Events extends AbstractApi * * @return mixed */ - public function all(array $parameters = []) + public function all(array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 0128cf6d..feb5d6e7 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -62,7 +62,7 @@ class Groups extends AbstractApi * * @return mixed */ - public function all(array $parameters = []) + public function all(array $parameters = []): mixed { $resolver = $this->getGroupSearchResolver(); @@ -72,7 +72,7 @@ public function all(array $parameters = []) /** * @return mixed */ - public function show(int|string $id) + public function show(int|string $id): mixed { return $this->get('groups/'.self::encodePath($id)); } @@ -80,7 +80,7 @@ public function show(int|string $id) /** * @return mixed */ - public function create(string $name, string $path, ?string $description = null, string $visibility = 'private', ?bool $lfs_enabled = null, ?bool $request_access_enabled = null, ?int $parent_id = null, ?int $shared_runners_minutes_limit = null) + public function create(string $name, string $path, ?string $description = null, string $visibility = 'private', ?bool $lfs_enabled = null, ?bool $request_access_enabled = null, ?int $parent_id = null, ?int $shared_runners_minutes_limit = null): mixed { $params = [ 'name' => $name, @@ -101,7 +101,7 @@ public function create(string $name, string $path, ?string $description = null, /** * @return mixed */ - public function update(int|string $id, array $params) + public function update(int|string $id, array $params): mixed { return $this->put('groups/'.self::encodePath($id), $params); } @@ -109,7 +109,7 @@ public function update(int|string $id, array $params) /** * @return mixed */ - public function remove(int|string $group_id) + public function remove(int|string $group_id): mixed { return $this->delete('groups/'.self::encodePath($group_id)); } @@ -117,7 +117,7 @@ public function remove(int|string $group_id) /** * @return mixed */ - public function transfer(int|string $group_id, int|string $project_id) + public function transfer(int|string $group_id, int|string $project_id): mixed { return $this->post('groups/'.self::encodePath($group_id).'/projects/'.self::encodePath($project_id)); } @@ -125,7 +125,7 @@ public function transfer(int|string $group_id, int|string $project_id) /** * @return mixed */ - public function allMembers(int|string $group_id, array $parameters = []) + public function allMembers(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('query'); @@ -147,7 +147,7 @@ public function allMembers(int|string $group_id, array $parameters = []) * * @return mixed */ - public function members(int|string $group_id, array $parameters = []) + public function members(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('query'); @@ -164,7 +164,7 @@ public function members(int|string $group_id, array $parameters = []) /** * @return mixed */ - public function member(int|string $group_id, int $user_id) + public function member(int|string $group_id, int $user_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/members/'.self::encodePath($user_id)); } @@ -172,7 +172,7 @@ public function member(int|string $group_id, int $user_id) /** * @return mixed */ - public function allMember(int|string $group_id, int $user_id) + public function allMember(int|string $group_id, int $user_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/members/all/'.self::encodePath($user_id)); } @@ -180,7 +180,7 @@ public function allMember(int|string $group_id, int $user_id) /** * @return mixed */ - public function addMember(int|string $group_id, int $user_id, int $access_level, array $parameters = []) + public function addMember(int|string $group_id, int $user_id, int $access_level, array $parameters = []): mixed { $dateNormalizer = function (OptionsResolver $optionsResolver, \DateTimeInterface $date): string { return $date->format('Y-m-d'); @@ -203,7 +203,7 @@ public function addMember(int|string $group_id, int $user_id, int $access_level, /** * @return mixed */ - public function saveMember(int|string $group_id, int $user_id, int $access_level) + public function saveMember(int|string $group_id, int $user_id, int $access_level): mixed { return $this->put('groups/'.self::encodePath($group_id).'/members/'.self::encodePath($user_id), [ 'access_level' => $access_level, @@ -219,7 +219,7 @@ public function saveMember(int|string $group_id, int $user_id, int $access_level * * @return mixed */ - public function addShare(int|string $group_id, array $parameters = []) + public function addShare(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -245,7 +245,7 @@ public function addShare(int|string $group_id, array $parameters = []) /** * @return mixed */ - public function removeMember(int|string $group_id, int $user_id) + public function removeMember(int|string $group_id, int $user_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/members/'.self::encodePath($user_id)); } @@ -271,7 +271,7 @@ public function removeMember(int|string $group_id, int $user_id) * * @return mixed */ - public function projects(int|string $id, array $parameters = []) + public function projects(int|string $id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -342,7 +342,7 @@ public function projects(int|string $id, array $parameters = []) * * @return mixed */ - public function subgroups(int|string $group_id, array $parameters = []) + public function subgroups(int|string $group_id, array $parameters = []): mixed { $resolver = $this->getSubgroupSearchResolver(); @@ -382,7 +382,7 @@ public function subgroups(int|string $group_id, array $parameters = []) * * @return mixed */ - public function issues(int|string $group_id, array $parameters = []) + public function issues(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -473,7 +473,7 @@ public function issues(int|string $group_id, array $parameters = []) * * @return mixed */ - public function labels(int|string $group_id, array $parameters = []) + public function labels(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -498,7 +498,7 @@ public function labels(int|string $group_id, array $parameters = []) /** * @return mixed */ - public function addLabel(int|string $group_id, array $params) + public function addLabel(int|string $group_id, array $params): mixed { return $this->post('groups/'.self::encodePath($group_id).'/labels', $params); } @@ -506,7 +506,7 @@ public function addLabel(int|string $group_id, array $params) /** * @return mixed */ - public function updateLabel(int|string $group_id, int $label_id, array $params) + public function updateLabel(int|string $group_id, int $label_id, array $params): mixed { return $this->put('groups/'.self::encodePath($group_id).'/labels/'.self::encodePath($label_id), $params); } @@ -514,7 +514,7 @@ public function updateLabel(int|string $group_id, int $label_id, array $params) /** * @return mixed */ - public function removeLabel(int|string $group_id, int $label_id) + public function removeLabel(int|string $group_id, int $label_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/labels/'.self::encodePath($label_id)); } @@ -522,7 +522,7 @@ public function removeLabel(int|string $group_id, int $label_id) /** * @return mixed */ - public function variables(int|string $group_id, array $parameters = []) + public function variables(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -532,7 +532,7 @@ public function variables(int|string $group_id, array $parameters = []) /** * @return mixed */ - public function variable(int|string $group_id, string $key) + public function variable(int|string $group_id, string $key): mixed { return $this->get('groups/'.self::encodePath($group_id).'/variables/'.self::encodePath($key)); } @@ -546,7 +546,7 @@ public function variable(int|string $group_id, string $key) * * @return mixed */ - public function addVariable(int|string $group_id, string $key, string $value, ?bool $protected = null, array $parameters = []) + public function addVariable(int|string $group_id, string $key, string $value, ?bool $protected = null, array $parameters = []): mixed { $payload = [ 'key' => $key, @@ -571,7 +571,7 @@ public function addVariable(int|string $group_id, string $key, string $value, ?b /** * @return mixed */ - public function updateVariable(int|string $group_id, string $key, string $value, ?bool $protected = null) + public function updateVariable(int|string $group_id, string $key, string $value, ?bool $protected = null): mixed { $payload = [ 'value' => $value, @@ -587,7 +587,7 @@ public function updateVariable(int|string $group_id, string $key, string $value, /** * @return mixed */ - public function removeVariable(int|string $group_id, string $key) + public function removeVariable(int|string $group_id, string $key): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/variables/'.self::encodePath($key)); } @@ -611,7 +611,7 @@ public function removeVariable(int|string $group_id, string $key) * * @return mixed */ - public function mergeRequests(int|string $group_id, array $parameters = []) + public function mergeRequests(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -704,7 +704,7 @@ public function mergeRequests(int|string $group_id, array $parameters = []) * * @return mixed */ - public function iterations(int|string $group_id, array $parameters = []) + public function iterations(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -742,7 +742,7 @@ public function iterations(int|string $group_id, array $parameters = []) * * @return mixed */ - public function packages(int|string $group_id, array $parameters = []) + public function packages(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -777,7 +777,7 @@ public function packages(int|string $group_id, array $parameters = []) /** * @return OptionsResolver */ - private function getGroupSearchResolver() + private function getGroupSearchResolver(): OptionsResolver { $resolver = $this->getSubgroupSearchResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -795,7 +795,7 @@ private function getGroupSearchResolver() /** * @return OptionsResolver */ - private function getSubgroupSearchResolver() + private function getSubgroupSearchResolver(): OptionsResolver { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -837,7 +837,7 @@ private function getSubgroupSearchResolver() /** * @return mixed */ - public function deployTokens(int|string $group_id, ?bool $active = null) + public function deployTokens(int|string $group_id, ?bool $active = null): mixed { return $this->get('groups/'.self::encodePath($group_id).'/deploy_tokens', (null !== $active) ? ['active' => $active] : []); } @@ -853,7 +853,7 @@ public function deployTokens(int|string $group_id, ?bool $active = null) * * @return mixed */ - public function createDeployToken(int|string $group_id, array $parameters = []) + public function createDeployToken(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -893,7 +893,7 @@ public function createDeployToken(int|string $group_id, array $parameters = []) /** * @return mixed */ - public function deleteDeployToken(int|string $group_id, int $token_id) + public function deleteDeployToken(int|string $group_id, int $token_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/deploy_tokens/'.self::encodePath($token_id)); } @@ -914,7 +914,7 @@ public function deleteDeployToken(int|string $group_id, int $token_id) * * @return mixed */ - public function search(int|string $id, array $parameters = []) + public function search(int|string $id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { diff --git a/src/Api/GroupsBoards.php b/src/Api/GroupsBoards.php index bc52d73d..65696d31 100644 --- a/src/Api/GroupsBoards.php +++ b/src/Api/GroupsBoards.php @@ -19,7 +19,7 @@ class GroupsBoards extends AbstractApi /** * @return mixed */ - public function all(int|string|null $group_id = null, array $parameters = []) + public function all(int|string|null $group_id = null, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -31,7 +31,7 @@ public function all(int|string|null $group_id = null, array $parameters = []) /** * @return mixed */ - public function show(int|string $group_id, int $board_id) + public function show(int|string $group_id, int $board_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id)); } @@ -39,7 +39,7 @@ public function show(int|string $group_id, int $board_id) /** * @return mixed */ - public function create(int|string $group_id, array $params) + public function create(int|string $group_id, array $params): mixed { return $this->post('groups/'.self::encodePath($group_id).'/boards', $params); } @@ -47,7 +47,7 @@ public function create(int|string $group_id, array $params) /** * @return mixed */ - public function update(int|string $group_id, int $board_id, array $params) + public function update(int|string $group_id, int $board_id, array $params): mixed { return $this->put('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id), $params); } @@ -55,7 +55,7 @@ public function update(int|string $group_id, int $board_id, array $params) /** * @return mixed */ - public function remove(int|string $group_id, int $board_id) + public function remove(int|string $group_id, int $board_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id)); } @@ -63,7 +63,7 @@ public function remove(int|string $group_id, int $board_id) /** * @return mixed */ - public function allLists(int|string $group_id, int $board_id) + public function allLists(int|string $group_id, int $board_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists'); } @@ -71,7 +71,7 @@ public function allLists(int|string $group_id, int $board_id) /** * @return mixed */ - public function showList(int|string $group_id, int $board_id, int $list_id) + public function showList(int|string $group_id, int $board_id, int $list_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id)); } @@ -79,7 +79,7 @@ public function showList(int|string $group_id, int $board_id, int $list_id) /** * @return mixed */ - public function createList(int|string $group_id, int $board_id, int $label_id) + public function createList(int|string $group_id, int $board_id, int $label_id): mixed { $params = [ 'label_id' => $label_id, @@ -91,7 +91,7 @@ public function createList(int|string $group_id, int $board_id, int $label_id) /** * @return mixed */ - public function updateList(int|string $group_id, int $board_id, int $list_id, int $position) + public function updateList(int|string $group_id, int $board_id, int $list_id, int $position): mixed { $params = [ 'position' => $position, @@ -103,7 +103,7 @@ public function updateList(int|string $group_id, int $board_id, int $list_id, in /** * @return mixed */ - public function deleteList(int|string $group_id, int $board_id, int $list_id) + public function deleteList(int|string $group_id, int $board_id, int $list_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id)); } diff --git a/src/Api/GroupsEpics.php b/src/Api/GroupsEpics.php index 9200ba5a..98630b70 100644 --- a/src/Api/GroupsEpics.php +++ b/src/Api/GroupsEpics.php @@ -41,7 +41,7 @@ class GroupsEpics extends AbstractApi * * @return mixed */ - public function all(int|string $group_id, array $parameters = []) + public function all(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('iids') @@ -61,7 +61,7 @@ public function all(int|string $group_id, array $parameters = []) /** * @return mixed */ - public function show(int|string $group_id, int $epic_id) + public function show(int|string $group_id, int $epic_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_id)); } @@ -69,7 +69,7 @@ public function show(int|string $group_id, int $epic_id) /** * @return mixed */ - public function create(int|string $group_id, array $params) + public function create(int|string $group_id, array $params): mixed { return $this->post('groups/'.self::encodePath($group_id).'/epics', $params); } @@ -77,7 +77,7 @@ public function create(int|string $group_id, array $params) /** * @return mixed */ - public function update(int|string $group_id, int $epic_id, array $params) + public function update(int|string $group_id, int $epic_id, array $params): mixed { return $this->put('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_id), $params); } @@ -85,7 +85,7 @@ public function update(int|string $group_id, int $epic_id, array $params) /** * @return mixed */ - public function remove(int|string $group_id, int $epic_id) + public function remove(int|string $group_id, int $epic_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_id)); } @@ -93,7 +93,7 @@ public function remove(int|string $group_id, int $epic_id) /** * @return mixed */ - public function issues(int|string $group_id, int $epic_iid) + public function issues(int|string $group_id, int $epic_iid): mixed { return $this->get('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_iid).'/issues'); } diff --git a/src/Api/GroupsMilestones.php b/src/Api/GroupsMilestones.php index 47b03687..309c23b5 100644 --- a/src/Api/GroupsMilestones.php +++ b/src/Api/GroupsMilestones.php @@ -40,7 +40,7 @@ class GroupsMilestones extends AbstractApi * * @return mixed */ - public function all(int|string $group_id, array $parameters = []) + public function all(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -72,7 +72,7 @@ public function all(int|string $group_id, array $parameters = []) /** * @return mixed */ - public function show(int|string $group_id, int $milestone_id) + public function show(int|string $group_id, int $milestone_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id)); } @@ -80,7 +80,7 @@ public function show(int|string $group_id, int $milestone_id) /** * @return mixed */ - public function create(int|string $group_id, array $params) + public function create(int|string $group_id, array $params): mixed { return $this->post('groups/'.self::encodePath($group_id).'/milestones', $params); } @@ -88,7 +88,7 @@ public function create(int|string $group_id, array $params) /** * @return mixed */ - public function update(int|string $group_id, int $milestone_id, array $params) + public function update(int|string $group_id, int $milestone_id, array $params): mixed { return $this->put('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id), $params); } @@ -96,7 +96,7 @@ public function update(int|string $group_id, int $milestone_id, array $params) /** * @return mixed */ - public function remove(int|string $group_id, int $milestone_id) + public function remove(int|string $group_id, int $milestone_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id)); } @@ -104,7 +104,7 @@ public function remove(int|string $group_id, int $milestone_id) /** * @return mixed */ - public function issues(int|string $group_id, int $milestone_id) + public function issues(int|string $group_id, int $milestone_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id).'/issues'); } @@ -112,7 +112,7 @@ public function issues(int|string $group_id, int $milestone_id) /** * @return mixed */ - public function mergeRequests(int|string $group_id, int $milestone_id) + public function mergeRequests(int|string $group_id, int $milestone_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id).'/merge_requests'); } diff --git a/src/Api/IssueBoards.php b/src/Api/IssueBoards.php index 38d07f8b..756119cc 100644 --- a/src/Api/IssueBoards.php +++ b/src/Api/IssueBoards.php @@ -19,7 +19,7 @@ class IssueBoards extends AbstractApi /** * @return mixed */ - public function all(int|string|null $project_id = null, array $parameters = []) + public function all(int|string|null $project_id = null, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -31,7 +31,7 @@ public function all(int|string|null $project_id = null, array $parameters = []) /** * @return mixed */ - public function show(int|string $project_id, int $board_id) + public function show(int|string $project_id, int $board_id): mixed { return $this->get($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id))); } @@ -39,7 +39,7 @@ public function show(int|string $project_id, int $board_id) /** * @return mixed */ - public function create(int|string $project_id, array $params) + public function create(int|string $project_id, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'boards'), $params); } @@ -47,7 +47,7 @@ public function create(int|string $project_id, array $params) /** * @return mixed */ - public function update(int|string $project_id, int $board_id, array $params) + public function update(int|string $project_id, int $board_id, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id)), $params); } @@ -55,7 +55,7 @@ public function update(int|string $project_id, int $board_id, array $params) /** * @return mixed */ - public function remove(int|string $project_id, int $board_id) + public function remove(int|string $project_id, int $board_id): mixed { return $this->delete($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id))); } @@ -63,7 +63,7 @@ public function remove(int|string $project_id, int $board_id) /** * @return mixed */ - public function allLists(int|string $project_id, int $board_id) + public function allLists(int|string $project_id, int $board_id): mixed { return $this->get($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists')); } @@ -71,7 +71,7 @@ public function allLists(int|string $project_id, int $board_id) /** * @return mixed */ - public function showList(int|string $project_id, int $board_id, int $list_id) + public function showList(int|string $project_id, int $board_id, int $list_id): mixed { return $this->get($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id))); } @@ -79,7 +79,7 @@ public function showList(int|string $project_id, int $board_id, int $list_id) /** * @return mixed */ - public function createList(int|string $project_id, int $board_id, int $label_id) + public function createList(int|string $project_id, int $board_id, int $label_id): mixed { $params = [ 'label_id' => $label_id, @@ -91,7 +91,7 @@ public function createList(int|string $project_id, int $board_id, int $label_id) /** * @return mixed */ - public function updateList(int|string $project_id, int $board_id, int $list_id, int $position) + public function updateList(int|string $project_id, int $board_id, int $list_id, int $position): mixed { $params = [ 'position' => $position, @@ -103,7 +103,7 @@ public function updateList(int|string $project_id, int $board_id, int $list_id, /** * @return mixed */ - public function deleteList(int|string $project_id, int $board_id, int $list_id) + public function deleteList(int|string $project_id, int $board_id, int $list_id): mixed { return $this->delete($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id))); } diff --git a/src/Api/IssueLinks.php b/src/Api/IssueLinks.php index ea08f882..25923ceb 100644 --- a/src/Api/IssueLinks.php +++ b/src/Api/IssueLinks.php @@ -19,7 +19,7 @@ class IssueLinks extends AbstractApi /** * @return mixed */ - public function all(int|string $project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/links'); } @@ -32,7 +32,7 @@ public function all(int|string $project_id, int $issue_iid) * * @return mixed */ - public function create(int|string $project_id, int $issue_iid, int|string $target_project_id, int $target_issue_iid, array $parameters = []) + public function create(int|string $project_id, int $issue_iid, int|string $target_project_id, int $target_issue_iid, array $parameters = []): mixed { $parameters['target_project_id'] = $target_project_id; $parameters['target_issue_iid'] = $target_issue_iid; @@ -48,7 +48,7 @@ public function create(int|string $project_id, int $issue_iid, int|string $targe * * @return mixed */ - public function remove(int|string $project_id, int $issue_iid, int|string $issue_link_id, array $parameters = []) + public function remove(int|string $project_id, int $issue_iid, int|string $issue_link_id, array $parameters = []): mixed { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/links/'.self::encodePath($issue_link_id), $parameters); } diff --git a/src/Api/Issues.php b/src/Api/Issues.php index eab1cd1f..bb679919 100644 --- a/src/Api/Issues.php +++ b/src/Api/Issues.php @@ -50,7 +50,7 @@ class Issues extends AbstractApi * * @return mixed */ - public function all(int|string|null $project_id = null, array $parameters = []) + public function all(int|string|null $project_id = null, array $parameters = []): mixed { $path = null === $project_id ? 'issues' : $this->getProjectPath($project_id, 'issues'); @@ -60,7 +60,7 @@ public function all(int|string|null $project_id = null, array $parameters = []) /** * @return mixed */ - public function group(int|string $group_id, array $parameters = []) + public function group(int|string $group_id, array $parameters = []): mixed { return $this->get( 'groups/'.self::encodePath($group_id).'/issues', @@ -71,7 +71,7 @@ public function group(int|string $group_id, array $parameters = []) /** * @return mixed */ - public function show(int|string $project_id, int $issue_iid) + public function show(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid))); } @@ -79,7 +79,7 @@ public function show(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function create(int|string $project_id, array $params) + public function create(int|string $project_id, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'issues'), $params); } @@ -87,7 +87,7 @@ public function create(int|string $project_id, array $params) /** * @return mixed */ - public function update(int|string $project_id, int $issue_iid, array $params) + public function update(int|string $project_id, int $issue_iid, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)), $params); } @@ -95,7 +95,7 @@ public function update(int|string $project_id, int $issue_iid, array $params) /** * @return mixed */ - public function reorder(int|string $project_id, int $issue_iid, array $params) + public function reorder(int|string $project_id, int $issue_iid, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/reorder', $params); } @@ -103,7 +103,7 @@ public function reorder(int|string $project_id, int $issue_iid, array $params) /** * @return mixed */ - public function move(int|string $project_id, int $issue_iid, int|string $to_project_id) + public function move(int|string $project_id, int $issue_iid, int|string $to_project_id): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/move', [ 'to_project_id' => $to_project_id, @@ -113,7 +113,7 @@ public function move(int|string $project_id, int $issue_iid, int|string $to_proj /** * @return mixed */ - public function remove(int|string $project_id, int $issue_iid) + public function remove(int|string $project_id, int $issue_iid): mixed { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid))); } @@ -121,7 +121,7 @@ public function remove(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function showNotes(int|string $project_id, int $issue_iid) + public function showNotes(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes')); } @@ -129,7 +129,7 @@ public function showNotes(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function showNote(int|string $project_id, int $issue_iid, int $note_id) + public function showNote(int|string $project_id, int $issue_iid, int $note_id): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes/'.self::encodePath($note_id))); } @@ -137,7 +137,7 @@ public function showNote(int|string $project_id, int $issue_iid, int $note_id) /** * @return mixed */ - public function addNote(int|string $project_id, int $issue_iid, string $body, array $params = []) + public function addNote(int|string $project_id, int $issue_iid, string $body, array $params = []): mixed { $params['body'] = $body; @@ -147,7 +147,7 @@ public function addNote(int|string $project_id, int $issue_iid, string $body, ar /** * @return mixed */ - public function updateNote(int|string $project_id, int $issue_iid, int $note_id, string $body, array $params = []) + public function updateNote(int|string $project_id, int $issue_iid, int $note_id, string $body, array $params = []): mixed { $params['body'] = $body; @@ -157,7 +157,7 @@ public function updateNote(int|string $project_id, int $issue_iid, int $note_id, /** * @return mixed */ - public function removeNote(int|string $project_id, int $issue_iid, int $note_id) + public function removeNote(int|string $project_id, int $issue_iid, int $note_id): mixed { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes/'.self::encodePath($note_id))); } @@ -165,7 +165,7 @@ public function removeNote(int|string $project_id, int $issue_iid, int $note_id) /** * @return mixed */ - public function showDiscussions(int|string $project_id, int $issue_iid) + public function showDiscussions(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/discussions'); } @@ -173,7 +173,7 @@ public function showDiscussions(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function showDiscussion(int|string $project_id, int $issue_iid, string $discussion_id) + public function showDiscussion(int|string $project_id, int $issue_iid, string $discussion_id): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/discussions/'.self::encodePath($discussion_id)); } @@ -181,7 +181,7 @@ public function showDiscussion(int|string $project_id, int $issue_iid, string $d /** * @return mixed */ - public function addDiscussion(int|string $project_id, int $issue_iid, string $body) + public function addDiscussion(int|string $project_id, int $issue_iid, string $body): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions'), ['body' => $body]); } @@ -189,7 +189,7 @@ public function addDiscussion(int|string $project_id, int $issue_iid, string $bo /** * @return mixed */ - public function addDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, string $body) + public function addDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, string $body): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions/'.self::encodePath($discussion_id).'/notes'), ['body' => $body]); } @@ -197,7 +197,7 @@ public function addDiscussionNote(int|string $project_id, int $issue_iid, string /** * @return mixed */ - public function updateDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, int $note_id, string $body) + public function updateDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, int $note_id, string $body): mixed { return $this->put($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id)), [ 'body' => $body, @@ -207,7 +207,7 @@ public function updateDiscussionNote(int|string $project_id, int $issue_iid, str /** * @return mixed */ - public function removeDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, int $note_id) + public function removeDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, int $note_id): mixed { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id))); } @@ -215,7 +215,7 @@ public function removeDiscussionNote(int|string $project_id, int $issue_iid, str /** * @return mixed */ - public function setTimeEstimate(int|string $project_id, int $issue_iid, string $duration) + public function setTimeEstimate(int|string $project_id, int $issue_iid, string $duration): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/time_estimate'), ['duration' => $duration]); } @@ -223,7 +223,7 @@ public function setTimeEstimate(int|string $project_id, int $issue_iid, string $ /** * @return mixed */ - public function resetTimeEstimate(int|string $project_id, int $issue_iid) + public function resetTimeEstimate(int|string $project_id, int $issue_iid): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/reset_time_estimate')); } @@ -231,7 +231,7 @@ public function resetTimeEstimate(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function addSpentTime(int|string $project_id, int $issue_iid, string $duration) + public function addSpentTime(int|string $project_id, int $issue_iid, string $duration): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/add_spent_time'), ['duration' => $duration]); } @@ -239,7 +239,7 @@ public function addSpentTime(int|string $project_id, int $issue_iid, string $dur /** * @return mixed */ - public function resetSpentTime(int|string $project_id, int $issue_iid) + public function resetSpentTime(int|string $project_id, int $issue_iid): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/reset_spent_time')); } @@ -247,7 +247,7 @@ public function resetSpentTime(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function getTimeStats(int|string $project_id, int $issue_iid) + public function getTimeStats(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/time_stats')); } @@ -263,7 +263,7 @@ public function getTimeStats(int|string $project_id, int $issue_iid) * * @return mixed */ - public function subscribe(int|string $project_id, int $issue_iid) + public function subscribe(int|string $project_id, int $issue_iid): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/subscribe')); } @@ -279,7 +279,7 @@ public function subscribe(int|string $project_id, int $issue_iid) * * @return mixed */ - public function unsubscribe(int|string $project_id, int $issue_iid) + public function unsubscribe(int|string $project_id, int $issue_iid): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/unsubscribe')); } @@ -287,7 +287,7 @@ public function unsubscribe(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function awardEmoji(int|string $project_id, int $issue_iid) + public function awardEmoji(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/award_emoji')); } @@ -295,7 +295,7 @@ public function awardEmoji(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function removeAwardEmoji(int|string $project_id, int $issue_iid, int $award_id) + public function removeAwardEmoji(int|string $project_id, int $issue_iid, int $award_id): mixed { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/award_emoji/'.self::encodePath($award_id))); } @@ -303,7 +303,7 @@ public function removeAwardEmoji(int|string $project_id, int $issue_iid, int $aw /** * @return mixed */ - public function closedByMergeRequests(int|string $project_id, int $issue_iid) + public function closedByMergeRequests(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/closed_by'); } @@ -311,7 +311,7 @@ public function closedByMergeRequests(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function relatedMergeRequests(int|string $project_id, int $issue_iid) + public function relatedMergeRequests(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/related_merge_requests')); } @@ -319,7 +319,7 @@ public function relatedMergeRequests(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function showParticipants(int|string $project_id, int $issue_iid) + public function showParticipants(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/participants'); } @@ -327,7 +327,7 @@ public function showParticipants(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function showResourceLabelEvents(int|string $project_id, int $issue_iid) + public function showResourceLabelEvents(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/resource_label_events'); } @@ -335,7 +335,7 @@ public function showResourceLabelEvents(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function showResourceLabelEvent(int|string $project_id, int $issue_iid, int $resource_label_event_id) + public function showResourceLabelEvent(int|string $project_id, int $issue_iid, int $resource_label_event_id): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/resource_label_events/'.self::encodePath($resource_label_event_id)); } diff --git a/src/Api/IssuesStatistics.php b/src/Api/IssuesStatistics.php index 864eb0b3..a7009614 100644 --- a/src/Api/IssuesStatistics.php +++ b/src/Api/IssuesStatistics.php @@ -22,7 +22,7 @@ class IssuesStatistics extends AbstractApi /** * @return mixed */ - public function all(array $parameters) + public function all(array $parameters): mixed { return $this->get('issues_statistics', $this->createOptionsResolver()->resolve($parameters)); } @@ -30,7 +30,7 @@ public function all(array $parameters) /** * @return mixed */ - public function project(int|string $project_id, array $parameters) + public function project(int|string $project_id, array $parameters): mixed { return $this->get($this->getProjectPath($project_id, 'issues_statistics'), $this->createOptionsResolver()->resolve($parameters)); } @@ -38,7 +38,7 @@ public function project(int|string $project_id, array $parameters) /** * @return mixed */ - public function group(int|string $group_id, array $parameters) + public function group(int|string $group_id, array $parameters): mixed { return $this->get('groups/'.self::encodePath($group_id).'/issues_statistics', $this->createOptionsResolver()->resolve($parameters)); } diff --git a/src/Api/Jobs.php b/src/Api/Jobs.php index 5db61af6..8b41ec8d 100644 --- a/src/Api/Jobs.php +++ b/src/Api/Jobs.php @@ -68,7 +68,7 @@ class Jobs extends AbstractApi * * @return mixed */ - public function all(int|string $project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -84,7 +84,7 @@ public function all(int|string $project_id, array $parameters = []) * * @return mixed */ - public function pipelineJobs(int|string $project_id, int $pipeline_id, array $parameters = []) + public function pipelineJobs(int|string $project_id, int $pipeline_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -104,7 +104,7 @@ public function pipelineJobs(int|string $project_id, int $pipeline_id, array $pa * * @return mixed */ - public function pipelineBridges(int|string $project_id, int $pipeline_id, array $parameters = []) + public function pipelineBridges(int|string $project_id, int $pipeline_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -117,7 +117,7 @@ public function pipelineBridges(int|string $project_id, int $pipeline_id, array /** * @return mixed */ - public function show(int|string $project_id, int $job_id) + public function show(int|string $project_id, int $job_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id)); } @@ -125,7 +125,7 @@ public function show(int|string $project_id, int $job_id) /** * @return StreamInterface */ - public function artifacts(int|string $project_id, int $job_id) + public function artifacts(int|string $project_id, int $job_id): StreamInterface { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/artifacts')->getBody(); } @@ -133,7 +133,7 @@ public function artifacts(int|string $project_id, int $job_id) /** * @return StreamInterface */ - public function artifactsByRefName(int|string $project_id, string $ref_name, string $job_name) + public function artifactsByRefName(int|string $project_id, string $ref_name, string $job_name): StreamInterface { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/download', [ 'job' => $job_name, @@ -143,7 +143,7 @@ public function artifactsByRefName(int|string $project_id, string $ref_name, str /** * @return StreamInterface */ - public function artifactByRefName(int|string $project_id, string $ref_name, string $job_name, string $artifact_path) + public function artifactByRefName(int|string $project_id, string $ref_name, string $job_name, string $artifact_path): StreamInterface { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/raw/'.self::encodePath($artifact_path), [ 'job' => $job_name, @@ -153,7 +153,7 @@ public function artifactByRefName(int|string $project_id, string $ref_name, stri /** * @return StreamInterface */ - public function artifactByJobId(int|string $project_id, int $job_id, string $artifact_path) + public function artifactByJobId(int|string $project_id, int $job_id, string $artifact_path): StreamInterface { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/artifacts/'.self::encodePath($artifact_path))->getBody(); } @@ -161,7 +161,7 @@ public function artifactByJobId(int|string $project_id, int $job_id, string $art /** * @return mixed */ - public function trace(int|string $project_id, int $job_id) + public function trace(int|string $project_id, int $job_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/trace'); } @@ -169,7 +169,7 @@ public function trace(int|string $project_id, int $job_id) /** * @return mixed */ - public function cancel(int|string $project_id, int $job_id) + public function cancel(int|string $project_id, int $job_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/cancel'); } @@ -177,7 +177,7 @@ public function cancel(int|string $project_id, int $job_id) /** * @return mixed */ - public function retry(int|string $project_id, int $job_id) + public function retry(int|string $project_id, int $job_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/retry'); } @@ -185,7 +185,7 @@ public function retry(int|string $project_id, int $job_id) /** * @return mixed */ - public function erase(int|string $project_id, int $job_id) + public function erase(int|string $project_id, int $job_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/erase'); } @@ -193,7 +193,7 @@ public function erase(int|string $project_id, int $job_id) /** * @return mixed */ - public function keepArtifacts(int|string $project_id, int $job_id) + public function keepArtifacts(int|string $project_id, int $job_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/artifacts/keep'); } @@ -201,7 +201,7 @@ public function keepArtifacts(int|string $project_id, int $job_id) /** * @return mixed */ - public function play(int|string $project_id, int $job_id) + public function play(int|string $project_id, int $job_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/play'); } diff --git a/src/Api/Keys.php b/src/Api/Keys.php index 14b44b45..6a4d7553 100644 --- a/src/Api/Keys.php +++ b/src/Api/Keys.php @@ -19,7 +19,7 @@ class Keys extends AbstractApi /** * @return mixed */ - public function show(int $id) + public function show(int $id): mixed { return $this->get('keys/'.self::encodePath($id)); } diff --git a/src/Api/MergeRequests.php b/src/Api/MergeRequests.php index 09d9954b..ff9f68b4 100644 --- a/src/Api/MergeRequests.php +++ b/src/Api/MergeRequests.php @@ -69,7 +69,7 @@ class MergeRequests extends AbstractApi * * @return mixed */ - public function all(int|string|null $project_id = null, array $parameters = []) + public function all(int|string|null $project_id = null, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -161,7 +161,7 @@ public function all(int|string|null $project_id = null, array $parameters = []) * * @return mixed */ - public function show(int|string $project_id, int $mr_iid, array $parameters = []) + public function show(int|string $project_id, int $mr_iid, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('include_diverged_commits_count') @@ -184,7 +184,7 @@ public function show(int|string $project_id, int $mr_iid, array $parameters = [] * * @return mixed */ - public function create(int|string $project_id, string $source, string $target, string $title, array $parameters = []) + public function create(int|string $project_id, string $source, string $target, string $title, array $parameters = []): mixed { $baseParams = [ 'source_branch' => $source, @@ -201,7 +201,7 @@ public function create(int|string $project_id, string $source, string $target, s /** * @return mixed */ - public function update(int|string $project_id, int $mr_iid, array $parameters) + public function update(int|string $project_id, int $mr_iid, array $parameters): mixed { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)), $parameters); } @@ -209,7 +209,7 @@ public function update(int|string $project_id, int $mr_iid, array $parameters) /** * @return mixed */ - public function merge(int|string $project_id, int $mr_iid, array $parameters = []) + public function merge(int|string $project_id, int $mr_iid, array $parameters = []): mixed { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/merge'), $parameters); } @@ -217,7 +217,7 @@ public function merge(int|string $project_id, int $mr_iid, array $parameters = [ /** * @return mixed */ - public function showNotes(int|string $project_id, int $mr_iid) + public function showNotes(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes')); } @@ -225,7 +225,7 @@ public function showNotes(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function showNote(int|string $project_id, int $mr_iid, int $note_id) + public function showNote(int|string $project_id, int $mr_iid, int $note_id): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id))); } @@ -233,7 +233,7 @@ public function showNote(int|string $project_id, int $mr_iid, int $note_id) /** * @return mixed */ - public function addNote(int|string $project_id, int $mr_iid, string $body, array $params = []) + public function addNote(int|string $project_id, int $mr_iid, string $body, array $params = []): mixed { $params['body'] = $body; @@ -243,7 +243,7 @@ public function addNote(int|string $project_id, int $mr_iid, string $body, array /** * @return mixed */ - public function updateNote(int|string $project_id, int $mr_iid, int $note_id, string $body) + public function updateNote(int|string $project_id, int $mr_iid, int $note_id, string $body): mixed { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id)), [ 'body' => $body, @@ -253,7 +253,7 @@ public function updateNote(int|string $project_id, int $mr_iid, int $note_id, st /** * @return mixed */ - public function removeNote(int|string $project_id, int $mr_iid, int $note_id) + public function removeNote(int|string $project_id, int $mr_iid, int $note_id): mixed { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id))); } @@ -261,7 +261,7 @@ public function removeNote(int|string $project_id, int $mr_iid, int $note_id) /** * @return mixed */ - public function showDiscussions(int|string $project_id, int $mr_iid) + public function showDiscussions(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/discussions'); } @@ -269,7 +269,7 @@ public function showDiscussions(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function showDiscussion(int|string $project_id, int $mr_iid, string $discussion_id) + public function showDiscussion(int|string $project_id, int $mr_iid, string $discussion_id): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/discussions/'.self::encodePath($discussion_id)); } @@ -277,7 +277,7 @@ public function showDiscussion(int|string $project_id, int $mr_iid, string $disc /** * @return mixed */ - public function addDiscussion(int|string $project_id, int $mr_iid, array $params) + public function addDiscussion(int|string $project_id, int $mr_iid, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions'), $params); } @@ -285,7 +285,7 @@ public function addDiscussion(int|string $project_id, int $mr_iid, array $params /** * @return mixed */ - public function resolveDiscussion(int|string $project_id, int $mr_iid, string $discussion_id, bool $resolved = true) + public function resolveDiscussion(int|string $project_id, int $mr_iid, string $discussion_id, bool $resolved = true): mixed { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id)), [ 'resolved' => $resolved, @@ -295,7 +295,7 @@ public function resolveDiscussion(int|string $project_id, int $mr_iid, string $d /** * @return mixed */ - public function addDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, string $body) + public function addDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, string $body): mixed { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes'), ['body' => $body]); } @@ -303,7 +303,7 @@ public function addDiscussionNote(int|string $project_id, int $mr_iid, string $d /** * @return mixed */ - public function updateDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, int $note_id, array $params) + public function updateDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, int $note_id, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id)), $params); } @@ -311,7 +311,7 @@ public function updateDiscussionNote(int|string $project_id, int $mr_iid, string /** * @return mixed */ - public function removeDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, int $note_id) + public function removeDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, int $note_id): mixed { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id))); } @@ -319,7 +319,7 @@ public function removeDiscussionNote(int|string $project_id, int $mr_iid, string /** * @return mixed */ - public function showParticipants(int|string $project_id, int $mr_iid) + public function showParticipants(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/participants'); } @@ -327,7 +327,7 @@ public function showParticipants(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function changes(int|string $project_id, int $mr_iid) + public function changes(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/changes')); } @@ -335,7 +335,7 @@ public function changes(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function commits(int|string $project_id, int $mr_iid) + public function commits(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/commits')); } @@ -343,7 +343,7 @@ public function commits(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function closesIssues(int|string $project_id, int $mr_iid) + public function closesIssues(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/closes_issues')); } @@ -351,7 +351,7 @@ public function closesIssues(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function approvals(int|string $project_id, int $mr_iid) + public function approvals(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approvals')); } @@ -359,7 +359,7 @@ public function approvals(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function approve(int|string $project_id, int $mr_iid) + public function approve(int|string $project_id, int $mr_iid): mixed { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approve')); } @@ -367,7 +367,7 @@ public function approve(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function unapprove(int|string $project_id, int $mr_iid) + public function unapprove(int|string $project_id, int $mr_iid): mixed { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/unapprove')); } @@ -375,7 +375,7 @@ public function unapprove(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function awardEmoji(int|string $project_id, int $mr_iid) + public function awardEmoji(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji')); } @@ -383,7 +383,7 @@ public function awardEmoji(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function removeAwardEmoji(int|string $project_id, int $mr_iid, int $award_id) + public function removeAwardEmoji(int|string $project_id, int $mr_iid, int $award_id): mixed { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji/'.self::encodePath($award_id))); } @@ -391,7 +391,7 @@ public function removeAwardEmoji(int|string $project_id, int $mr_iid, int $award /** * @return mixed */ - public function rebase(int|string $project_id, int $mr_iid, array $params = []) + public function rebase(int|string $project_id, int $mr_iid, array $params = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('skip_ci') @@ -403,7 +403,7 @@ public function rebase(int|string $project_id, int $mr_iid, array $params = []) /** * @return mixed */ - public function approvalState(int|string $project_id, int $mr_iid) + public function approvalState(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_state')); } @@ -411,7 +411,7 @@ public function approvalState(int|string $project_id, int $mr_iid) /** * @return mixed */ - public function levelRules(int|string $project_id, int $mr_iid) + public function levelRules(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_rules')); } @@ -421,7 +421,7 @@ public function levelRules(int|string $project_id, int $mr_iid) * * @return mixed */ - public function createLevelRule(int|string $project_id, int $mr_iid, string $name, int $approvals_required, array $parameters = []) + public function createLevelRule(int|string $project_id, int $mr_iid, string $name, int $approvals_required, array $parameters = []): mixed { $baseParam = [ 'name' => $name, @@ -439,7 +439,7 @@ public function createLevelRule(int|string $project_id, int $mr_iid, string $nam * * @return mixed */ - public function updateLevelRule(int|string $project_id, int $mr_iid, int $approval_rule_id, string $name, int $approvals_required, array $parameters = []) + public function updateLevelRule(int|string $project_id, int $mr_iid, int $approval_rule_id, string $name, int $approvals_required, array $parameters = []): mixed { $baseParam = [ 'name' => $name, @@ -455,7 +455,7 @@ public function updateLevelRule(int|string $project_id, int $mr_iid, int $approv /** * @return mixed */ - public function deleteLevelRule(int|string $project_id, int $mr_iid, int $approval_rule_id) + public function deleteLevelRule(int|string $project_id, int $mr_iid, int $approval_rule_id): mixed { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_rules/'.self::encodePath($approval_rule_id))); } diff --git a/src/Api/Milestones.php b/src/Api/Milestones.php index 1fbe59ac..2c1e7d09 100644 --- a/src/Api/Milestones.php +++ b/src/Api/Milestones.php @@ -36,7 +36,7 @@ class Milestones extends AbstractApi * * @return mixed */ - public function all(int|string $project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('iids') @@ -56,7 +56,7 @@ public function all(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function show(int|string $project_id, int $milestone_id) + public function show(int|string $project_id, int $milestone_id): mixed { return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id))); } @@ -64,7 +64,7 @@ public function show(int|string $project_id, int $milestone_id) /** * @return mixed */ - public function create(int|string $project_id, array $params) + public function create(int|string $project_id, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'milestones'), $params); } @@ -72,7 +72,7 @@ public function create(int|string $project_id, array $params) /** * @return mixed */ - public function update(int|string $project_id, int $milestone_id, array $params) + public function update(int|string $project_id, int $milestone_id, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id)), $params); } @@ -80,7 +80,7 @@ public function update(int|string $project_id, int $milestone_id, array $params) /** * @return mixed */ - public function remove(int|string $project_id, int $milestone_id) + public function remove(int|string $project_id, int $milestone_id): mixed { return $this->delete($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id))); } @@ -88,7 +88,7 @@ public function remove(int|string $project_id, int $milestone_id) /** * @return mixed */ - public function issues(int|string $project_id, int $milestone_id) + public function issues(int|string $project_id, int $milestone_id): mixed { return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id).'/issues')); } @@ -96,7 +96,7 @@ public function issues(int|string $project_id, int $milestone_id) /** * @return mixed */ - public function mergeRequests(int|string $project_id, int $milestone_id) + public function mergeRequests(int|string $project_id, int $milestone_id): mixed { return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id).'/merge_requests')); } diff --git a/src/Api/Packages.php b/src/Api/Packages.php index c414e1bb..5afaffa7 100644 --- a/src/Api/Packages.php +++ b/src/Api/Packages.php @@ -35,7 +35,7 @@ class Packages extends AbstractApi * * @return mixed */ - public function all(int|string $project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -65,7 +65,7 @@ public function all(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function show(int|string $project_id, int $package_id) + public function show(int|string $project_id, int $package_id): mixed { return $this->get($this->getPackagePath($project_id, $package_id)); } @@ -73,7 +73,7 @@ public function show(int|string $project_id, int $package_id) /** * @return mixed */ - public function allFiles(int|string $project_id, int $package_id) + public function allFiles(int|string $project_id, int $package_id): mixed { return $this->get($this->getPackagePath($project_id, $package_id).'/package_files'); } @@ -81,7 +81,7 @@ public function allFiles(int|string $project_id, int $package_id) /** * @return mixed */ - public function remove(int|string $project_id, int $package_id) + public function remove(int|string $project_id, int $package_id): mixed { return $this->delete($this->getPackagePath($project_id, $package_id)); } @@ -89,7 +89,7 @@ public function remove(int|string $project_id, int $package_id) /** * @return mixed */ - public function removeFile(int|string $project_id, int $package_id, int $package_file_id) + public function removeFile(int|string $project_id, int $package_id, int $package_file_id): mixed { return $this->delete( $this->getPackagePath($project_id, $package_id).'/package_files/'.self::encodePath($package_file_id) @@ -99,7 +99,7 @@ public function removeFile(int|string $project_id, int $package_id, int $package /** * @return mixed */ - public function addGenericFile(int|string $project_id, string $package_name, string $package_version, string $file, string $status = 'default') + public function addGenericFile(int|string $project_id, string $package_name, string $package_version, string $file, string $status = 'default'): mixed { return $this->putFile( $this->getProjectPath( diff --git a/src/Api/ProjectNamespaces.php b/src/Api/ProjectNamespaces.php index 5dcf172d..b02bd90e 100644 --- a/src/Api/ProjectNamespaces.php +++ b/src/Api/ProjectNamespaces.php @@ -24,7 +24,7 @@ class ProjectNamespaces extends AbstractApi * * @return mixed */ - public function all(array $parameters = []) + public function all(array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('search'); @@ -35,7 +35,7 @@ public function all(array $parameters = []) /** * @return mixed */ - public function show(int|string $namespace_id) + public function show(int|string $namespace_id): mixed { return $this->get('namespaces/'.self::encodePath($namespace_id)); } diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 08cb8387..c72fb947 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -57,7 +57,7 @@ class Projects extends AbstractApi * * @return mixed */ - public function all(array $parameters = []) + public function all(array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -161,7 +161,7 @@ public function all(array $parameters = []) * * @return mixed */ - public function show(int|string $project_id, array $parameters = []) + public function show(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): bool { @@ -182,7 +182,7 @@ public function show(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function create(string $name, array $parameters = []) + public function create(string $name, array $parameters = []): mixed { $parameters['name'] = $name; @@ -192,7 +192,7 @@ public function create(string $name, array $parameters = []) /** * @return mixed */ - public function createForUser(int $user_id, string $name, array $parameters = []) + public function createForUser(int $user_id, string $name, array $parameters = []): mixed { $parameters['name'] = $name; @@ -202,7 +202,7 @@ public function createForUser(int $user_id, string $name, array $parameters = [] /** * @return mixed */ - public function update(int|string $project_id, array $parameters) + public function update(int|string $project_id, array $parameters): mixed { return $this->put('projects/'.self::encodePath($project_id), $parameters); } @@ -210,7 +210,7 @@ public function update(int|string $project_id, array $parameters) /** * @return mixed */ - public function remove(int|string $project_id) + public function remove(int|string $project_id): mixed { return $this->delete('projects/'.self::encodePath($project_id)); } @@ -218,7 +218,7 @@ public function remove(int|string $project_id) /** * @return mixed */ - public function archive(int|string $project_id) + public function archive(int|string $project_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/archive'); } @@ -226,7 +226,7 @@ public function archive(int|string $project_id) /** * @return mixed */ - public function unarchive(int|string $project_id) + public function unarchive(int|string $project_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/unarchive'); } @@ -234,7 +234,7 @@ public function unarchive(int|string $project_id) /** * @return mixed */ - public function triggers(int|string $project_id) + public function triggers(int|string $project_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/triggers'); } @@ -242,7 +242,7 @@ public function triggers(int|string $project_id) /** * @return mixed */ - public function trigger(int|string $project_id, int $trigger_id) + public function trigger(int|string $project_id, int $trigger_id): mixed { return $this->get($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); } @@ -250,7 +250,7 @@ public function trigger(int|string $project_id, int $trigger_id) /** * @return mixed */ - public function createTrigger(int|string $project_id, string $description) + public function createTrigger(int|string $project_id, string $description): mixed { return $this->post($this->getProjectPath($project_id, 'triggers'), [ 'description' => $description, @@ -260,7 +260,7 @@ public function createTrigger(int|string $project_id, string $description) /** * @return mixed */ - public function removeTrigger(int|string $project_id, int $trigger_id) + public function removeTrigger(int|string $project_id, int $trigger_id): mixed { return $this->delete($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); } @@ -268,7 +268,7 @@ public function removeTrigger(int|string $project_id, int $trigger_id) /** * @return mixed */ - public function triggerPipeline(int|string $project_id, string $ref, string $token, array $variables = []) + public function triggerPipeline(int|string $project_id, string $ref, string $token, array $variables = []): mixed { return $this->post($this->getProjectPath($project_id, 'trigger/pipeline'), [ 'ref' => $ref, @@ -280,7 +280,7 @@ public function triggerPipeline(int|string $project_id, string $ref, string $tok /** * @return mixed */ - public function disableRunner(int $project_id, int $runner_id) + public function disableRunner(int $project_id, int $runner_id): mixed { return $this->delete('projects/'.self::encodePath($project_id).'/runners/'.self::encodePath($runner_id)); } @@ -288,7 +288,7 @@ public function disableRunner(int $project_id, int $runner_id) /** * @return mixed */ - public function enableRunner(int $project_id, int $runner_id) + public function enableRunner(int $project_id, int $runner_id): mixed { $parameters = [ 'runner_id' => $runner_id, @@ -314,7 +314,7 @@ public function enableRunner(int $project_id, int $runner_id) * * @return mixed */ - public function pipelines(int|string $project_id, array $parameters = []) + public function pipelines(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -362,7 +362,7 @@ public function pipelines(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function pipeline(int|string $project_id, int $pipeline_id) + public function pipeline(int|string $project_id, int $pipeline_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id))); } @@ -370,7 +370,7 @@ public function pipeline(int|string $project_id, int $pipeline_id) /** * @return mixed */ - public function pipelineJobs(int|string $project_id, int $pipeline_id) + public function pipelineJobs(int|string $project_id, int $pipeline_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/jobs')); } @@ -378,7 +378,7 @@ public function pipelineJobs(int|string $project_id, int $pipeline_id) /** * @return mixed */ - public function pipelineVariables(int|string $project_id, int $pipeline_id) + public function pipelineVariables(int|string $project_id, int $pipeline_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/variables')); } @@ -386,7 +386,7 @@ public function pipelineVariables(int|string $project_id, int $pipeline_id) /** * @return mixed */ - public function pipelineTestReport(int|string $project_id, int $pipeline_id) + public function pipelineTestReport(int|string $project_id, int $pipeline_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report')); } @@ -394,7 +394,7 @@ public function pipelineTestReport(int|string $project_id, int $pipeline_id) /** * @return mixed */ - public function pipelineTestReportSummary(int|string $project_id, int $pipeline_id) + public function pipelineTestReportSummary(int|string $project_id, int $pipeline_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report_summary')); } @@ -409,7 +409,7 @@ public function pipelineTestReportSummary(int|string $project_id, int $pipeline_ * * @return mixed */ - public function createPipeline(int|string $project_id, string $commit_ref, ?array $variables = null) + public function createPipeline(int|string $project_id, string $commit_ref, ?array $variables = null): mixed { $parameters = []; @@ -425,7 +425,7 @@ public function createPipeline(int|string $project_id, string $commit_ref, ?arra /** * @return mixed */ - public function retryPipeline(int|string $project_id, int $pipeline_id) + public function retryPipeline(int|string $project_id, int $pipeline_id): mixed { return $this->post($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id)).'/retry'); } @@ -433,7 +433,7 @@ public function retryPipeline(int|string $project_id, int $pipeline_id) /** * @return mixed */ - public function cancelPipeline(int|string $project_id, int $pipeline_id) + public function cancelPipeline(int|string $project_id, int $pipeline_id): mixed { return $this->post($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id)).'/cancel'); } @@ -441,7 +441,7 @@ public function cancelPipeline(int|string $project_id, int $pipeline_id) /** * @return mixed */ - public function deletePipeline(int|string $project_id, int $pipeline_id) + public function deletePipeline(int|string $project_id, int $pipeline_id): mixed { return $this->delete($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id))); } @@ -449,7 +449,7 @@ public function deletePipeline(int|string $project_id, int $pipeline_id) /** * @return mixed */ - public function allMembers(int|string $project_id, array $parameters = []) + public function allMembers(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('query'); @@ -471,7 +471,7 @@ public function allMembers(int|string $project_id, array $parameters = []) * * @return mixed */ - public function members(int|string $project_id, array $parameters = []) + public function members(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -491,7 +491,7 @@ public function members(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function member(int|string $project_id, int $user_id) + public function member(int|string $project_id, int $user_id): mixed { return $this->get($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id))); } @@ -499,7 +499,7 @@ public function member(int|string $project_id, int $user_id) /** * @return mixed */ - public function allMember(int|string $project_id, int $user_id) + public function allMember(int|string $project_id, int $user_id): mixed { return $this->get($this->getProjectPath($project_id, 'members/all/'.self::encodePath($user_id))); } @@ -507,7 +507,7 @@ public function allMember(int|string $project_id, int $user_id) /** * @return mixed */ - public function addMember(int|string $project_id, int $user_id, int $access_level, ?string $expires_at = null) + public function addMember(int|string $project_id, int $user_id, int $access_level, ?string $expires_at = null): mixed { $params = [ 'user_id' => $user_id, @@ -523,7 +523,7 @@ public function addMember(int|string $project_id, int $user_id, int $access_leve /** * @return mixed */ - public function saveMember(int|string $project_id, int $user_id, int $access_level, ?string $expires_at = null) + public function saveMember(int|string $project_id, int $user_id, int $access_level, ?string $expires_at = null): mixed { $params = [ 'access_level' => $access_level, @@ -538,7 +538,7 @@ public function saveMember(int|string $project_id, int $user_id, int $access_lev /** * @return mixed */ - public function removeMember(int|string $project_id, int $user_id) + public function removeMember(int|string $project_id, int $user_id): mixed { return $this->delete($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id))); } @@ -546,7 +546,7 @@ public function removeMember(int|string $project_id, int $user_id) /** * @return mixed */ - public function hooks(int|string $project_id, array $parameters = []) + public function hooks(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -556,7 +556,7 @@ public function hooks(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function hook(int|string $project_id, int $hook_id) + public function hook(int|string $project_id, int $hook_id): mixed { return $this->get($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id))); } @@ -568,7 +568,7 @@ public function hook(int|string $project_id, int $hook_id) * * @return mixed */ - public function users(int|string $project_id, array $parameters = []) + public function users(int|string $project_id, array $parameters = []): mixed { return $this->get($this->getProjectPath($project_id, 'users'), $parameters); } @@ -580,7 +580,7 @@ public function users(int|string $project_id, array $parameters = []) * * @return mixed */ - public function issues(int|string $project_id, array $parameters = []) + public function issues(int|string $project_id, array $parameters = []): mixed { return $this->get($this->getProjectPath($project_id, 'issues'), $parameters); } @@ -592,7 +592,7 @@ public function issues(int|string $project_id, array $parameters = []) * * @return mixed */ - public function boards(int|string $project_id) + public function boards(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'boards')); } @@ -608,7 +608,7 @@ public function boards(int|string $project_id) * * @return mixed */ - public function iterations(int|string $project_id, array $parameters = []) + public function iterations(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -638,7 +638,7 @@ public function iterations(int|string $project_id, array $parameters = []) * * @return mixed */ - public function getRepositoryCommitDiscussions(int|string $project_id, string $commit_id) + public function getRepositoryCommitDiscussions(int|string $project_id, string $commit_id): mixed { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($commit_id)).'/discussions'); } @@ -646,7 +646,7 @@ public function getRepositoryCommitDiscussions(int|string $project_id, string $c /** * @return mixed */ - public function addHook(int|string $project_id, string $url, array $parameters = []) + public function addHook(int|string $project_id, string $url, array $parameters = []): mixed { if (0 === \count($parameters)) { $parameters = ['push_events' => true]; @@ -660,7 +660,7 @@ public function addHook(int|string $project_id, string $url, array $parameters = /** * @return mixed */ - public function updateHook(int|string $project_id, int $hook_id, array $parameters) + public function updateHook(int|string $project_id, int $hook_id, array $parameters): mixed { return $this->put($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id)), $parameters); } @@ -668,7 +668,7 @@ public function updateHook(int|string $project_id, int $hook_id, array $paramete /** * @return mixed */ - public function removeHook(int|string $project_id, int $hook_id) + public function removeHook(int|string $project_id, int $hook_id): mixed { return $this->delete($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id))); } @@ -676,7 +676,7 @@ public function removeHook(int|string $project_id, int $hook_id) /** * @return mixed */ - public function transfer(int|string $project_id, mixed $namespace) + public function transfer(int|string $project_id, mixed $namespace): mixed { return $this->put($this->getProjectPath($project_id, 'transfer'), ['namespace' => $namespace]); } @@ -684,7 +684,7 @@ public function transfer(int|string $project_id, mixed $namespace) /** * @return mixed */ - public function deployKeys(int|string $project_id) + public function deployKeys(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'deploy_keys')); } @@ -692,7 +692,7 @@ public function deployKeys(int|string $project_id) /** * @return mixed */ - public function deployKey(int|string $project_id, int $key_id) + public function deployKey(int|string $project_id, int $key_id): mixed { return $this->get($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id))); } @@ -700,7 +700,7 @@ public function deployKey(int|string $project_id, int $key_id) /** * @return mixed */ - public function addDeployKey(int|string $project_id, string $title, string $key, bool $canPush = false) + public function addDeployKey(int|string $project_id, string $title, string $key, bool $canPush = false): mixed { return $this->post($this->getProjectPath($project_id, 'deploy_keys'), [ 'title' => $title, @@ -712,7 +712,7 @@ public function addDeployKey(int|string $project_id, string $title, string $key, /** * @return mixed */ - public function deleteDeployKey(int|string $project_id, int $key_id) + public function deleteDeployKey(int|string $project_id, int $key_id): mixed { return $this->delete($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id))); } @@ -720,7 +720,7 @@ public function deleteDeployKey(int|string $project_id, int $key_id) /** * @return mixed */ - public function enableDeployKey(int|string $project_id, int $key_id) + public function enableDeployKey(int|string $project_id, int $key_id): mixed { return $this->post($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id).'/enable')); } @@ -728,7 +728,7 @@ public function enableDeployKey(int|string $project_id, int $key_id) /** * @return mixed */ - public function deployTokens(int|string $project_id, ?bool $active = null) + public function deployTokens(int|string $project_id, ?bool $active = null): mixed { return $this->get($this->getProjectPath($project_id, 'deploy_tokens'), (null !== $active) ? ['active' => $active] : []); } @@ -744,7 +744,7 @@ public function deployTokens(int|string $project_id, ?bool $active = null) * * @return mixed */ - public function createDeployToken(int|string $project_id, array $parameters = []) + public function createDeployToken(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -784,7 +784,7 @@ public function createDeployToken(int|string $project_id, array $parameters = [] /** * @return mixed */ - public function deleteDeployToken(int|string $project_id, int $token_id) + public function deleteDeployToken(int|string $project_id, int $token_id): mixed { return $this->delete($this->getProjectPath($project_id, 'deploy_tokens/'.self::encodePath($token_id))); } @@ -801,7 +801,7 @@ public function deleteDeployToken(int|string $project_id, int $token_id) * * @return mixed */ - public function events(int|string $project_id, array $parameters = []) + public function events(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -838,7 +838,7 @@ public function events(int|string $project_id, array $parameters = []) * * @return mixed */ - public function labels(int|string $project_id, array $parameters = []) + public function labels(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -857,7 +857,7 @@ public function labels(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function addLabel(int|string $project_id, array $parameters) + public function addLabel(int|string $project_id, array $parameters): mixed { return $this->post($this->getProjectPath($project_id, 'labels'), $parameters); } @@ -865,7 +865,7 @@ public function addLabel(int|string $project_id, array $parameters) /** * @return mixed */ - public function updateLabel(int|string $project_id, int $label_id, array $parameters) + public function updateLabel(int|string $project_id, int $label_id, array $parameters): mixed { return $this->put($this->getProjectPath($project_id, 'labels/'.self::encodePath($label_id)), $parameters); } @@ -873,7 +873,7 @@ public function updateLabel(int|string $project_id, int $label_id, array $parame /** * @return mixed */ - public function removeLabel(int|string $project_id, int $label_id) + public function removeLabel(int|string $project_id, int $label_id): mixed { return $this->delete($this->getProjectPath($project_id, 'labels/'.self::encodePath($label_id))); } @@ -883,7 +883,7 @@ public function removeLabel(int|string $project_id, int $label_id) * * @return mixed */ - public function languages(int|string $project_id) + public function languages(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'languages')); } @@ -913,7 +913,7 @@ public function languages(int|string $project_id) * * @return mixed */ - public function forks(int|string $project_id, array $parameters = []) + public function forks(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -997,7 +997,7 @@ public function forks(int|string $project_id, array $parameters = []) * * @return mixed */ - public function fork(int|string $project_id, array $parameters = []) + public function fork(int|string $project_id, array $parameters = []): mixed { $resolver = new OptionsResolver(); $resolver->setDefined(['namespace', 'path', 'name']); @@ -1010,7 +1010,7 @@ public function fork(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function createForkRelation(int|string $project_id, int|string $forked_project_id) + public function createForkRelation(int|string $project_id, int|string $forked_project_id): mixed { return $this->post($this->getProjectPath($project_id, 'fork/'.self::encodePath($forked_project_id))); } @@ -1018,7 +1018,7 @@ public function createForkRelation(int|string $project_id, int|string $forked_pr /** * @return mixed */ - public function removeForkRelation(int|string $project_id) + public function removeForkRelation(int|string $project_id): mixed { return $this->delete($this->getProjectPath($project_id, 'fork')); } @@ -1026,7 +1026,7 @@ public function removeForkRelation(int|string $project_id) /** * @return mixed */ - public function setService(int|string $project_id, string $service_name, array $parameters = []) + public function setService(int|string $project_id, string $service_name, array $parameters = []): mixed { return $this->put($this->getProjectPath($project_id, 'services/'.self::encodePath($service_name)), $parameters); } @@ -1034,7 +1034,7 @@ public function setService(int|string $project_id, string $service_name, array $ /** * @return mixed */ - public function removeService(int|string $project_id, string $service_name) + public function removeService(int|string $project_id, string $service_name): mixed { return $this->delete($this->getProjectPath($project_id, 'services/'.self::encodePath($service_name))); } @@ -1042,7 +1042,7 @@ public function removeService(int|string $project_id, string $service_name) /** * @return mixed */ - public function variables(int|string $project_id, array $parameters = []) + public function variables(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -1052,7 +1052,7 @@ public function variables(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function variable(int|string $project_id, string $key, array $parameters = []) + public function variable(int|string $project_id, string $key, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('filter') @@ -1069,7 +1069,7 @@ public function variable(int|string $project_id, string $key, array $parameters * * @return mixed */ - public function addVariable(int|string $project_id, string $key, string $value, ?bool $protected = null, ?string $environment_scope = null, array $parameters = []) + public function addVariable(int|string $project_id, string $key, string $value, ?bool $protected = null, ?string $environment_scope = null, array $parameters = []): mixed { $payload = [ 'key' => $key, @@ -1097,7 +1097,7 @@ public function addVariable(int|string $project_id, string $key, string $value, * * @return mixed */ - public function updateVariable(int|string $project_id, string $key, string $value, ?bool $protected = null, ?string $environment_scope = null, array $parameters = []) + public function updateVariable(int|string $project_id, string $key, string $value, ?bool $protected = null, ?string $environment_scope = null, array $parameters = []): mixed { $payload = [ 'value' => $value, @@ -1126,7 +1126,7 @@ public function updateVariable(int|string $project_id, string $key, string $valu * * @return mixed */ - public function removeVariable(int|string $project_id, string $key, array $parameters = []) + public function removeVariable(int|string $project_id, string $key, array $parameters = []): mixed { $resolver = new OptionsResolver(); $resolver->setDefined('filter') @@ -1138,7 +1138,7 @@ public function removeVariable(int|string $project_id, string $key, array $param /** * @return mixed */ - public function uploadFile(int|string $project_id, string $file) + public function uploadFile(int|string $project_id, string $file): mixed { return $this->post($this->getProjectPath($project_id, 'uploads'), [], [], ['file' => $file]); } @@ -1146,7 +1146,7 @@ public function uploadFile(int|string $project_id, string $file) /** * @return mixed */ - public function uploadAvatar(int|string $project_id, string $file) + public function uploadAvatar(int|string $project_id, string $file): mixed { return $this->put('projects/'.self::encodePath($project_id), [], [], ['avatar' => $file]); } @@ -1156,7 +1156,7 @@ public function uploadAvatar(int|string $project_id, string $file) * * @see https://docs.gitlab.com/ee/api/deployments.html#list-project-deployments */ - public function deployments(int|string $project_id, array $parameters = []) + public function deployments(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -1209,7 +1209,7 @@ public function deployments(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function deployment(int|string $project_id, int $deployment_id) + public function deployment(int|string $project_id, int $deployment_id): mixed { return $this->get($this->getProjectPath($project_id, 'deployments/'.self::encodePath($deployment_id))); } @@ -1217,7 +1217,7 @@ public function deployment(int|string $project_id, int $deployment_id) /** * @return mixed */ - public function addShare(int|string $project_id, array $parameters = []) + public function addShare(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -1243,7 +1243,7 @@ public function addShare(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function removeShare(int|string $project_id, int|string $group_id) + public function removeShare(int|string $project_id, int|string $group_id): mixed { return $this->delete($this->getProjectPath($project_id, 'share/'.$group_id)); } @@ -1251,7 +1251,7 @@ public function removeShare(int|string $project_id, int|string $group_id) /** * @return mixed */ - public function badges(int|string $project_id) + public function badges(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'badges')); } @@ -1259,7 +1259,7 @@ public function badges(int|string $project_id) /** * @return mixed */ - public function badge(int|string $project_id, int $badge_id) + public function badge(int|string $project_id, int $badge_id): mixed { return $this->get($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id))); } @@ -1267,7 +1267,7 @@ public function badge(int|string $project_id, int $badge_id) /** * @return mixed */ - public function addBadge(int|string $project_id, array $parameters = []) + public function addBadge(int|string $project_id, array $parameters = []): mixed { return $this->post($this->getProjectPath($project_id, 'badges'), $parameters); } @@ -1275,7 +1275,7 @@ public function addBadge(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function removeBadge(int|string $project_id, int $badge_id) + public function removeBadge(int|string $project_id, int $badge_id): mixed { return $this->delete($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id))); } @@ -1283,7 +1283,7 @@ public function removeBadge(int|string $project_id, int $badge_id) /** * @return mixed */ - public function updateBadge(int|string $project_id, int $badge_id, array $parameters = []) + public function updateBadge(int|string $project_id, int $badge_id, array $parameters = []): mixed { return $this->put($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id)), $parameters); } @@ -1291,7 +1291,7 @@ public function updateBadge(int|string $project_id, int $badge_id, array $parame /** * @return mixed */ - public function protectedBranches(int|string $project_id, array $parameters = []) + public function protectedBranches(int|string $project_id, array $parameters = []): mixed { return $this->get('projects/'.self::encodePath($project_id).'/protected_branches'); } @@ -1299,7 +1299,7 @@ public function protectedBranches(int|string $project_id, array $parameters = [] /** * @return mixed */ - public function addProtectedBranch(int|string $project_id, array $parameters = []) + public function addProtectedBranch(int|string $project_id, array $parameters = []): mixed { return $this->post($this->getProjectPath($project_id, 'protected_branches'), $parameters); } @@ -1307,7 +1307,7 @@ public function addProtectedBranch(int|string $project_id, array $parameters = [ /** * @return mixed */ - public function deleteProtectedBranch(int|string $project_id, string $branch_name) + public function deleteProtectedBranch(int|string $project_id, string $branch_name): mixed { return $this->delete($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name))); } @@ -1315,7 +1315,7 @@ public function deleteProtectedBranch(int|string $project_id, string $branch_nam /** * @return mixed */ - public function updateProtectedBranch(int|string $project_id, string $branch_name, array $parameters = []) + public function updateProtectedBranch(int|string $project_id, string $branch_name, array $parameters = []): mixed { return $this->patch($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name)), $parameters); } @@ -1323,7 +1323,7 @@ public function updateProtectedBranch(int|string $project_id, string $branch_nam /** * @return mixed */ - public function approvalsConfiguration(int|string $project_id) + public function approvalsConfiguration(int|string $project_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/approvals'); } @@ -1331,7 +1331,7 @@ public function approvalsConfiguration(int|string $project_id) /** * @return mixed */ - public function updateApprovalsConfiguration(int|string $project_id, array $parameters = []) + public function updateApprovalsConfiguration(int|string $project_id, array $parameters = []): mixed { return $this->post('projects/'.self::encodePath($project_id).'/approvals', $parameters); } @@ -1339,7 +1339,7 @@ public function updateApprovalsConfiguration(int|string $project_id, array $para /** * @return mixed */ - public function approvalsRules(int|string $project_id) + public function approvalsRules(int|string $project_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/approval_rules'); } @@ -1347,7 +1347,7 @@ public function approvalsRules(int|string $project_id) /** * @return mixed */ - public function createApprovalsRule(int|string $project_id, array $parameters = []) + public function createApprovalsRule(int|string $project_id, array $parameters = []): mixed { return $this->post('projects/'.self::encodePath($project_id).'/approval_rules/', $parameters); } @@ -1355,7 +1355,7 @@ public function createApprovalsRule(int|string $project_id, array $parameters = /** * @return mixed */ - public function updateApprovalsRule(int|string $project_id, int $approval_rule_id, array $parameters = []) + public function updateApprovalsRule(int|string $project_id, int $approval_rule_id, array $parameters = []): mixed { return $this->put('projects/'.self::encodePath($project_id).'/approval_rules/'.self::encodePath($approval_rule_id), $parameters); } @@ -1363,7 +1363,7 @@ public function updateApprovalsRule(int|string $project_id, int $approval_rule_i /** * @return mixed */ - public function deleteApprovalsRule(int|string $project_id, int $approval_rule_id) + public function deleteApprovalsRule(int|string $project_id, int $approval_rule_id): mixed { return $this->delete('projects/'.self::encodePath($project_id).'/approval_rules/'.self::encodePath($approval_rule_id)); } @@ -1371,7 +1371,7 @@ public function deleteApprovalsRule(int|string $project_id, int $approval_rule_i /** * @return mixed */ - public function deleteAllMergedBranches(int|string $project_id) + public function deleteAllMergedBranches(int|string $project_id): mixed { return $this->delete($this->getProjectPath($project_id, 'repository/merged_branches')); } @@ -1379,7 +1379,7 @@ public function deleteAllMergedBranches(int|string $project_id) /** * @return mixed */ - public function projectAccessTokens(int|string $project_id) + public function projectAccessTokens(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'access_tokens')); } @@ -1387,7 +1387,7 @@ public function projectAccessTokens(int|string $project_id) /** * @return mixed */ - public function projectAccessToken(int|string $project_id, int|string $token_id) + public function projectAccessToken(int|string $project_id, int|string $token_id): mixed { return $this->get($this->getProjectPath($project_id, 'access_tokens/'.self::encodePath($token_id))); } @@ -1403,7 +1403,7 @@ public function projectAccessToken(int|string $project_id, int|string $token_id) * * @return mixed */ - public function createProjectAccessToken(int|string $project_id, array $parameters = []) + public function createProjectAccessToken(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -1445,7 +1445,7 @@ public function createProjectAccessToken(int|string $project_id, array $paramete /** * @return mixed */ - public function deleteProjectAccessToken(int|string $project_id, int|string $token_id) + public function deleteProjectAccessToken(int|string $project_id, int|string $token_id): mixed { return $this->delete($this->getProjectPath($project_id, 'access_tokens/'.$token_id)); } @@ -1453,7 +1453,7 @@ public function deleteProjectAccessToken(int|string $project_id, int|string $tok /** * @return mixed */ - public function protectedTags(int|string $project_id) + public function protectedTags(int|string $project_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/protected_tags'); } @@ -1461,7 +1461,7 @@ public function protectedTags(int|string $project_id) /** * @return mixed */ - public function protectedTag(int|string $project_id, string $tag_name) + public function protectedTag(int|string $project_id, string $tag_name): mixed { return $this->get('projects/'.self::encodePath($project_id).'/protected_tags/'.self::encodePath($tag_name)); } @@ -1469,7 +1469,7 @@ public function protectedTag(int|string $project_id, string $tag_name) /** * @return mixed */ - public function addProtectedTag(int|string $project_id, array $parameters = []) + public function addProtectedTag(int|string $project_id, array $parameters = []): mixed { $resolver = new OptionsResolver(); $resolver->setDefined('name') @@ -1500,7 +1500,7 @@ public function addProtectedTag(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function deleteProtectedTag(int|string $project_id, string $tag_name) + public function deleteProtectedTag(int|string $project_id, string $tag_name): mixed { return $this->delete($this->getProjectPath($project_id, 'protected_tags/'.self::encodePath($tag_name))); } @@ -1522,7 +1522,7 @@ public function deleteProtectedTag(int|string $project_id, string $tag_name) * * @return mixed */ - public function search(int|string $id, array $parameters = []) + public function search(int|string $id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { diff --git a/src/Api/Repositories.php b/src/Api/Repositories.php index 6d39e463..d7993202 100644 --- a/src/Api/Repositories.php +++ b/src/Api/Repositories.php @@ -37,7 +37,7 @@ class Repositories extends AbstractApi * * @return mixed */ - public function branches(int|string $project_id, array $parameters = []) + public function branches(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('search') @@ -49,7 +49,7 @@ public function branches(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function branch(int|string $project_id, string $branch) + public function branch(int|string $project_id, string $branch): mixed { return $this->get($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch))); } @@ -57,7 +57,7 @@ public function branch(int|string $project_id, string $branch) /** * @return mixed */ - public function createBranch(int|string $project_id, string $branch, string $ref) + public function createBranch(int|string $project_id, string $branch, string $ref): mixed { return $this->post($this->getProjectPath($project_id, 'repository/branches'), [ 'branch' => $branch, @@ -68,7 +68,7 @@ public function createBranch(int|string $project_id, string $branch, string $ref /** * @return mixed */ - public function deleteBranch(int|string $project_id, string $branch) + public function deleteBranch(int|string $project_id, string $branch): mixed { return $this->delete($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch))); } @@ -76,7 +76,7 @@ public function deleteBranch(int|string $project_id, string $branch) /** * @return mixed */ - public function protectBranch(int|string $project_id, string $branch, bool $devPush = false, bool $devMerge = false) + public function protectBranch(int|string $project_id, string $branch, bool $devPush = false, bool $devMerge = false): mixed { return $this->put($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch).'/protect'), [ 'developers_can_push' => $devPush, @@ -87,7 +87,7 @@ public function protectBranch(int|string $project_id, string $branch, bool $devP /** * @return mixed */ - public function unprotectBranch(int|string $project_id, string $branch) + public function unprotectBranch(int|string $project_id, string $branch): mixed { return $this->put($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch).'/unprotect')); } @@ -95,7 +95,7 @@ public function unprotectBranch(int|string $project_id, string $branch) /** * @return mixed */ - public function tags(int|string $project_id, array $parameters = []) + public function tags(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('search') @@ -107,7 +107,7 @@ public function tags(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function createTag(int|string $project_id, string $name, string $ref, ?string $message = null) + public function createTag(int|string $project_id, string $name, string $ref, ?string $message = null): mixed { return $this->post($this->getProjectPath($project_id, 'repository/tags'), [ 'tag_name' => $name, @@ -119,7 +119,7 @@ public function createTag(int|string $project_id, string $name, string $ref, ?st /** * @return mixed */ - public function createRelease(int|string $project_id, string $tag_name, string $description, ?string $name = null) + public function createRelease(int|string $project_id, string $tag_name, string $description, ?string $name = null): mixed { return $this->post($this->getProjectPath($project_id, 'releases'), \array_filter([ 'id' => $project_id, @@ -132,7 +132,7 @@ public function createRelease(int|string $project_id, string $tag_name, string $ /** * @return mixed */ - public function updateRelease(int|string $project_id, string $tag_name, string $description, ?string $name = null) + public function updateRelease(int|string $project_id, string $tag_name, string $description, ?string $name = null): mixed { return $this->put($this->getProjectPath($project_id, 'releases/'.self::encodePath($tag_name)), \array_filter([ 'id' => $project_id, @@ -145,7 +145,7 @@ public function updateRelease(int|string $project_id, string $tag_name, string $ /** * @return mixed */ - public function releases(int|string $project_id) + public function releases(int|string $project_id): mixed { $resolver = $this->createOptionsResolver(); @@ -164,7 +164,7 @@ public function releases(int|string $project_id) * * @return mixed */ - public function commits(int|string $project_id, array $parameters = []) + public function commits(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $options, \DateTimeInterface $value): string { @@ -207,7 +207,7 @@ public function commits(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function commit(int|string $project_id, string $sha) + public function commit(int|string $project_id, string $sha): mixed { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha))); } @@ -215,7 +215,7 @@ public function commit(int|string $project_id, string $sha) /** * @return mixed */ - public function commitRefs(int|string $project_id, string $sha, array $parameters = []) + public function commitRefs(int|string $project_id, string $sha, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -244,7 +244,7 @@ public function commitRefs(int|string $project_id, string $sha, array $parameter * * @return mixed */ - public function createCommit(int|string $project_id, array $parameters = []) + public function createCommit(int|string $project_id, array $parameters = []): mixed { $resolver = new OptionsResolver(); $resolver->setDefined('branch') @@ -292,7 +292,7 @@ public function createCommit(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function revertCommit(int|string $project_id, string $branch, string $sha) + public function revertCommit(int|string $project_id, string $branch, string $sha): mixed { return $this->post($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/revert'), [ 'branch' => $branch, @@ -302,7 +302,7 @@ public function revertCommit(int|string $project_id, string $branch, string $sha /** * @return mixed */ - public function commitComments(int|string $project_id, string $sha, array $parameters = []) + public function commitComments(int|string $project_id, string $sha, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -315,7 +315,7 @@ public function commitComments(int|string $project_id, string $sha, array $param /** * @return mixed */ - public function createCommitComment(int|string $project_id, string $sha, string $note, array $params = []) + public function createCommitComment(int|string $project_id, string $sha, string $note, array $params = []): mixed { $params['note'] = $note; @@ -325,7 +325,7 @@ public function createCommitComment(int|string $project_id, string $sha, string /** * @return mixed */ - public function getCommitBuildStatus(int|string $project_id, string $sha, array $params = []) + public function getCommitBuildStatus(int|string $project_id, string $sha, array $params = []): mixed { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/statuses'), $params); } @@ -333,7 +333,7 @@ public function getCommitBuildStatus(int|string $project_id, string $sha, array /** * @return mixed */ - public function postCommitBuildStatus(int|string $project_id, string $sha, string $state, array $params = []) + public function postCommitBuildStatus(int|string $project_id, string $sha, string $state, array $params = []): mixed { $params['state'] = $state; @@ -343,7 +343,7 @@ public function postCommitBuildStatus(int|string $project_id, string $sha, strin /** * @return mixed */ - public function compare(int|string $project_id, string $fromShaOrMaster, string $toShaOrMaster, bool $straight = false, ?string $fromProjectId = null) + public function compare(int|string $project_id, string $fromShaOrMaster, string $toShaOrMaster, bool $straight = false, ?string $fromProjectId = null): mixed { $params = [ 'from' => $fromShaOrMaster, @@ -361,7 +361,7 @@ public function compare(int|string $project_id, string $fromShaOrMaster, string /** * @return mixed */ - public function diff(int|string $project_id, string $sha) + public function diff(int|string $project_id, string $sha): mixed { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/diff')); } @@ -369,7 +369,7 @@ public function diff(int|string $project_id, string $sha) /** * @return mixed */ - public function tree(int|string $project_id, array $params = []) + public function tree(int|string $project_id, array $params = []): mixed { return $this->get($this->getProjectPath($project_id, 'repository/tree'), $params); } @@ -377,7 +377,7 @@ public function tree(int|string $project_id, array $params = []) /** * @return mixed */ - public function contributors(int|string $project_id) + public function contributors(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'repository/contributors')); } @@ -387,7 +387,7 @@ public function contributors(int|string $project_id) * * @return mixed */ - public function archive(int|string $project_id, array $params = [], string $format = 'tar.gz') + public function archive(int|string $project_id, array $params = [], string $format = 'tar.gz'): mixed { return $this->get($this->getProjectPath($project_id, 'repository/archive.'.$format), $params); } @@ -395,7 +395,7 @@ public function archive(int|string $project_id, array $params = [], string $form /** * @return mixed */ - public function mergeBase(int|string $project_id, array $refs) + public function mergeBase(int|string $project_id, array $refs): mixed { return $this->get($this->getProjectPath($project_id, 'repository/merge_base'), ['refs' => $refs]); } @@ -403,7 +403,7 @@ public function mergeBase(int|string $project_id, array $refs) /** * @return mixed */ - public function cherryPick(int|string $project_id, string $sha, array $params = []) + public function cherryPick(int|string $project_id, string $sha, array $params = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { diff --git a/src/Api/RepositoryFiles.php b/src/Api/RepositoryFiles.php index 16670ee7..cfc085b8 100644 --- a/src/Api/RepositoryFiles.php +++ b/src/Api/RepositoryFiles.php @@ -21,7 +21,7 @@ class RepositoryFiles extends AbstractApi /** * @return mixed */ - public function getFile(int|string $project_id, string $file_path, string $ref) + public function getFile(int|string $project_id, string $file_path, string $ref): mixed { return $this->get($this->getProjectPath($project_id, 'repository/files/'.self::encodePath($file_path)), [ 'ref' => $ref, @@ -31,7 +31,7 @@ public function getFile(int|string $project_id, string $file_path, string $ref) /** * @return mixed */ - public function getRawFile(int|string $project_id, string $file_path, string $ref) + public function getRawFile(int|string $project_id, string $file_path, string $ref): mixed { return $this->get($this->getProjectPath($project_id, 'repository/files/'.self::encodePath($file_path).'/raw'), [ 'ref' => $ref, @@ -53,7 +53,7 @@ public function getRawFile(int|string $project_id, string $file_path, string $re * * @return mixed */ - public function createFile(int|string $project_id, array $parameters = []) + public function createFile(int|string $project_id, array $parameters = []): mixed { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); @@ -88,7 +88,7 @@ public function createFile(int|string $project_id, array $parameters = []) * * @return mixed */ - public function updateFile(int|string $project_id, array $parameters = []) + public function updateFile(int|string $project_id, array $parameters = []): mixed { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); @@ -121,7 +121,7 @@ public function updateFile(int|string $project_id, array $parameters = []) * * @return mixed */ - public function deleteFile(int|string $project_id, array $parameters = []) + public function deleteFile(int|string $project_id, array $parameters = []): mixed { $resolver = new OptionsResolver(); $resolver->setRequired('file_path'); diff --git a/src/Api/ResourceIterationEvents.php b/src/Api/ResourceIterationEvents.php index 63faf760..66e8c289 100644 --- a/src/Api/ResourceIterationEvents.php +++ b/src/Api/ResourceIterationEvents.php @@ -19,7 +19,7 @@ class ResourceIterationEvents extends AbstractApi /** * @return mixed */ - public function all(int|string $project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_iteration_events'; @@ -29,7 +29,7 @@ public function all(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function show(int|string $project_id, int $issue_iid, int $resource_iteration_event_id) + public function show(int|string $project_id, int $issue_iid, int $resource_iteration_event_id): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_iteration_events/'; $path .= self::encodePath($resource_iteration_event_id); diff --git a/src/Api/ResourceLabelEvents.php b/src/Api/ResourceLabelEvents.php index a2e208da..72f1bcf9 100644 --- a/src/Api/ResourceLabelEvents.php +++ b/src/Api/ResourceLabelEvents.php @@ -19,7 +19,7 @@ class ResourceLabelEvents extends AbstractApi /** * @return mixed */ - public function all(int|string $project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_label_events'; @@ -29,7 +29,7 @@ public function all(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id) + public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_label_events/'; $path .= self::encodePath($resource_label_event_id); diff --git a/src/Api/ResourceMilestoneEvents.php b/src/Api/ResourceMilestoneEvents.php index d9bd03dd..bb39eabe 100644 --- a/src/Api/ResourceMilestoneEvents.php +++ b/src/Api/ResourceMilestoneEvents.php @@ -19,7 +19,7 @@ class ResourceMilestoneEvents extends AbstractApi /** * @return mixed */ - public function all(int|string $project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_milestone_events'; @@ -29,7 +29,7 @@ public function all(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function show(int|string $project_id, int $issue_iid, int $resource_milestone_event_id) + public function show(int|string $project_id, int $issue_iid, int $resource_milestone_event_id): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_milestone_events/'; $path .= self::encodePath($resource_milestone_event_id); diff --git a/src/Api/ResourceStateEvents.php b/src/Api/ResourceStateEvents.php index 15dc5b17..d9bd4179 100644 --- a/src/Api/ResourceStateEvents.php +++ b/src/Api/ResourceStateEvents.php @@ -19,7 +19,7 @@ class ResourceStateEvents extends AbstractApi /** * @return mixed */ - public function all(int|string $project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_state_events'; @@ -29,7 +29,7 @@ public function all(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id) + public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_state_events/'; $path .= self::encodePath($resource_label_event_id); diff --git a/src/Api/ResourceWeightEvents.php b/src/Api/ResourceWeightEvents.php index 077a2b8e..1f9ec767 100644 --- a/src/Api/ResourceWeightEvents.php +++ b/src/Api/ResourceWeightEvents.php @@ -19,7 +19,7 @@ class ResourceWeightEvents extends AbstractApi /** * @return mixed */ - public function all(int|string $project_id, int $issue_iid) + public function all(int|string $project_id, int $issue_iid): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_weight_events'; @@ -29,7 +29,7 @@ public function all(int|string $project_id, int $issue_iid) /** * @return mixed */ - public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id) + public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_weight_events/'; $path .= self::encodePath($resource_label_event_id); diff --git a/src/Api/Schedules.php b/src/Api/Schedules.php index 75121b2b..272a6af4 100644 --- a/src/Api/Schedules.php +++ b/src/Api/Schedules.php @@ -19,7 +19,7 @@ class Schedules extends AbstractApi /** * @return mixed */ - public function create(int|string $project_id, array $params) + public function create(int|string $project_id, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'pipeline_schedules'), $params); } @@ -27,7 +27,7 @@ public function create(int|string $project_id, array $params) /** * @return mixed */ - public function show(int|string $project_id, int $schedule_id) + public function show(int|string $project_id, int $schedule_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id))); } @@ -35,7 +35,7 @@ public function show(int|string $project_id, int $schedule_id) /** * @return mixed */ - public function showAll(int|string $project_id) + public function showAll(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipeline_schedules')); } @@ -43,7 +43,7 @@ public function showAll(int|string $project_id) /** * @return mixed */ - public function update(int|string $project_id, int $schedule_id, array $params) + public function update(int|string $project_id, int $schedule_id, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)), $params); } @@ -51,7 +51,7 @@ public function update(int|string $project_id, int $schedule_id, array $params) /** * @return mixed */ - public function remove(int|string $project_id, int $schedule_id) + public function remove(int|string $project_id, int $schedule_id): mixed { return $this->delete($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id))); } @@ -59,7 +59,7 @@ public function remove(int|string $project_id, int $schedule_id) /** * @return mixed */ - public function addVariable(int|string $project_id, int $schedule_id, array $params) + public function addVariable(int|string $project_id, int $schedule_id, array $params): mixed { $path = 'pipeline_schedules/'.self::encodePath($schedule_id).'/variables'; @@ -69,7 +69,7 @@ public function addVariable(int|string $project_id, int $schedule_id, array $par /** * @return mixed */ - public function updateVariable(int|string $project_id, int $schedule_id, string $variable_key, array $params) + public function updateVariable(int|string $project_id, int $schedule_id, string $variable_key, array $params): mixed { $path = 'pipeline_schedules/'.self::encodePath($schedule_id).'/variables/'.self::encodePath($variable_key); @@ -79,7 +79,7 @@ public function updateVariable(int|string $project_id, int $schedule_id, string /** * @return mixed */ - public function removeVariable(int|string $project_id, int $schedule_id, string $variable_key) + public function removeVariable(int|string $project_id, int $schedule_id, string $variable_key): mixed { $path = 'pipeline_schedules/'.self::encodePath($schedule_id).'/variables/'.self::encodePath($variable_key); @@ -89,7 +89,7 @@ public function removeVariable(int|string $project_id, int $schedule_id, string /** * @return mixed */ - public function takeOwnership(int|string $project_id, int $schedule_id) + public function takeOwnership(int|string $project_id, int $schedule_id): mixed { return $this->post($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)).'/take_ownership'); } @@ -97,7 +97,7 @@ public function takeOwnership(int|string $project_id, int $schedule_id) /** * @return mixed */ - public function play(int|string $project_id, int $schedule_id) + public function play(int|string $project_id, int $schedule_id): mixed { return $this->post($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)).'/play'); } diff --git a/src/Api/Search.php b/src/Api/Search.php index 61d53fae..4d926db5 100644 --- a/src/Api/Search.php +++ b/src/Api/Search.php @@ -36,7 +36,7 @@ class Search extends AbstractApi * * @return mixed */ - public function all(array $parameters = []) + public function all(array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { diff --git a/src/Api/Snippets.php b/src/Api/Snippets.php index 0f49b858..cfb39049 100644 --- a/src/Api/Snippets.php +++ b/src/Api/Snippets.php @@ -19,7 +19,7 @@ class Snippets extends AbstractApi /** * @return mixed */ - public function all(int|string $project_id) + public function all(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets')); } @@ -27,7 +27,7 @@ public function all(int|string $project_id) /** * @return mixed */ - public function show(int|string $project_id, int $snippet_id) + public function show(int|string $project_id, int $snippet_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id))); } @@ -35,7 +35,7 @@ public function show(int|string $project_id, int $snippet_id) /** * @return mixed */ - public function create(int|string $project_id, string $title, string $filename, string $code, string $visibility) + public function create(int|string $project_id, string $title, string $filename, string $code, string $visibility): mixed { return $this->post($this->getProjectPath($project_id, 'snippets'), [ 'title' => $title, @@ -48,7 +48,7 @@ public function create(int|string $project_id, string $title, string $filename, /** * @return mixed */ - public function update(int|string $project_id, int $snippet_id, array $params) + public function update(int|string $project_id, int $snippet_id, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id)), $params); } @@ -56,7 +56,7 @@ public function update(int|string $project_id, int $snippet_id, array $params) /** * @return mixed */ - public function content(int|string $project_id, int $snippet_id) + public function content(int|string $project_id, int $snippet_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/raw')); } @@ -64,7 +64,7 @@ public function content(int|string $project_id, int $snippet_id) /** * @return mixed */ - public function remove(int|string $project_id, int $snippet_id) + public function remove(int|string $project_id, int $snippet_id): mixed { return $this->delete($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id))); } @@ -72,7 +72,7 @@ public function remove(int|string $project_id, int $snippet_id) /** * @return mixed */ - public function showNotes(int|string $project_id, int $snippet_id) + public function showNotes(int|string $project_id, int $snippet_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes')); } @@ -80,7 +80,7 @@ public function showNotes(int|string $project_id, int $snippet_id) /** * @return mixed */ - public function showNote(int|string $project_id, int $snippet_id, int $note_id) + public function showNote(int|string $project_id, int $snippet_id, int $note_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes/'.self::encodePath($note_id))); } @@ -88,7 +88,7 @@ public function showNote(int|string $project_id, int $snippet_id, int $note_id) /** * @return mixed */ - public function addNote(int|string $project_id, int $snippet_id, string $body, array $params = []) + public function addNote(int|string $project_id, int $snippet_id, string $body, array $params = []): mixed { $params['body'] = $body; @@ -98,7 +98,7 @@ public function addNote(int|string $project_id, int $snippet_id, string $body, a /** * @return mixed */ - public function updateNote(int|string $project_id, int $snippet_id, int $note_id, string $body) + public function updateNote(int|string $project_id, int $snippet_id, int $note_id, string $body): mixed { return $this->put($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes/'.self::encodePath($note_id)), [ 'body' => $body, @@ -108,7 +108,7 @@ public function updateNote(int|string $project_id, int $snippet_id, int $note_id /** * @return mixed */ - public function removeNote(int|string $project_id, int $snippet_id, int $note_id) + public function removeNote(int|string $project_id, int $snippet_id, int $note_id): mixed { return $this->delete($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes/'.self::encodePath($note_id))); } @@ -116,7 +116,7 @@ public function removeNote(int|string $project_id, int $snippet_id, int $note_id /** * @return mixed */ - public function awardEmoji(int|string $project_id, int $snippet_id) + public function awardEmoji(int|string $project_id, int $snippet_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/award_emoji')); } @@ -124,7 +124,7 @@ public function awardEmoji(int|string $project_id, int $snippet_id) /** * @return mixed */ - public function removeAwardEmoji(int|string $project_id, int $snippet_id, int $award_id) + public function removeAwardEmoji(int|string $project_id, int $snippet_id, int $award_id): mixed { return $this->delete($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/award_emoji/'.self::encodePath($award_id))); } diff --git a/src/Api/SystemHooks.php b/src/Api/SystemHooks.php index 289f2a24..b9b9ce29 100644 --- a/src/Api/SystemHooks.php +++ b/src/Api/SystemHooks.php @@ -22,7 +22,7 @@ class SystemHooks extends AbstractApi /** * @return mixed */ - public function all() + public function all(): mixed { return $this->get('hooks'); } @@ -40,7 +40,7 @@ public function all() * * @return mixed */ - public function create(string $url, array $parameters = []) + public function create(string $url, array $parameters = []): mixed { $parameters = $this->createOptionsResolver()->resolve($parameters); @@ -52,7 +52,7 @@ public function create(string $url, array $parameters = []) /** * @return mixed */ - public function test(int $id) + public function test(int $id): mixed { return $this->get('hooks/'.self::encodePath($id)); } @@ -60,7 +60,7 @@ public function test(int $id) /** * @return mixed */ - public function remove(int $id) + public function remove(int $id): mixed { return $this->delete('hooks/'.self::encodePath($id)); } diff --git a/src/Api/Tags.php b/src/Api/Tags.php index 4f4244ff..ba20f7b7 100644 --- a/src/Api/Tags.php +++ b/src/Api/Tags.php @@ -27,7 +27,7 @@ class Tags extends AbstractApi * * @return mixed */ - public function all(int|string $project_id, array $parameters = []) + public function all(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('order_by') @@ -42,7 +42,7 @@ public function all(int|string $project_id, array $parameters = []) /** * @return mixed */ - public function show(int|string $project_id, string $tag_name) + public function show(int|string $project_id, string $tag_name): mixed { return $this->get($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name))); } @@ -50,7 +50,7 @@ public function show(int|string $project_id, string $tag_name) /** * @return mixed */ - public function create(int|string $project_id, array $params = []) + public function create(int|string $project_id, array $params = []): mixed { return $this->post($this->getProjectPath($project_id, 'repository/tags'), $params); } @@ -58,7 +58,7 @@ public function create(int|string $project_id, array $params = []) /** * @return mixed */ - public function remove(int|string $project_id, string $tag_name) + public function remove(int|string $project_id, string $tag_name): mixed { return $this->delete($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name))); } @@ -66,7 +66,7 @@ public function remove(int|string $project_id, string $tag_name) /** * @return mixed */ - public function createRelease(int|string $project_id, string $tag_name, array $params = []) + public function createRelease(int|string $project_id, string $tag_name, array $params = []): mixed { return $this->post($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name).'/release'), $params); } @@ -74,7 +74,7 @@ public function createRelease(int|string $project_id, string $tag_name, array $p /** * @return mixed */ - public function updateRelease(int|string $project_id, string $tag_name, array $params = []) + public function updateRelease(int|string $project_id, string $tag_name, array $params = []): mixed { return $this->put($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name).'/release'), $params); } diff --git a/src/Api/Users.php b/src/Api/Users.php index e0c5e723..8d990cca 100644 --- a/src/Api/Users.php +++ b/src/Api/Users.php @@ -34,7 +34,7 @@ class Users extends AbstractApi * * @return mixed */ - public function all(array $parameters = []) + public function all(array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -71,7 +71,7 @@ public function all(array $parameters = []) /** * @return mixed */ - public function show(int $id) + public function show(int $id): mixed { return $this->get('users/'.self::encodePath($id)); } @@ -84,7 +84,7 @@ public function show(int $id) * * @return mixed */ - public function usersMemberships(int $id, array $parameters = []) + public function usersMemberships(int $id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('type') @@ -115,7 +115,7 @@ public function usersMemberships(int $id, array $parameters = []) * * @return mixed */ - public function usersProjects(int $id, array $parameters = []) + public function usersProjects(int $id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -192,7 +192,7 @@ public function usersProjects(int $id, array $parameters = []) * * @return mixed */ - public function usersStarredProjects(int $id, array $parameters = []) + public function usersStarredProjects(int $id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $booleanNormalizer = function (Options $resolver, $value): string { @@ -254,7 +254,7 @@ public function usersStarredProjects(int $id, array $parameters = []) /** * @return mixed */ - public function user() + public function user(): mixed { return $this->get('user'); } @@ -262,7 +262,7 @@ public function user() /** * @return mixed */ - public function create(string $email, string $password, array $params = []) + public function create(string $email, string $password, array $params = []): mixed { $params['email'] = $email; $params['password'] = $password; @@ -273,7 +273,7 @@ public function create(string $email, string $password, array $params = []) /** * @return mixed */ - public function update(int $id, array $params, array $files = []) + public function update(int $id, array $params, array $files = []): mixed { return $this->put('users/'.self::encodePath($id), $params, [], $files); } @@ -287,7 +287,7 @@ public function update(int $id, array $params, array $files = []) * * @return mixed */ - public function remove(int $id, array $params = []) + public function remove(int $id, array $params = []): mixed { return $this->delete('users/'.self::encodePath($id), $params); } @@ -295,7 +295,7 @@ public function remove(int $id, array $params = []) /** * @return mixed */ - public function block(int $id) + public function block(int $id): mixed { return $this->post('users/'.self::encodePath($id).'/block'); } @@ -303,7 +303,7 @@ public function block(int $id) /** * @return mixed */ - public function unblock(int $id) + public function unblock(int $id): mixed { return $this->post('users/'.self::encodePath($id).'/unblock'); } @@ -311,7 +311,7 @@ public function unblock(int $id) /** * @return mixed */ - public function activate(int $id) + public function activate(int $id): mixed { return $this->post('users/'.self::encodePath($id).'/activate'); } @@ -319,7 +319,7 @@ public function activate(int $id) /** * @return mixed */ - public function deactivate(int $id) + public function deactivate(int $id): mixed { return $this->post('users/'.self::encodePath($id).'/deactivate'); } @@ -327,7 +327,7 @@ public function deactivate(int $id) /** * @return mixed */ - public function me() + public function me(): mixed { return $this->get('user'); } @@ -335,7 +335,7 @@ public function me() /** * @return mixed */ - public function keys() + public function keys(): mixed { return $this->get('user/keys'); } @@ -343,7 +343,7 @@ public function keys() /** * @return mixed */ - public function key(int $id) + public function key(int $id): mixed { return $this->get('user/keys/'.self::encodePath($id)); } @@ -351,7 +351,7 @@ public function key(int $id) /** * @return mixed */ - public function createKey(string $title, string $key) + public function createKey(string $title, string $key): mixed { return $this->post('user/keys', [ 'title' => $title, @@ -362,7 +362,7 @@ public function createKey(string $title, string $key) /** * @return mixed */ - public function removeKey(int $id) + public function removeKey(int $id): mixed { return $this->delete('user/keys/'.self::encodePath($id)); } @@ -370,7 +370,7 @@ public function removeKey(int $id) /** * @return mixed */ - public function userKeys(int $user_id) + public function userKeys(int $user_id): mixed { return $this->get('users/'.self::encodePath($user_id).'/keys'); } @@ -378,7 +378,7 @@ public function userKeys(int $user_id) /** * @return mixed */ - public function userKey(int $user_id, int $key_id) + public function userKey(int $user_id, int $key_id): mixed { return $this->get('users/'.self::encodePath($user_id).'/keys/'.self::encodePath($key_id)); } @@ -386,7 +386,7 @@ public function userKey(int $user_id, int $key_id) /** * @return mixed */ - public function createKeyForUser(int $user_id, string $title, string $key) + public function createKeyForUser(int $user_id, string $title, string $key): mixed { return $this->post('users/'.self::encodePath($user_id).'/keys', [ 'title' => $title, @@ -397,7 +397,7 @@ public function createKeyForUser(int $user_id, string $title, string $key) /** * @return mixed */ - public function removeUserKey(int $user_id, int $key_id) + public function removeUserKey(int $user_id, int $key_id): mixed { return $this->delete('users/'.self::encodePath($user_id).'/keys/'.self::encodePath($key_id)); } @@ -405,7 +405,7 @@ public function removeUserKey(int $user_id, int $key_id) /** * @return mixed */ - public function emails() + public function emails(): mixed { return $this->get('user/emails'); } @@ -413,7 +413,7 @@ public function emails() /** * @return mixed */ - public function email(int $id) + public function email(int $id): mixed { return $this->get('user/emails/'.self::encodePath($id)); } @@ -421,7 +421,7 @@ public function email(int $id) /** * @return mixed */ - public function userEmails(int $user_id) + public function userEmails(int $user_id): mixed { return $this->get('users/'.self::encodePath($user_id).'/emails'); } @@ -429,7 +429,7 @@ public function userEmails(int $user_id) /** * @return mixed */ - public function createEmailForUser(int $user_id, string $email, bool $skip_confirmation = false) + public function createEmailForUser(int $user_id, string $email, bool $skip_confirmation = false): mixed { return $this->post('users/'.self::encodePath($user_id).'/emails', [ 'email' => $email, @@ -440,7 +440,7 @@ public function createEmailForUser(int $user_id, string $email, bool $skip_confi /** * @return mixed */ - public function removeUserEmail(int $user_id, int $email_id) + public function removeUserEmail(int $user_id, int $email_id): mixed { return $this->delete('users/'.self::encodePath($user_id).'/emails/'.self::encodePath($email_id)); } @@ -448,7 +448,7 @@ public function removeUserEmail(int $user_id, int $email_id) /** * @return mixed */ - public function userImpersonationTokens(int $user_id, array $params = []) + public function userImpersonationTokens(int $user_id, array $params = []): mixed { $resolver = $this->createOptionsResolver(); @@ -462,7 +462,7 @@ public function userImpersonationTokens(int $user_id, array $params = []) /** * @return mixed */ - public function userImpersonationToken(int $user_id, int $impersonation_token_id) + public function userImpersonationToken(int $user_id, int $impersonation_token_id): mixed { return $this->get('users/'.self::encodePath($user_id).'/impersonation_tokens/'.self::encodePath($impersonation_token_id)); } @@ -470,7 +470,7 @@ public function userImpersonationToken(int $user_id, int $impersonation_token_id /** * @return mixed */ - public function createImpersonationToken(int $user_id, string $name, array $scopes, ?string $expires_at = null) + public function createImpersonationToken(int $user_id, string $name, array $scopes, ?string $expires_at = null): mixed { return $this->post('users/'.self::encodePath($user_id).'/impersonation_tokens', [ 'name' => $name, @@ -482,7 +482,7 @@ public function createImpersonationToken(int $user_id, string $name, array $scop /** * @return mixed */ - public function removeImpersonationToken(int $user_id, int $impersonation_token_id) + public function removeImpersonationToken(int $user_id, int $impersonation_token_id): mixed { return $this->delete('users/'.self::encodePath($user_id).'/impersonation_tokens/'.self::encodePath($impersonation_token_id)); } @@ -499,7 +499,7 @@ public function removeImpersonationToken(int $user_id, int $impersonation_token_ * * @return mixed */ - public function events(int $user_id, array $parameters = []) + public function events(int $user_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { @@ -531,7 +531,7 @@ public function events(int $user_id, array $parameters = []) * * @return mixed */ - public function removeUserIdentity(int $user_id, string $provider) + public function removeUserIdentity(int $user_id, string $provider): mixed { return $this->delete('users/'.self::encodePath($user_id).'/identities/'.self::encodePath($provider)); } diff --git a/src/Api/Version.php b/src/Api/Version.php index 9c6477e9..7c4ac3bb 100644 --- a/src/Api/Version.php +++ b/src/Api/Version.php @@ -19,7 +19,7 @@ class Version extends AbstractApi /** * @return mixed */ - public function show() + public function show(): mixed { return $this->get('version'); } diff --git a/src/Api/Wiki.php b/src/Api/Wiki.php index 856fed4d..8b0840cd 100644 --- a/src/Api/Wiki.php +++ b/src/Api/Wiki.php @@ -21,7 +21,7 @@ class Wiki extends AbstractApi * * @return mixed */ - public function create(int|string $project_id, array $params) + public function create(int|string $project_id, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'wikis'), $params); } @@ -29,7 +29,7 @@ public function create(int|string $project_id, array $params) /** * @return mixed */ - public function show(int|string $project_id, string $wiki_slug) + public function show(int|string $project_id, string $wiki_slug): mixed { return $this->get($this->getProjectPath($project_id, 'wikis/'.self::encodePath($wiki_slug))); } @@ -42,7 +42,7 @@ public function show(int|string $project_id, string $wiki_slug) * * @return mixed */ - public function showAll(int|string $project_id, array $params) + public function showAll(int|string $project_id, array $params): mixed { $resolver = $this->createOptionsResolver(); $resolver->setDefined('with_content') @@ -56,7 +56,7 @@ public function showAll(int|string $project_id, array $params) * * @return mixed */ - public function update(int|string $project_id, string $wiki_slug, array $params) + public function update(int|string $project_id, string $wiki_slug, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'wikis/'.self::encodePath($wiki_slug)), $params); } @@ -64,7 +64,7 @@ public function update(int|string $project_id, string $wiki_slug, array $params) /** * @return mixed */ - public function remove(int|string $project_id, string $wiki_slug) + public function remove(int|string $project_id, string $wiki_slug): mixed { return $this->delete($this->getProjectPath($project_id, 'wikis/'.self::encodePath($wiki_slug))); } diff --git a/src/HttpClient/Message/ResponseMediator.php b/src/HttpClient/Message/ResponseMediator.php index 466111bd..6fa01362 100644 --- a/src/HttpClient/Message/ResponseMediator.php +++ b/src/HttpClient/Message/ResponseMediator.php @@ -56,7 +56,7 @@ final class ResponseMediator * * @return array|string */ - public static function getContent(ResponseInterface $response) + public static function getContent(ResponseInterface $response): array|string { $body = (string) $response->getBody(); diff --git a/src/HttpClient/Plugin/History.php b/src/HttpClient/Plugin/History.php index 49fd6eaf..3f96b724 100644 --- a/src/HttpClient/Plugin/History.php +++ b/src/HttpClient/Plugin/History.php @@ -31,7 +31,7 @@ final class History implements Journal /** * @var ResponseInterface|null */ - private $lastResponse; + private ?ResponseInterface $lastResponse; public function getLastResponse(): ?ResponseInterface { diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 9eafc60b..33850f24 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -445,7 +445,7 @@ public function shouldGetProjectIssuesParameters(): void * @return array * Project issues list */ - public function getProjectIssuesExpectedArray() + public function getProjectIssuesExpectedArray(): array { return [ [ @@ -518,7 +518,7 @@ public function getProjectIssuesExpectedArray() * * @return array */ - public function getProjectUsersExpectedArray() + public function getProjectUsersExpectedArray(): array { return [ [ @@ -552,7 +552,7 @@ public function shouldGetBoards(): void * @return array * Project issues list */ - public function getProjectBoardsExpectedArray() + public function getProjectBoardsExpectedArray(): array { return [ [ diff --git a/tests/Api/RepositoryFilesTest.php b/tests/Api/RepositoryFilesTest.php index bf90ec42..a57eafb6 100644 --- a/tests/Api/RepositoryFilesTest.php +++ b/tests/Api/RepositoryFilesTest.php @@ -263,7 +263,7 @@ public function shouldDeleteFileWithAuthor(): void /** * @return string */ - protected function getApiClass() + protected function getApiClass(): string { return RepositoryFiles::class; } diff --git a/tests/Api/TestCase.php b/tests/Api/TestCase.php index ca5240ac..06da98ce 100644 --- a/tests/Api/TestCase.php +++ b/tests/Api/TestCase.php @@ -23,12 +23,12 @@ abstract class TestCase extends BaseTestCase /** * @return string */ - abstract protected function getApiClass(); + abstract protected function getApiClass(): string; /** * @return \PHPUnit\Framework\MockObject\MockObject */ - protected function getApiMock(array $methods = []) + protected function getApiMock(array $methods = []): \PHPUnit\Framework\MockObject\MockObject { $httpClient = $this->getMockBuilder(ClientInterface::class) ->onlyMethods(['sendRequest']) diff --git a/tests/HttpClient/BuilderTest.php b/tests/HttpClient/BuilderTest.php index b27306e1..01c5b304 100644 --- a/tests/HttpClient/BuilderTest.php +++ b/tests/HttpClient/BuilderTest.php @@ -31,7 +31,7 @@ class BuilderTest extends TestCase /** * @var Builder */ - private $subject; + private Builder $subject; #[Before] public function initBuilder(): void From 85dac94f135adf112588fe2517c1b0bc4477dbbd Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 23 Feb 2025 18:19:57 +0000 Subject: [PATCH 110/117] Apply fixes from StyleCI --- src/Api/AbstractApi.php | 12 - src/Api/DeployKeys.php | 3 - src/Api/Deployments.php | 5 - src/Api/Environments.php | 14 - src/Api/Events.php | 2 - src/Api/Groups.php | 92 ------- src/Api/GroupsBoards.php | 30 --- src/Api/GroupsEpics.php | 17 -- src/Api/GroupsMilestones.php | 20 -- src/Api/IssueBoards.php | 30 --- src/Api/IssueLinks.php | 7 - src/Api/Issues.php | 96 ------- src/Api/IssuesStatistics.php | 9 - src/Api/Jobs.php | 39 --- src/Api/Keys.php | 3 - src/Api/MergeRequests.php | 91 ------- src/Api/Milestones.php | 20 -- src/Api/Packages.php | 17 -- src/Api/ProjectNamespaces.php | 5 - src/Api/Projects.php | 275 -------------------- src/Api/Repositories.php | 77 ------ src/Api/RepositoryFiles.php | 12 - src/Api/ResourceIterationEvents.php | 6 - src/Api/ResourceLabelEvents.php | 6 - src/Api/ResourceMilestoneEvents.php | 6 - src/Api/ResourceStateEvents.php | 6 - src/Api/ResourceWeightEvents.php | 6 - src/Api/Schedules.php | 30 --- src/Api/Search.php | 2 - src/Api/Snippets.php | 39 --- src/Api/SystemHooks.php | 11 - src/Api/Tags.php | 17 -- src/Api/Users.php | 92 ------- src/Api/Version.php | 3 - src/Api/Wiki.php | 12 - src/HttpClient/Message/ResponseMediator.php | 2 - src/HttpClient/Plugin/History.php | 3 - tests/Api/ProjectsTest.php | 2 - tests/Api/RepositoryFilesTest.php | 3 - tests/Api/TestCase.php | 6 - tests/HttpClient/BuilderTest.php | 3 - 41 files changed, 1131 deletions(-) diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php index 8bacebba..b0219ac4 100644 --- a/src/Api/AbstractApi.php +++ b/src/Api/AbstractApi.php @@ -77,8 +77,6 @@ protected function getAsResponse(string $uri, array $params = [], array $headers /** * @param array $params * @param array $headers - * - * @return mixed */ protected function get(string $uri, array $params = [], array $headers = []): mixed { @@ -92,8 +90,6 @@ protected function get(string $uri, array $params = [], array $headers = []): mi * @param array $headers * @param array $files * @param array $uriParams - * - * @return mixed */ protected function post(string $uri, array $params = [], array $headers = [], array $files = [], array $uriParams = []): mixed { @@ -118,8 +114,6 @@ protected function post(string $uri, array $params = [], array $headers = [], ar * @param array $params * @param array $headers * @param array $files - * - * @return mixed */ protected function put(string $uri, array $params = [], array $headers = [], array $files = []): mixed { @@ -144,8 +138,6 @@ protected function put(string $uri, array $params = [], array $headers = [], arr * @param array $params * @param array $headers * @param array $files - * - * @return mixed */ protected function patch(string $uri, array $params = [], array $headers = [], array $files = []): mixed { @@ -169,8 +161,6 @@ protected function patch(string $uri, array $params = [], array $headers = [], a /** * @param array $headers * @param array $uriParams - * - * @return mixed */ protected function putFile(string $uri, string $file, array $headers = [], array $uriParams = []): mixed { @@ -189,8 +179,6 @@ protected function putFile(string $uri, string $file, array $headers = [], array /** * @param array $params * @param array $headers - * - * @return mixed */ protected function delete(string $uri, array $params = [], array $headers = []): mixed { diff --git a/src/Api/DeployKeys.php b/src/Api/DeployKeys.php index da181e29..9259d25c 100644 --- a/src/Api/DeployKeys.php +++ b/src/Api/DeployKeys.php @@ -16,9 +16,6 @@ class DeployKeys extends AbstractApi { - /** - * @return mixed - */ public function all(array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); diff --git a/src/Api/Deployments.php b/src/Api/Deployments.php index a3a50538..3770bf9d 100644 --- a/src/Api/Deployments.php +++ b/src/Api/Deployments.php @@ -27,8 +27,6 @@ class Deployments extends AbstractApi * 'canceled', 'blocked' * @var string $environment Return deployments filtered to a particular environment * } - * - * @return mixed */ public function all(int|string $project_id, array $parameters = []): mixed { @@ -48,9 +46,6 @@ public function all(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'deployments'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int|string $project_id, int $deployment_id): mixed { return $this->get($this->getProjectPath($project_id, 'deployments/'.$deployment_id)); diff --git a/src/Api/Environments.php b/src/Api/Environments.php index 94ec4d19..b83693a9 100644 --- a/src/Api/Environments.php +++ b/src/Api/Environments.php @@ -18,9 +18,6 @@ class Environments extends AbstractApi { - /** - * @return mixed - */ public function all(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -42,8 +39,6 @@ public function all(int|string $project_id, array $parameters = []): mixed * @var string $external_url Place to link to for this environment * @var string $tier The tier of the new environment. Allowed values are production, staging, testing, development, and other. * } - * - * @return mixed */ public function create(int|string $project_id, array $parameters = []): mixed { @@ -59,25 +54,16 @@ public function create(int|string $project_id, array $parameters = []): mixed return $this->post($this->getProjectPath($project_id, 'environments'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function remove(int|string $project_id, int $environment_id): mixed { return $this->delete($this->getProjectPath($project_id, 'environments/'.$environment_id)); } - /** - * @return mixed - */ public function stop(int|string $project_id, int $environment_id): mixed { return $this->post($this->getProjectPath($project_id, 'environments/'.self::encodePath($environment_id).'/stop')); } - /** - * @return mixed - */ public function show(int|string $project_id, int $environment_id): mixed { return $this->get($this->getProjectPath($project_id, 'environments/'.self::encodePath($environment_id))); diff --git a/src/Api/Events.php b/src/Api/Events.php index 92f44adb..74f3d1cd 100644 --- a/src/Api/Events.php +++ b/src/Api/Events.php @@ -28,8 +28,6 @@ class Events extends AbstractApi * @var string $sort sort events in asc or desc order by created_at * * } - * - * @return mixed */ public function all(array $parameters = []): mixed { diff --git a/src/Api/Groups.php b/src/Api/Groups.php index feb5d6e7..7104d345 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -59,8 +59,6 @@ class Groups extends AbstractApi * @var int $min_access_level limit by groups in which the current user has at least this access level * @var bool $top_level_only limit to top level groups, excluding all subgroups * } - * - * @return mixed */ public function all(array $parameters = []): mixed { @@ -69,17 +67,11 @@ public function all(array $parameters = []): mixed return $this->get('groups', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int|string $id): mixed { return $this->get('groups/'.self::encodePath($id)); } - /** - * @return mixed - */ public function create(string $name, string $path, ?string $description = null, string $visibility = 'private', ?bool $lfs_enabled = null, ?bool $request_access_enabled = null, ?int $parent_id = null, ?int $shared_runners_minutes_limit = null): mixed { $params = [ @@ -98,33 +90,21 @@ public function create(string $name, string $path, ?string $description = null, })); } - /** - * @return mixed - */ public function update(int|string $id, array $params): mixed { return $this->put('groups/'.self::encodePath($id), $params); } - /** - * @return mixed - */ public function remove(int|string $group_id): mixed { return $this->delete('groups/'.self::encodePath($group_id)); } - /** - * @return mixed - */ public function transfer(int|string $group_id, int|string $project_id): mixed { return $this->post('groups/'.self::encodePath($group_id).'/projects/'.self::encodePath($project_id)); } - /** - * @return mixed - */ public function allMembers(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -144,8 +124,6 @@ public function allMembers(int|string $group_id, array $parameters = []): mixed * * @var string $query A query string to search for members. * } - * - * @return mixed */ public function members(int|string $group_id, array $parameters = []): mixed { @@ -161,25 +139,16 @@ public function members(int|string $group_id, array $parameters = []): mixed return $this->get('groups/'.self::encodePath($group_id).'/members', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function member(int|string $group_id, int $user_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/members/'.self::encodePath($user_id)); } - /** - * @return mixed - */ public function allMember(int|string $group_id, int $user_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/members/all/'.self::encodePath($user_id)); } - /** - * @return mixed - */ public function addMember(int|string $group_id, int $user_id, int $access_level, array $parameters = []): mixed { $dateNormalizer = function (OptionsResolver $optionsResolver, \DateTimeInterface $date): string { @@ -200,9 +169,6 @@ public function addMember(int|string $group_id, int $user_id, int $access_level, return $this->post('groups/'.self::encodePath($group_id).'/members', $parameters); } - /** - * @return mixed - */ public function saveMember(int|string $group_id, int $user_id, int $access_level): mixed { return $this->put('groups/'.self::encodePath($group_id).'/members/'.self::encodePath($user_id), [ @@ -216,8 +182,6 @@ public function saveMember(int|string $group_id, int $user_id, int $access_level * @var int $group_access the access level to grant the group * @var string $expires_at share expiration date in ISO 8601 format: 2016-09-26 * } - * - * @return mixed */ public function addShare(int|string $group_id, array $parameters = []): mixed { @@ -242,9 +206,6 @@ public function addShare(int|string $group_id, array $parameters = []): mixed return $this->post('groups/'.self::encodePath($group_id).'/share', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function removeMember(int|string $group_id, int $user_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/members/'.self::encodePath($user_id)); @@ -268,8 +229,6 @@ public function removeMember(int|string $group_id, int $user_id): mixed * @var bool $include_subgroups Include projects in subgroups of this group (default is false) * @var bool $with_custom_attributes Include custom attributes in response (admins only). * } - * - * @return mixed */ public function projects(int|string $id, array $parameters = []): mixed { @@ -339,8 +298,6 @@ public function projects(int|string $id, array $parameters = []): mixed * @var bool $statistics include group statistics (admins only) * @var bool $owned Limit by groups owned by the current user. * } - * - * @return mixed */ public function subgroups(int|string $group_id, array $parameters = []): mixed { @@ -379,8 +336,6 @@ public function subgroups(int|string $group_id, array $parameters = []): mixed * @var int $weight Return issues with the specified weight. None returns issues with no weight assigned. Any returns issues with a weight assigned. * @var bool $with_labels_details If true, the response returns more details for each label in labels field: :name, :color, :description, :description_html, :text_color. Default is false. * } - * - * @return mixed */ public function issues(int|string $group_id, array $parameters = []): mixed { @@ -470,8 +425,6 @@ public function issues(int|string $group_id, array $parameters = []): mixed * @var bool $only_group_labels Toggle to include only group labels or also project labels. Defaults to true. * @var string $search Keyword to filter labels by. * } - * - * @return mixed */ public function labels(int|string $group_id, array $parameters = []): mixed { @@ -495,33 +448,21 @@ public function labels(int|string $group_id, array $parameters = []): mixed return $this->get('groups/'.self::encodePath($group_id).'/labels', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function addLabel(int|string $group_id, array $params): mixed { return $this->post('groups/'.self::encodePath($group_id).'/labels', $params); } - /** - * @return mixed - */ public function updateLabel(int|string $group_id, int $label_id, array $params): mixed { return $this->put('groups/'.self::encodePath($group_id).'/labels/'.self::encodePath($label_id), $params); } - /** - * @return mixed - */ public function removeLabel(int|string $group_id, int $label_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/labels/'.self::encodePath($label_id)); } - /** - * @return mixed - */ public function variables(int|string $group_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -529,9 +470,6 @@ public function variables(int|string $group_id, array $parameters = []): mixed return $this->get('groups/'.self::encodePath($group_id).'/variables', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function variable(int|string $group_id, string $key): mixed { return $this->get('groups/'.self::encodePath($group_id).'/variables/'.self::encodePath($key)); @@ -543,8 +481,6 @@ public function variable(int|string $group_id, string $key): mixed * @var string $masked true or false * @var string $variable_type env_var (default) or file * } - * - * @return mixed */ public function addVariable(int|string $group_id, string $key, string $value, ?bool $protected = null, array $parameters = []): mixed { @@ -568,9 +504,6 @@ public function addVariable(int|string $group_id, string $key, string $value, ?b return $this->post('groups/'.self::encodePath($group_id).'/variables', $payload); } - /** - * @return mixed - */ public function updateVariable(int|string $group_id, string $key, string $value, ?bool $protected = null): mixed { $payload = [ @@ -584,9 +517,6 @@ public function updateVariable(int|string $group_id, string $key, string $value, return $this->put('groups/'.self::encodePath($group_id).'/variables/'.self::encodePath($key), $payload); } - /** - * @return mixed - */ public function removeVariable(int|string $group_id, string $key): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/variables/'.self::encodePath($key)); @@ -608,8 +538,6 @@ public function removeVariable(int|string $group_id, string $key): mixed * @var \DateTimeInterface $created_after return merge requests created after the given time (inclusive) * @var \DateTimeInterface $created_before return merge requests created before the given time (inclusive) * } - * - * @return mixed */ public function mergeRequests(int|string $group_id, array $parameters = []): mixed { @@ -701,8 +629,6 @@ public function mergeRequests(int|string $group_id, array $parameters = []): mix * @var string $search return only iterations with a title matching the provided string * @var bool $include_ancestors Include iterations from parent group and its ancestors. Defaults to true. * } - * - * @return mixed */ public function iterations(int|string $group_id, array $parameters = []): mixed { @@ -739,8 +665,6 @@ public function iterations(int|string $group_id, array $parameters = []): mixed * @var string $status filter the returned packages by status. one of default (default), * hidden, or processing. * } - * - * @return mixed */ public function packages(int|string $group_id, array $parameters = []): mixed { @@ -774,9 +698,6 @@ public function packages(int|string $group_id, array $parameters = []): mixed return $this->get('groups/'.self::encodePath($group_id).'/packages', $resolver->resolve($parameters)); } - /** - * @return OptionsResolver - */ private function getGroupSearchResolver(): OptionsResolver { $resolver = $this->getSubgroupSearchResolver(); @@ -792,9 +713,6 @@ private function getGroupSearchResolver(): OptionsResolver return $resolver; } - /** - * @return OptionsResolver - */ private function getSubgroupSearchResolver(): OptionsResolver { $resolver = $this->createOptionsResolver(); @@ -834,9 +752,6 @@ private function getSubgroupSearchResolver(): OptionsResolver return $resolver; } - /** - * @return mixed - */ public function deployTokens(int|string $group_id, ?bool $active = null): mixed { return $this->get('groups/'.self::encodePath($group_id).'/deploy_tokens', (null !== $active) ? ['active' => $active] : []); @@ -850,8 +765,6 @@ public function deployTokens(int|string $group_id, ?bool $active = null): mixed * @var string $username the username for the deploy token * @var array $scopes the scopes, one or many of: read_repository, read_registry, write_registry, read_package_registry, write_package_registry * } - * - * @return mixed */ public function createDeployToken(int|string $group_id, array $parameters = []): mixed { @@ -890,9 +803,6 @@ public function createDeployToken(int|string $group_id, array $parameters = []): return $this->post('groups/'.self::encodePath($group_id).'/deploy_tokens', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function deleteDeployToken(int|string $group_id, int $token_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/deploy_tokens/'.self::encodePath($token_id)); @@ -911,8 +821,6 @@ public function deleteDeployToken(int|string $group_id, int $token_id): mixed * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the specified validation rules - * - * @return mixed */ public function search(int|string $id, array $parameters = []): mixed { diff --git a/src/Api/GroupsBoards.php b/src/Api/GroupsBoards.php index 65696d31..a3fa6742 100644 --- a/src/Api/GroupsBoards.php +++ b/src/Api/GroupsBoards.php @@ -16,9 +16,6 @@ class GroupsBoards extends AbstractApi { - /** - * @return mixed - */ public function all(int|string|null $group_id = null, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -28,57 +25,36 @@ public function all(int|string|null $group_id = null, array $parameters = []): m return $this->get($path, $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int|string $group_id, int $board_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id)); } - /** - * @return mixed - */ public function create(int|string $group_id, array $params): mixed { return $this->post('groups/'.self::encodePath($group_id).'/boards', $params); } - /** - * @return mixed - */ public function update(int|string $group_id, int $board_id, array $params): mixed { return $this->put('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id), $params); } - /** - * @return mixed - */ public function remove(int|string $group_id, int $board_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id)); } - /** - * @return mixed - */ public function allLists(int|string $group_id, int $board_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists'); } - /** - * @return mixed - */ public function showList(int|string $group_id, int $board_id, int $list_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id)); } - /** - * @return mixed - */ public function createList(int|string $group_id, int $board_id, int $label_id): mixed { $params = [ @@ -88,9 +64,6 @@ public function createList(int|string $group_id, int $board_id, int $label_id): return $this->post('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists', $params); } - /** - * @return mixed - */ public function updateList(int|string $group_id, int $board_id, int $list_id, int $position): mixed { $params = [ @@ -100,9 +73,6 @@ public function updateList(int|string $group_id, int $board_id, int $list_id, in return $this->put('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id), $params); } - /** - * @return mixed - */ public function deleteList(int|string $group_id, int $board_id, int $list_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id)); diff --git a/src/Api/GroupsEpics.php b/src/Api/GroupsEpics.php index 98630b70..603aef6e 100644 --- a/src/Api/GroupsEpics.php +++ b/src/Api/GroupsEpics.php @@ -38,8 +38,6 @@ class GroupsEpics extends AbstractApi * @var string $state return only active or closed epics * @var string $search Return only epics with a title or description matching the provided string. * } - * - * @return mixed */ public function all(int|string $group_id, array $parameters = []): mixed { @@ -58,41 +56,26 @@ public function all(int|string $group_id, array $parameters = []): mixed return $this->get('groups/'.self::encodePath($group_id).'/epics', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int|string $group_id, int $epic_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_id)); } - /** - * @return mixed - */ public function create(int|string $group_id, array $params): mixed { return $this->post('groups/'.self::encodePath($group_id).'/epics', $params); } - /** - * @return mixed - */ public function update(int|string $group_id, int $epic_id, array $params): mixed { return $this->put('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_id), $params); } - /** - * @return mixed - */ public function remove(int|string $group_id, int $epic_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_id)); } - /** - * @return mixed - */ public function issues(int|string $group_id, int $epic_iid): mixed { return $this->get('groups/'.self::encodePath($group_id).'/epics/'.self::encodePath($epic_iid).'/issues'); diff --git a/src/Api/GroupsMilestones.php b/src/Api/GroupsMilestones.php index 309c23b5..50fac667 100644 --- a/src/Api/GroupsMilestones.php +++ b/src/Api/GroupsMilestones.php @@ -37,8 +37,6 @@ class GroupsMilestones extends AbstractApi * @var \DateTimeInterface $updated_after Return only milestones updated on or after the given datetime. Expected in ISO 8601 format (2019-03-15T08:00:00Z) * @var \DateTimeInterface $updated_before Return only milestones updated on or before the given datetime. Expected in ISO 8601 format (2019-03-15T08:00:00Z) * } - * - * @return mixed */ public function all(int|string $group_id, array $parameters = []): mixed { @@ -69,49 +67,31 @@ public function all(int|string $group_id, array $parameters = []): mixed return $this->get('groups/'.self::encodePath($group_id).'/milestones', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int|string $group_id, int $milestone_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id)); } - /** - * @return mixed - */ public function create(int|string $group_id, array $params): mixed { return $this->post('groups/'.self::encodePath($group_id).'/milestones', $params); } - /** - * @return mixed - */ public function update(int|string $group_id, int $milestone_id, array $params): mixed { return $this->put('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id), $params); } - /** - * @return mixed - */ public function remove(int|string $group_id, int $milestone_id): mixed { return $this->delete('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id)); } - /** - * @return mixed - */ public function issues(int|string $group_id, int $milestone_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id).'/issues'); } - /** - * @return mixed - */ public function mergeRequests(int|string $group_id, int $milestone_id): mixed { return $this->get('groups/'.self::encodePath($group_id).'/milestones/'.self::encodePath($milestone_id).'/merge_requests'); diff --git a/src/Api/IssueBoards.php b/src/Api/IssueBoards.php index 756119cc..369de96f 100644 --- a/src/Api/IssueBoards.php +++ b/src/Api/IssueBoards.php @@ -16,9 +16,6 @@ class IssueBoards extends AbstractApi { - /** - * @return mixed - */ public function all(int|string|null $project_id = null, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -28,57 +25,36 @@ public function all(int|string|null $project_id = null, array $parameters = []): return $this->get($path, $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int|string $project_id, int $board_id): mixed { return $this->get($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id))); } - /** - * @return mixed - */ public function create(int|string $project_id, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'boards'), $params); } - /** - * @return mixed - */ public function update(int|string $project_id, int $board_id, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id)), $params); } - /** - * @return mixed - */ public function remove(int|string $project_id, int $board_id): mixed { return $this->delete($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id))); } - /** - * @return mixed - */ public function allLists(int|string $project_id, int $board_id): mixed { return $this->get($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists')); } - /** - * @return mixed - */ public function showList(int|string $project_id, int $board_id, int $list_id): mixed { return $this->get($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id))); } - /** - * @return mixed - */ public function createList(int|string $project_id, int $board_id, int $label_id): mixed { $params = [ @@ -88,9 +64,6 @@ public function createList(int|string $project_id, int $board_id, int $label_id) return $this->post($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists'), $params); } - /** - * @return mixed - */ public function updateList(int|string $project_id, int $board_id, int $list_id, int $position): mixed { $params = [ @@ -100,9 +73,6 @@ public function updateList(int|string $project_id, int $board_id, int $list_id, return $this->put($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id)), $params); } - /** - * @return mixed - */ public function deleteList(int|string $project_id, int $board_id, int $list_id): mixed { return $this->delete($this->getProjectPath($project_id, 'boards/'.self::encodePath($board_id).'/lists/'.self::encodePath($list_id))); diff --git a/src/Api/IssueLinks.php b/src/Api/IssueLinks.php index 25923ceb..d5c8399f 100644 --- a/src/Api/IssueLinks.php +++ b/src/Api/IssueLinks.php @@ -16,9 +16,6 @@ class IssueLinks extends AbstractApi { - /** - * @return mixed - */ public function all(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/links'); @@ -29,8 +26,6 @@ public function all(int|string $project_id, int $issue_iid): mixed * * @var string $link_type * } - * - * @return mixed */ public function create(int|string $project_id, int $issue_iid, int|string $target_project_id, int $target_issue_iid, array $parameters = []): mixed { @@ -45,8 +40,6 @@ public function create(int|string $project_id, int $issue_iid, int|string $targe * * @var string $link_type * } - * - * @return mixed */ public function remove(int|string $project_id, int $issue_iid, int|string $issue_link_id, array $parameters = []): mixed { diff --git a/src/Api/Issues.php b/src/Api/Issues.php index bb679919..10f74f26 100644 --- a/src/Api/Issues.php +++ b/src/Api/Issues.php @@ -47,8 +47,6 @@ class Issues extends AbstractApi * @var int $iteration_id filter issues assigned to the specified iteration id * @var string $iteration_title filter issues assigned to the specified iteration title * } - * - * @return mixed */ public function all(int|string|null $project_id = null, array $parameters = []): mixed { @@ -57,9 +55,6 @@ public function all(int|string|null $project_id = null, array $parameters = []): return $this->get($path, $this->createOptionsResolver()->resolve($parameters)); } - /** - * @return mixed - */ public function group(int|string $group_id, array $parameters = []): mixed { return $this->get( @@ -68,41 +63,26 @@ public function group(int|string $group_id, array $parameters = []): mixed ); } - /** - * @return mixed - */ public function show(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid))); } - /** - * @return mixed - */ public function create(int|string $project_id, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'issues'), $params); } - /** - * @return mixed - */ public function update(int|string $project_id, int $issue_iid, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)), $params); } - /** - * @return mixed - */ public function reorder(int|string $project_id, int $issue_iid, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/reorder', $params); } - /** - * @return mixed - */ public function move(int|string $project_id, int $issue_iid, int|string $to_project_id): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/move', [ @@ -110,33 +90,21 @@ public function move(int|string $project_id, int $issue_iid, int|string $to_proj ]); } - /** - * @return mixed - */ public function remove(int|string $project_id, int $issue_iid): mixed { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid))); } - /** - * @return mixed - */ public function showNotes(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes')); } - /** - * @return mixed - */ public function showNote(int|string $project_id, int $issue_iid, int $note_id): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes/'.self::encodePath($note_id))); } - /** - * @return mixed - */ public function addNote(int|string $project_id, int $issue_iid, string $body, array $params = []): mixed { $params['body'] = $body; @@ -144,9 +112,6 @@ public function addNote(int|string $project_id, int $issue_iid, string $body, ar return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes'), $params); } - /** - * @return mixed - */ public function updateNote(int|string $project_id, int $issue_iid, int $note_id, string $body, array $params = []): mixed { $params['body'] = $body; @@ -154,49 +119,31 @@ public function updateNote(int|string $project_id, int $issue_iid, int $note_id, return $this->put($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes/'.self::encodePath($note_id)), $params); } - /** - * @return mixed - */ public function removeNote(int|string $project_id, int $issue_iid, int $note_id): mixed { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/notes/'.self::encodePath($note_id))); } - /** - * @return mixed - */ public function showDiscussions(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/discussions'); } - /** - * @return mixed - */ public function showDiscussion(int|string $project_id, int $issue_iid, string $discussion_id): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/discussions/'.self::encodePath($discussion_id)); } - /** - * @return mixed - */ public function addDiscussion(int|string $project_id, int $issue_iid, string $body): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions'), ['body' => $body]); } - /** - * @return mixed - */ public function addDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, string $body): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions/'.self::encodePath($discussion_id).'/notes'), ['body' => $body]); } - /** - * @return mixed - */ public function updateDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, int $note_id, string $body): mixed { return $this->put($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id)), [ @@ -204,49 +151,31 @@ public function updateDiscussionNote(int|string $project_id, int $issue_iid, str ]); } - /** - * @return mixed - */ public function removeDiscussionNote(int|string $project_id, int $issue_iid, string $discussion_id, int $note_id): mixed { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id))); } - /** - * @return mixed - */ public function setTimeEstimate(int|string $project_id, int $issue_iid, string $duration): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/time_estimate'), ['duration' => $duration]); } - /** - * @return mixed - */ public function resetTimeEstimate(int|string $project_id, int $issue_iid): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/reset_time_estimate')); } - /** - * @return mixed - */ public function addSpentTime(int|string $project_id, int $issue_iid, string $duration): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/add_spent_time'), ['duration' => $duration]); } - /** - * @return mixed - */ public function resetSpentTime(int|string $project_id, int $issue_iid): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/reset_spent_time')); } - /** - * @return mixed - */ public function getTimeStats(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/time_stats')); @@ -260,8 +189,6 @@ public function getTimeStats(int|string $project_id, int $issue_iid): mixed * * @param int|string $project_id The ID or URL-encoded path of the project owned by the authenticated user * @param int $issue_iid The internal ID of a project’s issue - * - * @return mixed */ public function subscribe(int|string $project_id, int $issue_iid): mixed { @@ -276,65 +203,42 @@ public function subscribe(int|string $project_id, int $issue_iid): mixed * * @param int|string $project_id The ID or URL-encoded path of the project owned by the authenticated user * @param int $issue_iid The internal ID of a project’s issue - * - * @return mixed */ public function unsubscribe(int|string $project_id, int $issue_iid): mixed { return $this->post($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/unsubscribe')); } - /** - * @return mixed - */ public function awardEmoji(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/award_emoji')); } - /** - * @return mixed - */ public function removeAwardEmoji(int|string $project_id, int $issue_iid, int $award_id): mixed { return $this->delete($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/award_emoji/'.self::encodePath($award_id))); } - /** - * @return mixed - */ public function closedByMergeRequests(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/closed_by'); } - /** - * @return mixed - */ public function relatedMergeRequests(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid).'/related_merge_requests')); } - /** - * @return mixed - */ public function showParticipants(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/participants'); } - /** - * @return mixed - */ public function showResourceLabelEvents(int|string $project_id, int $issue_iid): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/resource_label_events'); } - /** - * @return mixed - */ public function showResourceLabelEvent(int|string $project_id, int $issue_iid, int $resource_label_event_id): mixed { return $this->get($this->getProjectPath($project_id, 'issues/'.self::encodePath($issue_iid)).'/resource_label_events/'.self::encodePath($resource_label_event_id)); diff --git a/src/Api/IssuesStatistics.php b/src/Api/IssuesStatistics.php index a7009614..33e459ef 100644 --- a/src/Api/IssuesStatistics.php +++ b/src/Api/IssuesStatistics.php @@ -19,25 +19,16 @@ class IssuesStatistics extends AbstractApi { - /** - * @return mixed - */ public function all(array $parameters): mixed { return $this->get('issues_statistics', $this->createOptionsResolver()->resolve($parameters)); } - /** - * @return mixed - */ public function project(int|string $project_id, array $parameters): mixed { return $this->get($this->getProjectPath($project_id, 'issues_statistics'), $this->createOptionsResolver()->resolve($parameters)); } - /** - * @return mixed - */ public function group(int|string $group_id, array $parameters): mixed { return $this->get('groups/'.self::encodePath($group_id).'/issues_statistics', $this->createOptionsResolver()->resolve($parameters)); diff --git a/src/Api/Jobs.php b/src/Api/Jobs.php index 8b41ec8d..1850e535 100644 --- a/src/Api/Jobs.php +++ b/src/Api/Jobs.php @@ -65,8 +65,6 @@ class Jobs extends AbstractApi * @var string|string[] $scope The scope of jobs to show, one or array of: created, pending, running, failed, * success, canceled, skipped, manual; showing all jobs if none provided. * } - * - * @return mixed */ public function all(int|string $project_id, array $parameters = []): mixed { @@ -81,8 +79,6 @@ public function all(int|string $project_id, array $parameters = []): mixed * @var string|string[] $scope The scope of jobs to show, one or array of: created, pending, running, failed, * success, canceled, skipped, manual; showing all jobs if none provided. * } - * - * @return mixed */ public function pipelineJobs(int|string $project_id, int $pipeline_id, array $parameters = []): mixed { @@ -101,8 +97,6 @@ public function pipelineJobs(int|string $project_id, int $pipeline_id, array $pa * success, canceled, skipped, manual; showing all jobs if none provided * @var bool $include_retried Include retried jobs in the response. Defaults to false. Introduced in GitLab 13.9. * } - * - * @return mixed */ public function pipelineBridges(int|string $project_id, int $pipeline_id, array $parameters = []): mixed { @@ -114,25 +108,16 @@ public function pipelineBridges(int|string $project_id, int $pipeline_id, array ); } - /** - * @return mixed - */ public function show(int|string $project_id, int $job_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id)); } - /** - * @return StreamInterface - */ public function artifacts(int|string $project_id, int $job_id): StreamInterface { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/artifacts')->getBody(); } - /** - * @return StreamInterface - */ public function artifactsByRefName(int|string $project_id, string $ref_name, string $job_name): StreamInterface { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/download', [ @@ -140,9 +125,6 @@ public function artifactsByRefName(int|string $project_id, string $ref_name, str ])->getBody(); } - /** - * @return StreamInterface - */ public function artifactByRefName(int|string $project_id, string $ref_name, string $job_name, string $artifact_path): StreamInterface { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/artifacts/'.self::encodePath($ref_name).'/raw/'.self::encodePath($artifact_path), [ @@ -150,57 +132,36 @@ public function artifactByRefName(int|string $project_id, string $ref_name, stri ])->getBody(); } - /** - * @return StreamInterface - */ public function artifactByJobId(int|string $project_id, int $job_id, string $artifact_path): StreamInterface { return $this->getAsResponse('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/artifacts/'.self::encodePath($artifact_path))->getBody(); } - /** - * @return mixed - */ public function trace(int|string $project_id, int $job_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/trace'); } - /** - * @return mixed - */ public function cancel(int|string $project_id, int $job_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/cancel'); } - /** - * @return mixed - */ public function retry(int|string $project_id, int $job_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/retry'); } - /** - * @return mixed - */ public function erase(int|string $project_id, int $job_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/erase'); } - /** - * @return mixed - */ public function keepArtifacts(int|string $project_id, int $job_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/artifacts/keep'); } - /** - * @return mixed - */ public function play(int|string $project_id, int $job_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/jobs/'.self::encodePath($job_id).'/play'); diff --git a/src/Api/Keys.php b/src/Api/Keys.php index 6a4d7553..05f4d4d5 100644 --- a/src/Api/Keys.php +++ b/src/Api/Keys.php @@ -16,9 +16,6 @@ class Keys extends AbstractApi { - /** - * @return mixed - */ public function show(int $id): mixed { return $this->get('keys/'.self::encodePath($id)); diff --git a/src/Api/MergeRequests.php b/src/Api/MergeRequests.php index ff9f68b4..83d5b7d0 100644 --- a/src/Api/MergeRequests.php +++ b/src/Api/MergeRequests.php @@ -66,8 +66,6 @@ class MergeRequests extends AbstractApi * * @throws UndefinedOptionsException if an option name is undefined * @throws InvalidOptionsException if an option doesn't fulfill the specified validation rules - * - * @return mixed */ public function all(int|string|null $project_id = null, array $parameters = []): mixed { @@ -158,8 +156,6 @@ public function all(int|string|null $project_id = null, array $parameters = []): * @var bool $include_diverged_commits_count Return the commits behind the target branch * @var bool $include_rebase_in_progress Return whether a rebase operation is in progress * } - * - * @return mixed */ public function show(int|string $project_id, int $mr_iid, array $parameters = []): mixed { @@ -181,8 +177,6 @@ public function show(int|string $project_id, int $mr_iid, array $parameters = [] * @var int|string $target_project_id the target project id * @var string $description the description * } - * - * @return mixed */ public function create(int|string $project_id, string $source, string $target, string $title, array $parameters = []): mixed { @@ -198,41 +192,26 @@ public function create(int|string $project_id, string $source, string $target, s ); } - /** - * @return mixed - */ public function update(int|string $project_id, int $mr_iid, array $parameters): mixed { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)), $parameters); } - /** - * @return mixed - */ public function merge(int|string $project_id, int $mr_iid, array $parameters = []): mixed { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/merge'), $parameters); } - /** - * @return mixed - */ public function showNotes(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes')); } - /** - * @return mixed - */ public function showNote(int|string $project_id, int $mr_iid, int $note_id): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id))); } - /** - * @return mixed - */ public function addNote(int|string $project_id, int $mr_iid, string $body, array $params = []): mixed { $params['body'] = $body; @@ -240,9 +219,6 @@ public function addNote(int|string $project_id, int $mr_iid, string $body, array return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes'), $params); } - /** - * @return mixed - */ public function updateNote(int|string $project_id, int $mr_iid, int $note_id, string $body): mixed { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id)), [ @@ -250,41 +226,26 @@ public function updateNote(int|string $project_id, int $mr_iid, int $note_id, st ]); } - /** - * @return mixed - */ public function removeNote(int|string $project_id, int $mr_iid, int $note_id): mixed { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id))); } - /** - * @return mixed - */ public function showDiscussions(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/discussions'); } - /** - * @return mixed - */ public function showDiscussion(int|string $project_id, int $mr_iid, string $discussion_id): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/discussions/'.self::encodePath($discussion_id)); } - /** - * @return mixed - */ public function addDiscussion(int|string $project_id, int $mr_iid, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions'), $params); } - /** - * @return mixed - */ public function resolveDiscussion(int|string $project_id, int $mr_iid, string $discussion_id, bool $resolved = true): mixed { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id)), [ @@ -292,105 +253,66 @@ public function resolveDiscussion(int|string $project_id, int $mr_iid, string $d ]); } - /** - * @return mixed - */ public function addDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, string $body): mixed { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes'), ['body' => $body]); } - /** - * @return mixed - */ public function updateDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, int $note_id, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id)), $params); } - /** - * @return mixed - */ public function removeDiscussionNote(int|string $project_id, int $mr_iid, string $discussion_id, int $note_id): mixed { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id))); } - /** - * @return mixed - */ public function showParticipants(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/participants'); } - /** - * @return mixed - */ public function changes(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/changes')); } - /** - * @return mixed - */ public function commits(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/commits')); } - /** - * @return mixed - */ public function closesIssues(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/closes_issues')); } - /** - * @return mixed - */ public function approvals(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approvals')); } - /** - * @return mixed - */ public function approve(int|string $project_id, int $mr_iid): mixed { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approve')); } - /** - * @return mixed - */ public function unapprove(int|string $project_id, int $mr_iid): mixed { return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/unapprove')); } - /** - * @return mixed - */ public function awardEmoji(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji')); } - /** - * @return mixed - */ public function removeAwardEmoji(int|string $project_id, int $mr_iid, int $award_id): mixed { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji/'.self::encodePath($award_id))); } - /** - * @return mixed - */ public function rebase(int|string $project_id, int $mr_iid, array $params = []): mixed { $resolver = $this->createOptionsResolver(); @@ -400,17 +322,11 @@ public function rebase(int|string $project_id, int $mr_iid, array $params = []): return $this->put($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/rebase', $resolver->resolve($params)); } - /** - * @return mixed - */ public function approvalState(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_state')); } - /** - * @return mixed - */ public function levelRules(int|string $project_id, int $mr_iid): mixed { return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_rules')); @@ -418,8 +334,6 @@ public function levelRules(int|string $project_id, int $mr_iid): mixed /** * @param array $parameters - * - * @return mixed */ public function createLevelRule(int|string $project_id, int $mr_iid, string $name, int $approvals_required, array $parameters = []): mixed { @@ -436,8 +350,6 @@ public function createLevelRule(int|string $project_id, int $mr_iid, string $nam /** * @param array $parameters - * - * @return mixed */ public function updateLevelRule(int|string $project_id, int $mr_iid, int $approval_rule_id, string $name, int $approvals_required, array $parameters = []): mixed { @@ -452,9 +364,6 @@ public function updateLevelRule(int|string $project_id, int $mr_iid, int $approv ); } - /** - * @return mixed - */ public function deleteLevelRule(int|string $project_id, int $mr_iid, int $approval_rule_id): mixed { return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_rules/'.self::encodePath($approval_rule_id))); diff --git a/src/Api/Milestones.php b/src/Api/Milestones.php index 2c1e7d09..ee076150 100644 --- a/src/Api/Milestones.php +++ b/src/Api/Milestones.php @@ -33,8 +33,6 @@ class Milestones extends AbstractApi * @var string $state return only active or closed milestones * @var string $search Return only milestones with a title or description matching the provided string. * } - * - * @return mixed */ public function all(int|string $project_id, array $parameters = []): mixed { @@ -53,49 +51,31 @@ public function all(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'milestones'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int|string $project_id, int $milestone_id): mixed { return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id))); } - /** - * @return mixed - */ public function create(int|string $project_id, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'milestones'), $params); } - /** - * @return mixed - */ public function update(int|string $project_id, int $milestone_id, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id)), $params); } - /** - * @return mixed - */ public function remove(int|string $project_id, int $milestone_id): mixed { return $this->delete($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id))); } - /** - * @return mixed - */ public function issues(int|string $project_id, int $milestone_id): mixed { return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id).'/issues')); } - /** - * @return mixed - */ public function mergeRequests(int|string $project_id, int $milestone_id): mixed { return $this->get($this->getProjectPath($project_id, 'milestones/'.self::encodePath($milestone_id).'/merge_requests')); diff --git a/src/Api/Packages.php b/src/Api/Packages.php index 5afaffa7..4698905f 100644 --- a/src/Api/Packages.php +++ b/src/Api/Packages.php @@ -32,8 +32,6 @@ class Packages extends AbstractApi * @var string $status filter the returned packages by status. one of default (default), * hidden, or processing. * } - * - * @return mixed */ public function all(int|string $project_id, array $parameters = []): mixed { @@ -62,33 +60,21 @@ public function all(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'packages'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int|string $project_id, int $package_id): mixed { return $this->get($this->getPackagePath($project_id, $package_id)); } - /** - * @return mixed - */ public function allFiles(int|string $project_id, int $package_id): mixed { return $this->get($this->getPackagePath($project_id, $package_id).'/package_files'); } - /** - * @return mixed - */ public function remove(int|string $project_id, int $package_id): mixed { return $this->delete($this->getPackagePath($project_id, $package_id)); } - /** - * @return mixed - */ public function removeFile(int|string $project_id, int $package_id, int $package_file_id): mixed { return $this->delete( @@ -96,9 +82,6 @@ public function removeFile(int|string $project_id, int $package_id, int $package ); } - /** - * @return mixed - */ public function addGenericFile(int|string $project_id, string $package_name, string $package_version, string $file, string $status = 'default'): mixed { return $this->putFile( diff --git a/src/Api/ProjectNamespaces.php b/src/Api/ProjectNamespaces.php index b02bd90e..d35228ba 100644 --- a/src/Api/ProjectNamespaces.php +++ b/src/Api/ProjectNamespaces.php @@ -21,8 +21,6 @@ class ProjectNamespaces extends AbstractApi * * @var string $search Returns a list of namespaces the user is authorized to see based on the search criteria. * } - * - * @return mixed */ public function all(array $parameters = []): mixed { @@ -32,9 +30,6 @@ public function all(array $parameters = []): mixed return $this->get('namespaces', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int|string $namespace_id): mixed { return $this->get('namespaces/'.self::encodePath($namespace_id)); diff --git a/src/Api/Projects.php b/src/Api/Projects.php index c72fb947..32aa168a 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -54,8 +54,6 @@ class Projects extends AbstractApi * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the specified validation rules - * - * @return mixed */ public function all(array $parameters = []): mixed { @@ -158,8 +156,6 @@ public function all(array $parameters = []): mixed * @var bool $statistics include project statistics * @var bool $with_custom_attributes Include project custom attributes. * } - * - * @return mixed */ public function show(int|string $project_id, array $parameters = []): mixed { @@ -179,9 +175,6 @@ public function show(int|string $project_id, array $parameters = []): mixed return $this->get('projects/'.self::encodePath($project_id), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function create(string $name, array $parameters = []): mixed { $parameters['name'] = $name; @@ -189,9 +182,6 @@ public function create(string $name, array $parameters = []): mixed return $this->post('projects', $parameters); } - /** - * @return mixed - */ public function createForUser(int $user_id, string $name, array $parameters = []): mixed { $parameters['name'] = $name; @@ -199,57 +189,36 @@ public function createForUser(int $user_id, string $name, array $parameters = [] return $this->post('projects/user/'.self::encodePath($user_id), $parameters); } - /** - * @return mixed - */ public function update(int|string $project_id, array $parameters): mixed { return $this->put('projects/'.self::encodePath($project_id), $parameters); } - /** - * @return mixed - */ public function remove(int|string $project_id): mixed { return $this->delete('projects/'.self::encodePath($project_id)); } - /** - * @return mixed - */ public function archive(int|string $project_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/archive'); } - /** - * @return mixed - */ public function unarchive(int|string $project_id): mixed { return $this->post('projects/'.self::encodePath($project_id).'/unarchive'); } - /** - * @return mixed - */ public function triggers(int|string $project_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/triggers'); } - /** - * @return mixed - */ public function trigger(int|string $project_id, int $trigger_id): mixed { return $this->get($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); } - /** - * @return mixed - */ public function createTrigger(int|string $project_id, string $description): mixed { return $this->post($this->getProjectPath($project_id, 'triggers'), [ @@ -257,17 +226,11 @@ public function createTrigger(int|string $project_id, string $description): mixe ]); } - /** - * @return mixed - */ public function removeTrigger(int|string $project_id, int $trigger_id): mixed { return $this->delete($this->getProjectPath($project_id, 'triggers/'.self::encodePath($trigger_id))); } - /** - * @return mixed - */ public function triggerPipeline(int|string $project_id, string $ref, string $token, array $variables = []): mixed { return $this->post($this->getProjectPath($project_id, 'trigger/pipeline'), [ @@ -277,17 +240,11 @@ public function triggerPipeline(int|string $project_id, string $ref, string $tok ]); } - /** - * @return mixed - */ public function disableRunner(int $project_id, int $runner_id): mixed { return $this->delete('projects/'.self::encodePath($project_id).'/runners/'.self::encodePath($runner_id)); } - /** - * @return mixed - */ public function enableRunner(int $project_id, int $runner_id): mixed { $parameters = [ @@ -311,8 +268,6 @@ public function enableRunner(int $project_id, int $runner_id): mixed * @var string $order sort pipelines in asc or desc order (default: desc) * @var string $source the source of the pipeline * } - * - * @return mixed */ public function pipelines(int|string $project_id, array $parameters = []): mixed { @@ -359,41 +314,26 @@ public function pipelines(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'pipelines'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function pipeline(int|string $project_id, int $pipeline_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id))); } - /** - * @return mixed - */ public function pipelineJobs(int|string $project_id, int $pipeline_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/jobs')); } - /** - * @return mixed - */ public function pipelineVariables(int|string $project_id, int $pipeline_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/variables')); } - /** - * @return mixed - */ public function pipelineTestReport(int|string $project_id, int $pipeline_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report')); } - /** - * @return mixed - */ public function pipelineTestReportSummary(int|string $project_id, int $pipeline_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id).'/test_report_summary')); @@ -406,8 +346,6 @@ public function pipelineTestReportSummary(int|string $project_id, int $pipeline_ * @var mixed $value The value of the variable * @var string $variable_type env_var (default) or file * } - * - * @return mixed */ public function createPipeline(int|string $project_id, string $commit_ref, ?array $variables = null): mixed { @@ -422,33 +360,21 @@ public function createPipeline(int|string $project_id, string $commit_ref, ?arra ]); } - /** - * @return mixed - */ public function retryPipeline(int|string $project_id, int $pipeline_id): mixed { return $this->post($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id)).'/retry'); } - /** - * @return mixed - */ public function cancelPipeline(int|string $project_id, int $pipeline_id): mixed { return $this->post($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id)).'/cancel'); } - /** - * @return mixed - */ public function deletePipeline(int|string $project_id, int $pipeline_id): mixed { return $this->delete($this->getProjectPath($project_id, 'pipelines/'.self::encodePath($pipeline_id))); } - /** - * @return mixed - */ public function allMembers(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -468,8 +394,6 @@ public function allMembers(int|string $project_id, array $parameters = []): mixe * * @var string $query The query you want to search members for. * } - * - * @return mixed */ public function members(int|string $project_id, array $parameters = []): mixed { @@ -488,25 +412,16 @@ public function members(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'members'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function member(int|string $project_id, int $user_id): mixed { return $this->get($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id))); } - /** - * @return mixed - */ public function allMember(int|string $project_id, int $user_id): mixed { return $this->get($this->getProjectPath($project_id, 'members/all/'.self::encodePath($user_id))); } - /** - * @return mixed - */ public function addMember(int|string $project_id, int $user_id, int $access_level, ?string $expires_at = null): mixed { $params = [ @@ -520,9 +435,6 @@ public function addMember(int|string $project_id, int $user_id, int $access_leve return $this->post($this->getProjectPath($project_id, 'members'), $params); } - /** - * @return mixed - */ public function saveMember(int|string $project_id, int $user_id, int $access_level, ?string $expires_at = null): mixed { $params = [ @@ -535,17 +447,11 @@ public function saveMember(int|string $project_id, int $user_id, int $access_lev return $this->put($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id)), $params); } - /** - * @return mixed - */ public function removeMember(int|string $project_id, int $user_id): mixed { return $this->delete($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id))); } - /** - * @return mixed - */ public function hooks(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -553,9 +459,6 @@ public function hooks(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'hooks'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function hook(int|string $project_id, int $hook_id): mixed { return $this->get($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id))); @@ -565,8 +468,6 @@ public function hook(int|string $project_id, int $hook_id): mixed * Get project users. * * See https://docs.gitlab.com/ee/api/projects.html#get-project-users for more info. - * - * @return mixed */ public function users(int|string $project_id, array $parameters = []): mixed { @@ -577,8 +478,6 @@ public function users(int|string $project_id, array $parameters = []): mixed * Get project issues. * * See https://docs.gitlab.com/ee/api/issues.html#list-project-issues for more info. - * - * @return mixed */ public function issues(int|string $project_id, array $parameters = []): mixed { @@ -589,8 +488,6 @@ public function issues(int|string $project_id, array $parameters = []): mixed * Get projects board list. * * See https://docs.gitlab.com/ee/api/boards.html for more info. - * - * @return mixed */ public function boards(int|string $project_id): mixed { @@ -605,8 +502,6 @@ public function boards(int|string $project_id): mixed * @var string $search return only iterations with a title matching the provided string * @var bool $include_ancestors Include iterations from parent group and its ancestors. Defaults to true. * } - * - * @return mixed */ public function iterations(int|string $project_id, array $parameters = []): mixed { @@ -635,17 +530,12 @@ public function iterations(int|string $project_id, array $parameters = []): mixe * - https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab/repository/commits/695c29abcf7dc2eabde8d59869abcea0923ce8fa/discussions * * @see https://docs.gitlab.com/ee/api/discussions.html#list-project-commit-discussion-items - * - * @return mixed */ public function getRepositoryCommitDiscussions(int|string $project_id, string $commit_id): mixed { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($commit_id)).'/discussions'); } - /** - * @return mixed - */ public function addHook(int|string $project_id, string $url, array $parameters = []): mixed { if (0 === \count($parameters)) { @@ -657,49 +547,31 @@ public function addHook(int|string $project_id, string $url, array $parameters = return $this->post($this->getProjectPath($project_id, 'hooks'), $parameters); } - /** - * @return mixed - */ public function updateHook(int|string $project_id, int $hook_id, array $parameters): mixed { return $this->put($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id)), $parameters); } - /** - * @return mixed - */ public function removeHook(int|string $project_id, int $hook_id): mixed { return $this->delete($this->getProjectPath($project_id, 'hooks/'.self::encodePath($hook_id))); } - /** - * @return mixed - */ public function transfer(int|string $project_id, mixed $namespace): mixed { return $this->put($this->getProjectPath($project_id, 'transfer'), ['namespace' => $namespace]); } - /** - * @return mixed - */ public function deployKeys(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'deploy_keys')); } - /** - * @return mixed - */ public function deployKey(int|string $project_id, int $key_id): mixed { return $this->get($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id))); } - /** - * @return mixed - */ public function addDeployKey(int|string $project_id, string $title, string $key, bool $canPush = false): mixed { return $this->post($this->getProjectPath($project_id, 'deploy_keys'), [ @@ -709,25 +581,16 @@ public function addDeployKey(int|string $project_id, string $title, string $key, ]); } - /** - * @return mixed - */ public function deleteDeployKey(int|string $project_id, int $key_id): mixed { return $this->delete($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id))); } - /** - * @return mixed - */ public function enableDeployKey(int|string $project_id, int $key_id): mixed { return $this->post($this->getProjectPath($project_id, 'deploy_keys/'.self::encodePath($key_id).'/enable')); } - /** - * @return mixed - */ public function deployTokens(int|string $project_id, ?bool $active = null): mixed { return $this->get($this->getProjectPath($project_id, 'deploy_tokens'), (null !== $active) ? ['active' => $active] : []); @@ -741,8 +604,6 @@ public function deployTokens(int|string $project_id, ?bool $active = null): mixe * @var string $username the username for the deploy token * @var array $scopes the scopes, one or many of: read_repository, read_registry, write_registry, read_package_registry, write_package_registry * } - * - * @return mixed */ public function createDeployToken(int|string $project_id, array $parameters = []): mixed { @@ -781,9 +642,6 @@ public function createDeployToken(int|string $project_id, array $parameters = [] return $this->post($this->getProjectPath($project_id, 'deploy_tokens'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function deleteDeployToken(int|string $project_id, int $token_id): mixed { return $this->delete($this->getProjectPath($project_id, 'deploy_tokens/'.self::encodePath($token_id))); @@ -798,8 +656,6 @@ public function deleteDeployToken(int|string $project_id, int $token_id): mixed * @var \DateTimeInterface $after include only events created after a particular date * @var string $sort Sort events in asc or desc order by created_at (default is desc) * } - * - * @return mixed */ public function events(int|string $project_id, array $parameters = []): mixed { @@ -835,8 +691,6 @@ public function events(int|string $project_id, array $parameters = []): mixed * @var bool $include_ancestor_groups Include ancestor groups. Defaults to true. * @var string $search Keyword to filter labels by. * } - * - * @return mixed */ public function labels(int|string $project_id, array $parameters = []): mixed { @@ -854,25 +708,16 @@ public function labels(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'labels'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function addLabel(int|string $project_id, array $parameters): mixed { return $this->post($this->getProjectPath($project_id, 'labels'), $parameters); } - /** - * @return mixed - */ public function updateLabel(int|string $project_id, int $label_id, array $parameters): mixed { return $this->put($this->getProjectPath($project_id, 'labels/'.self::encodePath($label_id)), $parameters); } - /** - * @return mixed - */ public function removeLabel(int|string $project_id, int $label_id): mixed { return $this->delete($this->getProjectPath($project_id, 'labels/'.self::encodePath($label_id))); @@ -880,8 +725,6 @@ public function removeLabel(int|string $project_id, int $label_id): mixed /** * Get languages used in a project with percentage value. - * - * @return mixed */ public function languages(int|string $project_id): mixed { @@ -910,8 +753,6 @@ public function languages(int|string $project_id): mixed * @var \DateTimeInterface $updated_after limit results to projects last updated after the specified time * @var bool $with_custom_attributes Include custom attributes in response * } - * - * @return mixed */ public function forks(int|string $project_id, array $parameters = []): mixed { @@ -994,8 +835,6 @@ public function forks(int|string $project_id, array $parameters = []): mixed * @var string $path The path of the forked project (optional) * @var string $name The name of the forked project (optional) * } - * - * @return mixed */ public function fork(int|string $project_id, array $parameters = []): mixed { @@ -1007,41 +846,26 @@ public function fork(int|string $project_id, array $parameters = []): mixed return $this->post($this->getProjectPath($project_id, 'fork'), $resolved); } - /** - * @return mixed - */ public function createForkRelation(int|string $project_id, int|string $forked_project_id): mixed { return $this->post($this->getProjectPath($project_id, 'fork/'.self::encodePath($forked_project_id))); } - /** - * @return mixed - */ public function removeForkRelation(int|string $project_id): mixed { return $this->delete($this->getProjectPath($project_id, 'fork')); } - /** - * @return mixed - */ public function setService(int|string $project_id, string $service_name, array $parameters = []): mixed { return $this->put($this->getProjectPath($project_id, 'services/'.self::encodePath($service_name)), $parameters); } - /** - * @return mixed - */ public function removeService(int|string $project_id, string $service_name): mixed { return $this->delete($this->getProjectPath($project_id, 'services/'.self::encodePath($service_name))); } - /** - * @return mixed - */ public function variables(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -1049,9 +873,6 @@ public function variables(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'variables'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function variable(int|string $project_id, string $key, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -1066,8 +887,6 @@ public function variable(int|string $project_id, string $key, array $parameters * * @var string $variable_type env_var (default) or file * } - * - * @return mixed */ public function addVariable(int|string $project_id, string $key, string $value, ?bool $protected = null, ?string $environment_scope = null, array $parameters = []): mixed { @@ -1094,8 +913,6 @@ public function addVariable(int|string $project_id, string $key, string $value, * * @var string $variable_type env_var (default) or file *} - * - * @return mixed */ public function updateVariable(int|string $project_id, string $key, string $value, ?bool $protected = null, ?string $environment_scope = null, array $parameters = []): mixed { @@ -1123,8 +940,6 @@ public function updateVariable(int|string $project_id, string $key, string $valu * @var string $environment_scope Use filter[environment_scope] to select the variable with the matching environment_scope attribute. * } * } - * - * @return mixed */ public function removeVariable(int|string $project_id, string $key, array $parameters = []): mixed { @@ -1135,25 +950,17 @@ public function removeVariable(int|string $project_id, string $key, array $param return $this->delete($this->getProjectPath($project_id, 'variables/'.self::encodePath($key)), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function uploadFile(int|string $project_id, string $file): mixed { return $this->post($this->getProjectPath($project_id, 'uploads'), [], [], ['file' => $file]); } - /** - * @return mixed - */ public function uploadAvatar(int|string $project_id, string $file): mixed { return $this->put('projects/'.self::encodePath($project_id), [], [], ['avatar' => $file]); } /** - * @return mixed - * * @see https://docs.gitlab.com/ee/api/deployments.html#list-project-deployments */ public function deployments(int|string $project_id, array $parameters = []): mixed @@ -1206,17 +1013,11 @@ public function deployments(int|string $project_id, array $parameters = []): mix return $this->get($this->getProjectPath($project_id, 'deployments'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function deployment(int|string $project_id, int $deployment_id): mixed { return $this->get($this->getProjectPath($project_id, 'deployments/'.self::encodePath($deployment_id))); } - /** - * @return mixed - */ public function addShare(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -1240,153 +1041,96 @@ public function addShare(int|string $project_id, array $parameters = []): mixed return $this->post($this->getProjectPath($project_id, 'share'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function removeShare(int|string $project_id, int|string $group_id): mixed { return $this->delete($this->getProjectPath($project_id, 'share/'.$group_id)); } - /** - * @return mixed - */ public function badges(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'badges')); } - /** - * @return mixed - */ public function badge(int|string $project_id, int $badge_id): mixed { return $this->get($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id))); } - /** - * @return mixed - */ public function addBadge(int|string $project_id, array $parameters = []): mixed { return $this->post($this->getProjectPath($project_id, 'badges'), $parameters); } - /** - * @return mixed - */ public function removeBadge(int|string $project_id, int $badge_id): mixed { return $this->delete($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id))); } - /** - * @return mixed - */ public function updateBadge(int|string $project_id, int $badge_id, array $parameters = []): mixed { return $this->put($this->getProjectPath($project_id, 'badges/'.self::encodePath($badge_id)), $parameters); } - /** - * @return mixed - */ public function protectedBranches(int|string $project_id, array $parameters = []): mixed { return $this->get('projects/'.self::encodePath($project_id).'/protected_branches'); } - /** - * @return mixed - */ public function addProtectedBranch(int|string $project_id, array $parameters = []): mixed { return $this->post($this->getProjectPath($project_id, 'protected_branches'), $parameters); } - /** - * @return mixed - */ public function deleteProtectedBranch(int|string $project_id, string $branch_name): mixed { return $this->delete($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name))); } - /** - * @return mixed - */ public function updateProtectedBranch(int|string $project_id, string $branch_name, array $parameters = []): mixed { return $this->patch($this->getProjectPath($project_id, 'protected_branches/'.self::encodePath($branch_name)), $parameters); } - /** - * @return mixed - */ public function approvalsConfiguration(int|string $project_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/approvals'); } - /** - * @return mixed - */ public function updateApprovalsConfiguration(int|string $project_id, array $parameters = []): mixed { return $this->post('projects/'.self::encodePath($project_id).'/approvals', $parameters); } - /** - * @return mixed - */ public function approvalsRules(int|string $project_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/approval_rules'); } - /** - * @return mixed - */ public function createApprovalsRule(int|string $project_id, array $parameters = []): mixed { return $this->post('projects/'.self::encodePath($project_id).'/approval_rules/', $parameters); } - /** - * @return mixed - */ public function updateApprovalsRule(int|string $project_id, int $approval_rule_id, array $parameters = []): mixed { return $this->put('projects/'.self::encodePath($project_id).'/approval_rules/'.self::encodePath($approval_rule_id), $parameters); } - /** - * @return mixed - */ public function deleteApprovalsRule(int|string $project_id, int $approval_rule_id): mixed { return $this->delete('projects/'.self::encodePath($project_id).'/approval_rules/'.self::encodePath($approval_rule_id)); } - /** - * @return mixed - */ public function deleteAllMergedBranches(int|string $project_id): mixed { return $this->delete($this->getProjectPath($project_id, 'repository/merged_branches')); } - /** - * @return mixed - */ public function projectAccessTokens(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'access_tokens')); } - /** - * @return mixed - */ public function projectAccessToken(int|string $project_id, int|string $token_id): mixed { return $this->get($this->getProjectPath($project_id, 'access_tokens/'.self::encodePath($token_id))); @@ -1400,8 +1144,6 @@ public function projectAccessToken(int|string $project_id, int|string $token_id) * @var int $access_level the access level: 10 (Guest), 20 (Reporter), 30 (Developer), 40 (Maintainer), 50 (Owner) * @var \DateTimeInterface $expires_at the token expires at midnight UTC on that date * } - * - * @return mixed */ public function createProjectAccessToken(int|string $project_id, array $parameters = []): mixed { @@ -1442,33 +1184,21 @@ public function createProjectAccessToken(int|string $project_id, array $paramete return $this->post($this->getProjectPath($project_id, 'access_tokens'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function deleteProjectAccessToken(int|string $project_id, int|string $token_id): mixed { return $this->delete($this->getProjectPath($project_id, 'access_tokens/'.$token_id)); } - /** - * @return mixed - */ public function protectedTags(int|string $project_id): mixed { return $this->get('projects/'.self::encodePath($project_id).'/protected_tags'); } - /** - * @return mixed - */ public function protectedTag(int|string $project_id, string $tag_name): mixed { return $this->get('projects/'.self::encodePath($project_id).'/protected_tags/'.self::encodePath($tag_name)); } - /** - * @return mixed - */ public function addProtectedTag(int|string $project_id, array $parameters = []): mixed { $resolver = new OptionsResolver(); @@ -1497,9 +1227,6 @@ public function addProtectedTag(int|string $project_id, array $parameters = []): return $this->post($this->getProjectPath($project_id, 'protected_tags'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function deleteProtectedTag(int|string $project_id, string $tag_name): mixed { return $this->delete($this->getProjectPath($project_id, 'protected_tags/'.self::encodePath($tag_name))); @@ -1519,8 +1246,6 @@ public function deleteProtectedTag(int|string $project_id, string $tag_name): mi * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the specified validation rules - * - * @return mixed */ public function search(int|string $id, array $parameters = []): mixed { diff --git a/src/Api/Repositories.php b/src/Api/Repositories.php index d7993202..eded16b9 100644 --- a/src/Api/Repositories.php +++ b/src/Api/Repositories.php @@ -34,8 +34,6 @@ class Repositories extends AbstractApi * * @var string $search * } - * - * @return mixed */ public function branches(int|string $project_id, array $parameters = []): mixed { @@ -46,17 +44,11 @@ public function branches(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'repository/branches'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function branch(int|string $project_id, string $branch): mixed { return $this->get($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch))); } - /** - * @return mixed - */ public function createBranch(int|string $project_id, string $branch, string $ref): mixed { return $this->post($this->getProjectPath($project_id, 'repository/branches'), [ @@ -65,17 +57,11 @@ public function createBranch(int|string $project_id, string $branch, string $ref ]); } - /** - * @return mixed - */ public function deleteBranch(int|string $project_id, string $branch): mixed { return $this->delete($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch))); } - /** - * @return mixed - */ public function protectBranch(int|string $project_id, string $branch, bool $devPush = false, bool $devMerge = false): mixed { return $this->put($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch).'/protect'), [ @@ -84,17 +70,11 @@ public function protectBranch(int|string $project_id, string $branch, bool $devP ]); } - /** - * @return mixed - */ public function unprotectBranch(int|string $project_id, string $branch): mixed { return $this->put($this->getProjectPath($project_id, 'repository/branches/'.self::encodePath($branch).'/unprotect')); } - /** - * @return mixed - */ public function tags(int|string $project_id, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -104,9 +84,6 @@ public function tags(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'repository/tags'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function createTag(int|string $project_id, string $name, string $ref, ?string $message = null): mixed { return $this->post($this->getProjectPath($project_id, 'repository/tags'), [ @@ -116,9 +93,6 @@ public function createTag(int|string $project_id, string $name, string $ref, ?st ]); } - /** - * @return mixed - */ public function createRelease(int|string $project_id, string $tag_name, string $description, ?string $name = null): mixed { return $this->post($this->getProjectPath($project_id, 'releases'), \array_filter([ @@ -129,9 +103,6 @@ public function createRelease(int|string $project_id, string $tag_name, string $ ], fn ($v) => null !== $v)); } - /** - * @return mixed - */ public function updateRelease(int|string $project_id, string $tag_name, string $description, ?string $name = null): mixed { return $this->put($this->getProjectPath($project_id, 'releases/'.self::encodePath($tag_name)), \array_filter([ @@ -142,9 +113,6 @@ public function updateRelease(int|string $project_id, string $tag_name, string $ ], fn ($v) => null !== $v)); } - /** - * @return mixed - */ public function releases(int|string $project_id): mixed { $resolver = $this->createOptionsResolver(); @@ -161,8 +129,6 @@ public function releases(int|string $project_id): mixed * @var \DateTimeInterface $since only commits after or on this date will be returned * @var \DateTimeInterface $until Only commits before or on this date will be returned. * } - * - * @return mixed */ public function commits(int|string $project_id, array $parameters = []): mixed { @@ -204,17 +170,11 @@ public function commits(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'repository/commits'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function commit(int|string $project_id, string $sha): mixed { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha))); } - /** - * @return mixed - */ public function commitRefs(int|string $project_id, string $sha, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -241,8 +201,6 @@ public function commitRefs(int|string $project_id, string $sha, array $parameter * @var string $author_email specify the commit author's email address * @var string $author_name Specify the commit author's name. * } - * - * @return mixed */ public function createCommit(int|string $project_id, array $parameters = []): mixed { @@ -289,9 +247,6 @@ public function createCommit(int|string $project_id, array $parameters = []): mi return $this->post($this->getProjectPath($project_id, 'repository/commits'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function revertCommit(int|string $project_id, string $branch, string $sha): mixed { return $this->post($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/revert'), [ @@ -299,9 +254,6 @@ public function revertCommit(int|string $project_id, string $branch, string $sha ]); } - /** - * @return mixed - */ public function commitComments(int|string $project_id, string $sha, array $parameters = []): mixed { $resolver = $this->createOptionsResolver(); @@ -312,9 +264,6 @@ public function commitComments(int|string $project_id, string $sha, array $param ); } - /** - * @return mixed - */ public function createCommitComment(int|string $project_id, string $sha, string $note, array $params = []): mixed { $params['note'] = $note; @@ -322,17 +271,11 @@ public function createCommitComment(int|string $project_id, string $sha, string return $this->post($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/comments'), $params); } - /** - * @return mixed - */ public function getCommitBuildStatus(int|string $project_id, string $sha, array $params = []): mixed { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/statuses'), $params); } - /** - * @return mixed - */ public function postCommitBuildStatus(int|string $project_id, string $sha, string $state, array $params = []): mixed { $params['state'] = $state; @@ -340,9 +283,6 @@ public function postCommitBuildStatus(int|string $project_id, string $sha, strin return $this->post($this->getProjectPath($project_id, 'statuses/'.self::encodePath($sha)), $params); } - /** - * @return mixed - */ public function compare(int|string $project_id, string $fromShaOrMaster, string $toShaOrMaster, bool $straight = false, ?string $fromProjectId = null): mixed { $params = [ @@ -358,25 +298,16 @@ public function compare(int|string $project_id, string $fromShaOrMaster, string return $this->get($this->getProjectPath($project_id, 'repository/compare'), $params); } - /** - * @return mixed - */ public function diff(int|string $project_id, string $sha): mixed { return $this->get($this->getProjectPath($project_id, 'repository/commits/'.self::encodePath($sha).'/diff')); } - /** - * @return mixed - */ public function tree(int|string $project_id, array $params = []): mixed { return $this->get($this->getProjectPath($project_id, 'repository/tree'), $params); } - /** - * @return mixed - */ public function contributors(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'repository/contributors')); @@ -384,25 +315,17 @@ public function contributors(int|string $project_id): mixed /** * @param string $format Options: "tar.gz", "zip", "tar.bz2" and "tar" - * - * @return mixed */ public function archive(int|string $project_id, array $params = [], string $format = 'tar.gz'): mixed { return $this->get($this->getProjectPath($project_id, 'repository/archive.'.$format), $params); } - /** - * @return mixed - */ public function mergeBase(int|string $project_id, array $refs): mixed { return $this->get($this->getProjectPath($project_id, 'repository/merge_base'), ['refs' => $refs]); } - /** - * @return mixed - */ public function cherryPick(int|string $project_id, string $sha, array $params = []): mixed { $resolver = $this->createOptionsResolver(); diff --git a/src/Api/RepositoryFiles.php b/src/Api/RepositoryFiles.php index cfc085b8..80f303ad 100644 --- a/src/Api/RepositoryFiles.php +++ b/src/Api/RepositoryFiles.php @@ -18,9 +18,6 @@ class RepositoryFiles extends AbstractApi { - /** - * @return mixed - */ public function getFile(int|string $project_id, string $file_path, string $ref): mixed { return $this->get($this->getProjectPath($project_id, 'repository/files/'.self::encodePath($file_path)), [ @@ -28,9 +25,6 @@ public function getFile(int|string $project_id, string $file_path, string $ref): ]); } - /** - * @return mixed - */ public function getRawFile(int|string $project_id, string $file_path, string $ref): mixed { return $this->get($this->getProjectPath($project_id, 'repository/files/'.self::encodePath($file_path).'/raw'), [ @@ -50,8 +44,6 @@ public function getRawFile(int|string $project_id, string $file_path, string $re * @var string $content file content * @var string $commit_message Commit message. * } - * - * @return mixed */ public function createFile(int|string $project_id, array $parameters = []): mixed { @@ -85,8 +77,6 @@ public function createFile(int|string $project_id, array $parameters = []): mixe * @var string $commit_message commit message * @var string $last_commit_id last known file commit id * } - * - * @return mixed */ public function updateFile(int|string $project_id, array $parameters = []): mixed { @@ -118,8 +108,6 @@ public function updateFile(int|string $project_id, array $parameters = []): mixe * @var string $author_name specify the commit author's name * @var string $commit_message Commit message. * } - * - * @return mixed */ public function deleteFile(int|string $project_id, array $parameters = []): mixed { diff --git a/src/Api/ResourceIterationEvents.php b/src/Api/ResourceIterationEvents.php index 66e8c289..f18edb75 100644 --- a/src/Api/ResourceIterationEvents.php +++ b/src/Api/ResourceIterationEvents.php @@ -16,9 +16,6 @@ class ResourceIterationEvents extends AbstractApi { - /** - * @return mixed - */ public function all(int|string $project_id, int $issue_iid): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_iteration_events'; @@ -26,9 +23,6 @@ public function all(int|string $project_id, int $issue_iid): mixed return $this->get($this->getProjectPath($project_id, $path)); } - /** - * @return mixed - */ public function show(int|string $project_id, int $issue_iid, int $resource_iteration_event_id): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_iteration_events/'; diff --git a/src/Api/ResourceLabelEvents.php b/src/Api/ResourceLabelEvents.php index 72f1bcf9..9ccf6567 100644 --- a/src/Api/ResourceLabelEvents.php +++ b/src/Api/ResourceLabelEvents.php @@ -16,9 +16,6 @@ class ResourceLabelEvents extends AbstractApi { - /** - * @return mixed - */ public function all(int|string $project_id, int $issue_iid): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_label_events'; @@ -26,9 +23,6 @@ public function all(int|string $project_id, int $issue_iid): mixed return $this->get($this->getProjectPath($project_id, $path)); } - /** - * @return mixed - */ public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_label_events/'; diff --git a/src/Api/ResourceMilestoneEvents.php b/src/Api/ResourceMilestoneEvents.php index bb39eabe..be4adb47 100644 --- a/src/Api/ResourceMilestoneEvents.php +++ b/src/Api/ResourceMilestoneEvents.php @@ -16,9 +16,6 @@ class ResourceMilestoneEvents extends AbstractApi { - /** - * @return mixed - */ public function all(int|string $project_id, int $issue_iid): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_milestone_events'; @@ -26,9 +23,6 @@ public function all(int|string $project_id, int $issue_iid): mixed return $this->get($this->getProjectPath($project_id, $path)); } - /** - * @return mixed - */ public function show(int|string $project_id, int $issue_iid, int $resource_milestone_event_id): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_milestone_events/'; diff --git a/src/Api/ResourceStateEvents.php b/src/Api/ResourceStateEvents.php index d9bd4179..be03a6d5 100644 --- a/src/Api/ResourceStateEvents.php +++ b/src/Api/ResourceStateEvents.php @@ -16,9 +16,6 @@ class ResourceStateEvents extends AbstractApi { - /** - * @return mixed - */ public function all(int|string $project_id, int $issue_iid): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_state_events'; @@ -26,9 +23,6 @@ public function all(int|string $project_id, int $issue_iid): mixed return $this->get($this->getProjectPath($project_id, $path)); } - /** - * @return mixed - */ public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_state_events/'; diff --git a/src/Api/ResourceWeightEvents.php b/src/Api/ResourceWeightEvents.php index 1f9ec767..53a7b162 100644 --- a/src/Api/ResourceWeightEvents.php +++ b/src/Api/ResourceWeightEvents.php @@ -16,9 +16,6 @@ class ResourceWeightEvents extends AbstractApi { - /** - * @return mixed - */ public function all(int|string $project_id, int $issue_iid): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_weight_events'; @@ -26,9 +23,6 @@ public function all(int|string $project_id, int $issue_iid): mixed return $this->get($this->getProjectPath($project_id, $path)); } - /** - * @return mixed - */ public function show(int|string $project_id, int $issue_iid, int $resource_label_event_id): mixed { $path = 'issues/'.self::encodePath($issue_iid).'/resource_weight_events/'; diff --git a/src/Api/Schedules.php b/src/Api/Schedules.php index 272a6af4..44b61964 100644 --- a/src/Api/Schedules.php +++ b/src/Api/Schedules.php @@ -16,49 +16,31 @@ class Schedules extends AbstractApi { - /** - * @return mixed - */ public function create(int|string $project_id, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'pipeline_schedules'), $params); } - /** - * @return mixed - */ public function show(int|string $project_id, int $schedule_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id))); } - /** - * @return mixed - */ public function showAll(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'pipeline_schedules')); } - /** - * @return mixed - */ public function update(int|string $project_id, int $schedule_id, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)), $params); } - /** - * @return mixed - */ public function remove(int|string $project_id, int $schedule_id): mixed { return $this->delete($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id))); } - /** - * @return mixed - */ public function addVariable(int|string $project_id, int $schedule_id, array $params): mixed { $path = 'pipeline_schedules/'.self::encodePath($schedule_id).'/variables'; @@ -66,9 +48,6 @@ public function addVariable(int|string $project_id, int $schedule_id, array $par return $this->post($this->getProjectPath($project_id, $path), $params); } - /** - * @return mixed - */ public function updateVariable(int|string $project_id, int $schedule_id, string $variable_key, array $params): mixed { $path = 'pipeline_schedules/'.self::encodePath($schedule_id).'/variables/'.self::encodePath($variable_key); @@ -76,9 +55,6 @@ public function updateVariable(int|string $project_id, int $schedule_id, string return $this->put($this->getProjectPath($project_id, $path), $params); } - /** - * @return mixed - */ public function removeVariable(int|string $project_id, int $schedule_id, string $variable_key): mixed { $path = 'pipeline_schedules/'.self::encodePath($schedule_id).'/variables/'.self::encodePath($variable_key); @@ -86,17 +62,11 @@ public function removeVariable(int|string $project_id, int $schedule_id, string return $this->delete($this->getProjectPath($project_id, $path)); } - /** - * @return mixed - */ public function takeOwnership(int|string $project_id, int $schedule_id): mixed { return $this->post($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)).'/take_ownership'); } - /** - * @return mixed - */ public function play(int|string $project_id, int $schedule_id): mixed { return $this->post($this->getProjectPath($project_id, 'pipeline_schedules/'.self::encodePath($schedule_id)).'/play'); diff --git a/src/Api/Search.php b/src/Api/Search.php index 4d926db5..a7685bd6 100644 --- a/src/Api/Search.php +++ b/src/Api/Search.php @@ -33,8 +33,6 @@ class Search extends AbstractApi * * @throws UndefinedOptionsException If an option name is undefined * @throws InvalidOptionsException If an option doesn't fulfill the specified validation rules - * - * @return mixed */ public function all(array $parameters = []): mixed { diff --git a/src/Api/Snippets.php b/src/Api/Snippets.php index cfb39049..d62e174e 100644 --- a/src/Api/Snippets.php +++ b/src/Api/Snippets.php @@ -16,25 +16,16 @@ class Snippets extends AbstractApi { - /** - * @return mixed - */ public function all(int|string $project_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets')); } - /** - * @return mixed - */ public function show(int|string $project_id, int $snippet_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id))); } - /** - * @return mixed - */ public function create(int|string $project_id, string $title, string $filename, string $code, string $visibility): mixed { return $this->post($this->getProjectPath($project_id, 'snippets'), [ @@ -45,49 +36,31 @@ public function create(int|string $project_id, string $title, string $filename, ]); } - /** - * @return mixed - */ public function update(int|string $project_id, int $snippet_id, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id)), $params); } - /** - * @return mixed - */ public function content(int|string $project_id, int $snippet_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/raw')); } - /** - * @return mixed - */ public function remove(int|string $project_id, int $snippet_id): mixed { return $this->delete($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id))); } - /** - * @return mixed - */ public function showNotes(int|string $project_id, int $snippet_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes')); } - /** - * @return mixed - */ public function showNote(int|string $project_id, int $snippet_id, int $note_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes/'.self::encodePath($note_id))); } - /** - * @return mixed - */ public function addNote(int|string $project_id, int $snippet_id, string $body, array $params = []): mixed { $params['body'] = $body; @@ -95,9 +68,6 @@ public function addNote(int|string $project_id, int $snippet_id, string $body, a return $this->post($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes'), $params); } - /** - * @return mixed - */ public function updateNote(int|string $project_id, int $snippet_id, int $note_id, string $body): mixed { return $this->put($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes/'.self::encodePath($note_id)), [ @@ -105,25 +75,16 @@ public function updateNote(int|string $project_id, int $snippet_id, int $note_id ]); } - /** - * @return mixed - */ public function removeNote(int|string $project_id, int $snippet_id, int $note_id): mixed { return $this->delete($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/notes/'.self::encodePath($note_id))); } - /** - * @return mixed - */ public function awardEmoji(int|string $project_id, int $snippet_id): mixed { return $this->get($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/award_emoji')); } - /** - * @return mixed - */ public function removeAwardEmoji(int|string $project_id, int $snippet_id, int $award_id): mixed { return $this->delete($this->getProjectPath($project_id, 'snippets/'.self::encodePath($snippet_id).'/award_emoji/'.self::encodePath($award_id))); diff --git a/src/Api/SystemHooks.php b/src/Api/SystemHooks.php index b9b9ce29..f068429d 100644 --- a/src/Api/SystemHooks.php +++ b/src/Api/SystemHooks.php @@ -19,9 +19,6 @@ class SystemHooks extends AbstractApi { - /** - * @return mixed - */ public function all(): mixed { return $this->get('hooks'); @@ -37,8 +34,6 @@ public function all(): mixed * @var bool $repository_update_events trigger hook on repository update events * @var bool $enable_ssl_verification do SSL verification when triggering the hook * } - * - * @return mixed */ public function create(string $url, array $parameters = []): mixed { @@ -49,17 +44,11 @@ public function create(string $url, array $parameters = []): mixed return $this->post('hooks', $parameters); } - /** - * @return mixed - */ public function test(int $id): mixed { return $this->get('hooks/'.self::encodePath($id)); } - /** - * @return mixed - */ public function remove(int $id): mixed { return $this->delete('hooks/'.self::encodePath($id)); diff --git a/src/Api/Tags.php b/src/Api/Tags.php index ba20f7b7..8085d763 100644 --- a/src/Api/Tags.php +++ b/src/Api/Tags.php @@ -24,8 +24,6 @@ class Tags extends AbstractApi * @var string $search Return list of tags matching the search criteria. You can use `^term` and `term$` to * find tags that begin and end with term respectively. * } - * - * @return mixed */ public function all(int|string $project_id, array $parameters = []): mixed { @@ -39,41 +37,26 @@ public function all(int|string $project_id, array $parameters = []): mixed return $this->get($this->getProjectPath($project_id, 'repository/tags'), $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int|string $project_id, string $tag_name): mixed { return $this->get($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name))); } - /** - * @return mixed - */ public function create(int|string $project_id, array $params = []): mixed { return $this->post($this->getProjectPath($project_id, 'repository/tags'), $params); } - /** - * @return mixed - */ public function remove(int|string $project_id, string $tag_name): mixed { return $this->delete($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name))); } - /** - * @return mixed - */ public function createRelease(int|string $project_id, string $tag_name, array $params = []): mixed { return $this->post($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name).'/release'), $params); } - /** - * @return mixed - */ public function updateRelease(int|string $project_id, string $tag_name, array $params = []): mixed { return $this->put($this->getProjectPath($project_id, 'repository/tags/'.self::encodePath($tag_name).'/release'), $params); diff --git a/src/Api/Users.php b/src/Api/Users.php index 8d990cca..01fd1ff3 100644 --- a/src/Api/Users.php +++ b/src/Api/Users.php @@ -31,8 +31,6 @@ class Users extends AbstractApi * @var bool $active Return only active users. It does not support filtering inactive users. * @var bool $blocked Return only blocked users. It does not support filtering non-blocked users. * } - * - * @return mixed */ public function all(array $parameters = []): mixed { @@ -68,9 +66,6 @@ public function all(array $parameters = []): mixed return $this->get('users', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function show(int $id): mixed { return $this->get('users/'.self::encodePath($id)); @@ -81,8 +76,6 @@ public function show(int $id): mixed * * @var string $type Filter memberships by type. Can be either Project or Namespace * } - * - * @return mixed */ public function usersMemberships(int $id, array $parameters = []): mixed { @@ -112,8 +105,6 @@ public function usersMemberships(int $id, array $parameters = []): mixed * @var bool $with_merge_requests_enabled limit by enabled merge requests feature * @var int $min_access_level Limit by current user minimal access level * } - * - * @return mixed */ public function usersProjects(int $id, array $parameters = []): mixed { @@ -189,8 +180,6 @@ public function usersProjects(int $id, array $parameters = []): mixed * @var int $min_access_level Limit by current user minimal access level * @var bool $with_custom_attributes Include custom attributes in response (administrator only) * } - * - * @return mixed */ public function usersStarredProjects(int $id, array $parameters = []): mixed { @@ -251,17 +240,11 @@ public function usersStarredProjects(int $id, array $parameters = []): mixed return $this->get('users/'.self::encodePath($id).'/starred_projects', $resolver->resolve($parameters)); } - /** - * @return mixed - */ public function user(): mixed { return $this->get('user'); } - /** - * @return mixed - */ public function create(string $email, string $password, array $params = []): mixed { $params['email'] = $email; @@ -270,9 +253,6 @@ public function create(string $email, string $password, array $params = []): mix return $this->post('users', $params); } - /** - * @return mixed - */ public function update(int $id, array $params, array $files = []): mixed { return $this->put('users/'.self::encodePath($id), $params, [], $files); @@ -284,73 +264,47 @@ public function update(int $id, array $params, array $files = []): mixed * @var bool $hard_delete If true, contributions that would usually be moved to the ghost user are * deleted instead, as well as groups owned solely by this user. * } - * - * @return mixed */ public function remove(int $id, array $params = []): mixed { return $this->delete('users/'.self::encodePath($id), $params); } - /** - * @return mixed - */ public function block(int $id): mixed { return $this->post('users/'.self::encodePath($id).'/block'); } - /** - * @return mixed - */ public function unblock(int $id): mixed { return $this->post('users/'.self::encodePath($id).'/unblock'); } - /** - * @return mixed - */ public function activate(int $id): mixed { return $this->post('users/'.self::encodePath($id).'/activate'); } - /** - * @return mixed - */ public function deactivate(int $id): mixed { return $this->post('users/'.self::encodePath($id).'/deactivate'); } - /** - * @return mixed - */ public function me(): mixed { return $this->get('user'); } - /** - * @return mixed - */ public function keys(): mixed { return $this->get('user/keys'); } - /** - * @return mixed - */ public function key(int $id): mixed { return $this->get('user/keys/'.self::encodePath($id)); } - /** - * @return mixed - */ public function createKey(string $title, string $key): mixed { return $this->post('user/keys', [ @@ -359,33 +313,21 @@ public function createKey(string $title, string $key): mixed ]); } - /** - * @return mixed - */ public function removeKey(int $id): mixed { return $this->delete('user/keys/'.self::encodePath($id)); } - /** - * @return mixed - */ public function userKeys(int $user_id): mixed { return $this->get('users/'.self::encodePath($user_id).'/keys'); } - /** - * @return mixed - */ public function userKey(int $user_id, int $key_id): mixed { return $this->get('users/'.self::encodePath($user_id).'/keys/'.self::encodePath($key_id)); } - /** - * @return mixed - */ public function createKeyForUser(int $user_id, string $title, string $key): mixed { return $this->post('users/'.self::encodePath($user_id).'/keys', [ @@ -394,41 +336,26 @@ public function createKeyForUser(int $user_id, string $title, string $key): mixe ]); } - /** - * @return mixed - */ public function removeUserKey(int $user_id, int $key_id): mixed { return $this->delete('users/'.self::encodePath($user_id).'/keys/'.self::encodePath($key_id)); } - /** - * @return mixed - */ public function emails(): mixed { return $this->get('user/emails'); } - /** - * @return mixed - */ public function email(int $id): mixed { return $this->get('user/emails/'.self::encodePath($id)); } - /** - * @return mixed - */ public function userEmails(int $user_id): mixed { return $this->get('users/'.self::encodePath($user_id).'/emails'); } - /** - * @return mixed - */ public function createEmailForUser(int $user_id, string $email, bool $skip_confirmation = false): mixed { return $this->post('users/'.self::encodePath($user_id).'/emails', [ @@ -437,17 +364,11 @@ public function createEmailForUser(int $user_id, string $email, bool $skip_confi ]); } - /** - * @return mixed - */ public function removeUserEmail(int $user_id, int $email_id): mixed { return $this->delete('users/'.self::encodePath($user_id).'/emails/'.self::encodePath($email_id)); } - /** - * @return mixed - */ public function userImpersonationTokens(int $user_id, array $params = []): mixed { $resolver = $this->createOptionsResolver(); @@ -459,17 +380,11 @@ public function userImpersonationTokens(int $user_id, array $params = []): mixed return $this->get('users/'.self::encodePath($user_id).'/impersonation_tokens', $resolver->resolve($params)); } - /** - * @return mixed - */ public function userImpersonationToken(int $user_id, int $impersonation_token_id): mixed { return $this->get('users/'.self::encodePath($user_id).'/impersonation_tokens/'.self::encodePath($impersonation_token_id)); } - /** - * @return mixed - */ public function createImpersonationToken(int $user_id, string $name, array $scopes, ?string $expires_at = null): mixed { return $this->post('users/'.self::encodePath($user_id).'/impersonation_tokens', [ @@ -479,9 +394,6 @@ public function createImpersonationToken(int $user_id, string $name, array $scop ]); } - /** - * @return mixed - */ public function removeImpersonationToken(int $user_id, int $impersonation_token_id): mixed { return $this->delete('users/'.self::encodePath($user_id).'/impersonation_tokens/'.self::encodePath($impersonation_token_id)); @@ -496,8 +408,6 @@ public function removeImpersonationToken(int $user_id, int $impersonation_token_ * @var \DateTimeInterface $after include only events created after a particular date * @var string $sort Sort events in asc or desc order by created_at (default is desc) * } - * - * @return mixed */ public function events(int $user_id, array $parameters = []): mixed { @@ -528,8 +438,6 @@ public function events(int $user_id, array $parameters = []): mixed /** * Deletes a user’s authentication identity using the provider name associated with that identity. - * - * @return mixed */ public function removeUserIdentity(int $user_id, string $provider): mixed { diff --git a/src/Api/Version.php b/src/Api/Version.php index 7c4ac3bb..8976a320 100644 --- a/src/Api/Version.php +++ b/src/Api/Version.php @@ -16,9 +16,6 @@ class Version extends AbstractApi { - /** - * @return mixed - */ public function show(): mixed { return $this->get('version'); diff --git a/src/Api/Wiki.php b/src/Api/Wiki.php index 8b0840cd..fbb05551 100644 --- a/src/Api/Wiki.php +++ b/src/Api/Wiki.php @@ -18,17 +18,12 @@ class Wiki extends AbstractApi { /** * @param array $params - * - * @return mixed */ public function create(int|string $project_id, array $params): mixed { return $this->post($this->getProjectPath($project_id, 'wikis'), $params); } - /** - * @return mixed - */ public function show(int|string $project_id, string $wiki_slug): mixed { return $this->get($this->getProjectPath($project_id, 'wikis/'.self::encodePath($wiki_slug))); @@ -39,8 +34,6 @@ public function show(int|string $project_id, string $wiki_slug): mixed * * @var bool $with_content Include pages' content * } - * - * @return mixed */ public function showAll(int|string $project_id, array $params): mixed { @@ -53,17 +46,12 @@ public function showAll(int|string $project_id, array $params): mixed /** * @param array $params - * - * @return mixed */ public function update(int|string $project_id, string $wiki_slug, array $params): mixed { return $this->put($this->getProjectPath($project_id, 'wikis/'.self::encodePath($wiki_slug)), $params); } - /** - * @return mixed - */ public function remove(int|string $project_id, string $wiki_slug): mixed { return $this->delete($this->getProjectPath($project_id, 'wikis/'.self::encodePath($wiki_slug))); diff --git a/src/HttpClient/Message/ResponseMediator.php b/src/HttpClient/Message/ResponseMediator.php index 6fa01362..ef66fae6 100644 --- a/src/HttpClient/Message/ResponseMediator.php +++ b/src/HttpClient/Message/ResponseMediator.php @@ -53,8 +53,6 @@ final class ResponseMediator /** * Return the response body as a string or JSON array if content type is JSON. - * - * @return array|string */ public static function getContent(ResponseInterface $response): array|string { diff --git a/src/HttpClient/Plugin/History.php b/src/HttpClient/Plugin/History.php index 3f96b724..b138bd8b 100644 --- a/src/HttpClient/Plugin/History.php +++ b/src/HttpClient/Plugin/History.php @@ -28,9 +28,6 @@ */ final class History implements Journal { - /** - * @var ResponseInterface|null - */ private ?ResponseInterface $lastResponse; public function getLastResponse(): ?ResponseInterface diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 33850f24..98d5f3bb 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -515,8 +515,6 @@ public function getProjectIssuesExpectedArray(): array /** * Get expected array for tests which check project users method. - * - * @return array */ public function getProjectUsersExpectedArray(): array { diff --git a/tests/Api/RepositoryFilesTest.php b/tests/Api/RepositoryFilesTest.php index a57eafb6..d9dfdf3b 100644 --- a/tests/Api/RepositoryFilesTest.php +++ b/tests/Api/RepositoryFilesTest.php @@ -260,9 +260,6 @@ public function shouldDeleteFileWithAuthor(): void ])); } - /** - * @return string - */ protected function getApiClass(): string { return RepositoryFiles::class; diff --git a/tests/Api/TestCase.php b/tests/Api/TestCase.php index 06da98ce..02741f0c 100644 --- a/tests/Api/TestCase.php +++ b/tests/Api/TestCase.php @@ -20,14 +20,8 @@ abstract class TestCase extends BaseTestCase { - /** - * @return string - */ abstract protected function getApiClass(): string; - /** - * @return \PHPUnit\Framework\MockObject\MockObject - */ protected function getApiMock(array $methods = []): \PHPUnit\Framework\MockObject\MockObject { $httpClient = $this->getMockBuilder(ClientInterface::class) diff --git a/tests/HttpClient/BuilderTest.php b/tests/HttpClient/BuilderTest.php index 01c5b304..56ce8a5a 100644 --- a/tests/HttpClient/BuilderTest.php +++ b/tests/HttpClient/BuilderTest.php @@ -28,9 +28,6 @@ */ class BuilderTest extends TestCase { - /** - * @var Builder - */ private Builder $subject; #[Before] From af564a4b1d6cb455c734f9510b8fb9e2d1b52411 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 18:22:13 +0000 Subject: [PATCH 111/117] Update TestCase.php --- tests/Api/TestCase.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Api/TestCase.php b/tests/Api/TestCase.php index 02741f0c..bbc35cd1 100644 --- a/tests/Api/TestCase.php +++ b/tests/Api/TestCase.php @@ -17,12 +17,13 @@ use Gitlab\Client; use PHPUnit\Framework\TestCase as BaseTestCase; use Psr\Http\Client\ClientInterface; +use PHPUnit\Framework\MockObject\MockObject; abstract class TestCase extends BaseTestCase { abstract protected function getApiClass(): string; - protected function getApiMock(array $methods = []): \PHPUnit\Framework\MockObject\MockObject + protected function getApiMock(array $methods = []): MockObject { $httpClient = $this->getMockBuilder(ClientInterface::class) ->onlyMethods(['sendRequest']) From a3f255786ebea689cde91c2c07609204522c8d84 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 23 Feb 2025 18:22:21 +0000 Subject: [PATCH 112/117] Apply fixes from StyleCI --- tests/Api/TestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Api/TestCase.php b/tests/Api/TestCase.php index bbc35cd1..34f192c6 100644 --- a/tests/Api/TestCase.php +++ b/tests/Api/TestCase.php @@ -15,9 +15,9 @@ namespace Gitlab\Tests\Api; use Gitlab\Client; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase as BaseTestCase; use Psr\Http\Client\ClientInterface; -use PHPUnit\Framework\MockObject\MockObject; abstract class TestCase extends BaseTestCase { From b4e4ed7f546a00edde3f22fb749f7c85901ceedf Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 19:46:39 +0000 Subject: [PATCH 113/117] Add more return types --- tests/Api/DeployKeysTest.php | 4 ++-- tests/Api/DeploymentsTest.php | 7 ++++--- tests/Api/EnvironmentsTest.php | 2 +- tests/Api/EventsTest.php | 2 +- tests/Api/GroupBoardsTest.php | 2 +- tests/Api/GroupsEpicsTest.php | 2 +- tests/Api/GroupsMilestonesTest.php | 4 ++-- tests/Api/GroupsTest.php | 2 +- tests/Api/IssueBoardsTest.php | 2 +- tests/Api/IssueLinksTest.php | 2 +- tests/Api/IssueSubscribeTest.php | 2 +- tests/Api/IssuesStatisticsTest.php | 2 +- tests/Api/IssuesTest.php | 2 +- tests/Api/JobsTest.php | 2 +- tests/Api/KeysTest.php | 2 +- tests/Api/MergeRequestsTest.php | 4 ++-- tests/Api/MilestonesTest.php | 2 +- tests/Api/PackagesTest.php | 2 +- tests/Api/ProjectNamespacesTest.php | 2 +- tests/Api/ProjectsTest.php | 11 ++++++----- tests/Api/RepositoriesTest.php | 2 +- tests/Api/ScheduleTest.php | 2 +- tests/Api/SearchTest.php | 2 +- tests/Api/SnippetsTest.php | 2 +- tests/Api/SystemHooksTest.php | 2 +- tests/Api/TagsTest.php | 2 +- tests/Api/UsersTest.php | 11 ++++++----- tests/Api/VersionTest.php | 2 +- tests/Api/WikiTest.php | 2 +- 29 files changed, 45 insertions(+), 42 deletions(-) diff --git a/tests/Api/DeployKeysTest.php b/tests/Api/DeployKeysTest.php index fabd585b..bbe1648b 100644 --- a/tests/Api/DeployKeysTest.php +++ b/tests/Api/DeployKeysTest.php @@ -34,7 +34,7 @@ public function shouldGetAllDeployKeys(): void $this->assertEquals($expectedArray, $api->all(['page' => 2, 'per_page' => 5])); } - protected function getMultipleDeployKeysData() + protected function getMultipleDeployKeysData(): array { return [ [ @@ -52,7 +52,7 @@ protected function getMultipleDeployKeysData() ]; } - protected function getApiClass() + protected function getApiClass(): string { return DeployKeys::class; } diff --git a/tests/Api/DeploymentsTest.php b/tests/Api/DeploymentsTest.php index d26b243e..d6859206 100644 --- a/tests/Api/DeploymentsTest.php +++ b/tests/Api/DeploymentsTest.php @@ -16,6 +16,7 @@ use Gitlab\Api\Deployments; use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\MockObject\MockObject; class DeploymentsTest extends TestCase { @@ -107,7 +108,7 @@ public function shouldShowDeployment(): void $this->assertEquals($expectedArray, $api->show(1, 42)); } - private function getMultipleDeploymentsData() + private function getMultipleDeploymentsData(): array { return [ [ @@ -241,7 +242,7 @@ private function getMultipleDeploymentsData() ]; } - protected function getMultipleDeploymentsRequestMock(string $path, array $expectedArray, array $expectedParameters) + protected function getMultipleDeploymentsRequestMock(string $path, array $expectedArray, array $expectedParameters): MockObject { $api = $this->getApiMock(); $api->expects($this->once()) @@ -269,7 +270,7 @@ public function shouldGetAllDeploymentsSortedByCreatedAt(): void ); } - protected function getApiClass() + protected function getApiClass(): string { return Deployments::class; } diff --git a/tests/Api/EnvironmentsTest.php b/tests/Api/EnvironmentsTest.php index e0a0d205..5af2c4ad 100644 --- a/tests/Api/EnvironmentsTest.php +++ b/tests/Api/EnvironmentsTest.php @@ -195,7 +195,7 @@ public function shouldStopEnvironment(): void $this->assertEquals($expectedBool, $api->stop(1, 3)); } - protected function getApiClass() + protected function getApiClass(): string { return Environments::class; } diff --git a/tests/Api/EventsTest.php b/tests/Api/EventsTest.php index ddc870e9..fb39b9c8 100644 --- a/tests/Api/EventsTest.php +++ b/tests/Api/EventsTest.php @@ -18,7 +18,7 @@ class EventsTest extends TestCase { - protected function getApiClass() + protected function getApiClass(): string { return Events::class; } diff --git a/tests/Api/GroupBoardsTest.php b/tests/Api/GroupBoardsTest.php index bcea57b6..4ebf53bf 100644 --- a/tests/Api/GroupBoardsTest.php +++ b/tests/Api/GroupBoardsTest.php @@ -218,7 +218,7 @@ public function shouldDeleteList(): void $this->assertEquals($expectedBool, $api->deleteList(1, 2, 3)); } - protected function getApiClass() + protected function getApiClass(): string { return GroupsBoards::class; } diff --git a/tests/Api/GroupsEpicsTest.php b/tests/Api/GroupsEpicsTest.php index 5ce33fb6..8ba51f1b 100644 --- a/tests/Api/GroupsEpicsTest.php +++ b/tests/Api/GroupsEpicsTest.php @@ -114,7 +114,7 @@ public function shouldGetEpicsIssues(): void $this->assertEquals($expectedArray, $api->issues(1, 2)); } - protected function getApiClass() + protected function getApiClass(): string { return GroupsEpics::class; } diff --git a/tests/Api/GroupsMilestonesTest.php b/tests/Api/GroupsMilestonesTest.php index bce1a684..96376117 100644 --- a/tests/Api/GroupsMilestonesTest.php +++ b/tests/Api/GroupsMilestonesTest.php @@ -62,7 +62,7 @@ public function shouldGetAllMilestonesWithParameterTwoIidsValues(): void $api->all(1, ['iids' => [456, 789]]); } - public static function getAllMilestonesWithParameterStateDataProvider() + public static function getAllMilestonesWithParameterStateDataProvider(): array { return [ GroupsMilestones::STATE_ACTIVE => [GroupsMilestones::STATE_ACTIVE], @@ -220,7 +220,7 @@ public function shouldGetMilestonesMergeRequests(): void $this->assertEquals($expectedArray, $api->mergeRequests(1, 3)); } - protected function getApiClass() + protected function getApiClass(): string { return GroupsMilestones::class; } diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index ebb53db5..3b90e6f2 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -534,7 +534,7 @@ public function shouldRemoveVariable(): void $this->assertEquals($expectedBool, $api->removeVariable(1, 'ftp_password')); } - protected function getApiClass() + protected function getApiClass(): string { return Groups::class; } diff --git a/tests/Api/IssueBoardsTest.php b/tests/Api/IssueBoardsTest.php index 2638a8ab..45f83fb1 100644 --- a/tests/Api/IssueBoardsTest.php +++ b/tests/Api/IssueBoardsTest.php @@ -218,7 +218,7 @@ public function shouldDeleteList(): void $this->assertEquals($expectedBool, $api->deleteList(1, 2, 3)); } - protected function getApiClass() + protected function getApiClass(): string { return IssueBoards::class; } diff --git a/tests/Api/IssueLinksTest.php b/tests/Api/IssueLinksTest.php index b9f4207c..ed400ad7 100644 --- a/tests/Api/IssueLinksTest.php +++ b/tests/Api/IssueLinksTest.php @@ -22,7 +22,7 @@ class IssueLinksTest extends TestCase /** * {@inheritdoc} */ - protected function getApiClass() + protected function getApiClass(): string { return IssueLinks::class; } diff --git a/tests/Api/IssueSubscribeTest.php b/tests/Api/IssueSubscribeTest.php index dea23ec0..140a8313 100644 --- a/tests/Api/IssueSubscribeTest.php +++ b/tests/Api/IssueSubscribeTest.php @@ -45,7 +45,7 @@ public function testUnsubscribeIssue(): void $this->assertEquals($expectedValue, $api->unsubscribe(1, 2)); } - protected function getApiClass() + protected function getApiClass(): string { return Issues::class; } diff --git a/tests/Api/IssuesStatisticsTest.php b/tests/Api/IssuesStatisticsTest.php index 60800c70..1b83cdb9 100644 --- a/tests/Api/IssuesStatisticsTest.php +++ b/tests/Api/IssuesStatisticsTest.php @@ -93,7 +93,7 @@ public function shouldGetGroup(): void $this->assertEquals($expectedArray, $api->group(1, [])); } - protected function getApiClass() + protected function getApiClass(): string { return IssuesStatistics::class; } diff --git a/tests/Api/IssuesTest.php b/tests/Api/IssuesTest.php index 3c32b9a8..ce72acb4 100644 --- a/tests/Api/IssuesTest.php +++ b/tests/Api/IssuesTest.php @@ -595,7 +595,7 @@ public function shouldGetIssueResourceLabelEvent(): void $this->assertEquals($expectedArray, $api->showResourceLabelEvent(1, 2, 3)); } - protected function getApiClass() + protected function getApiClass(): string { return Issues::class; } diff --git a/tests/Api/JobsTest.php b/tests/Api/JobsTest.php index 3db71c80..6753353d 100644 --- a/tests/Api/JobsTest.php +++ b/tests/Api/JobsTest.php @@ -265,7 +265,7 @@ public function shouldPlay(): void $this->assertEquals($expectedArray, $api->play(1, 3)); } - protected function getApiClass() + protected function getApiClass(): string { return Jobs::class; } diff --git a/tests/Api/KeysTest.php b/tests/Api/KeysTest.php index b3d9f561..08c7f268 100644 --- a/tests/Api/KeysTest.php +++ b/tests/Api/KeysTest.php @@ -32,7 +32,7 @@ public function shouldShowKey(): void $this->assertEquals($expectedArray, $api->show(1)); } - protected function getApiClass() + protected function getApiClass(): string { return Keys::class; } diff --git a/tests/Api/MergeRequestsTest.php b/tests/Api/MergeRequestsTest.php index f31f4961..c0803014 100644 --- a/tests/Api/MergeRequestsTest.php +++ b/tests/Api/MergeRequestsTest.php @@ -793,7 +793,7 @@ public function shoudDeleteLevelRule(): void $this->assertEquals($expectedValue, $api->deleteLevelRule(1, 2, 3)); } - protected function getMultipleMergeRequestsData() + protected function getMultipleMergeRequestsData(): array { return [ ['id' => 1, 'title' => 'A merge request'], @@ -801,7 +801,7 @@ protected function getMultipleMergeRequestsData() ]; } - protected function getApiClass() + protected function getApiClass(): string { return MergeRequests::class; } diff --git a/tests/Api/MilestonesTest.php b/tests/Api/MilestonesTest.php index e1d0e6c3..bb9104be 100644 --- a/tests/Api/MilestonesTest.php +++ b/tests/Api/MilestonesTest.php @@ -132,7 +132,7 @@ public function shouldGetMilestonesMergeRequests(): void $this->assertEquals($expectedArray, $api->mergeRequests(1, 3)); } - protected function getApiClass() + protected function getApiClass(): string { return Milestones::class; } diff --git a/tests/Api/PackagesTest.php b/tests/Api/PackagesTest.php index 657c35d0..96553b6d 100644 --- a/tests/Api/PackagesTest.php +++ b/tests/Api/PackagesTest.php @@ -109,7 +109,7 @@ public function shouldRemovePackageFile(): void $this->assertEquals($expectedBool, $api->removeFile(1, 1, 25)); } - protected function getApiClass() + protected function getApiClass(): string { return Packages::class; } diff --git a/tests/Api/ProjectNamespacesTest.php b/tests/Api/ProjectNamespacesTest.php index b731b68c..7ac81c59 100644 --- a/tests/Api/ProjectNamespacesTest.php +++ b/tests/Api/ProjectNamespacesTest.php @@ -52,7 +52,7 @@ public function shouldShowNamespace(): void $this->assertEquals($expectedArray, $api->show(1)); } - protected function getApiClass() + protected function getApiClass(): string { return ProjectNamespaces::class; } diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 98d5f3bb..1ef556ea 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -18,6 +18,7 @@ use Gitlab\Api\Projects; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\MockObject\MockObject; class ProjectsTest extends TestCase { @@ -2135,7 +2136,7 @@ public function shouldRemoveVariable(): void $this->assertEquals($expectedBool, $api->removeVariable(1, 'ftp_password')); } - protected function getMultipleProjectsRequestMock($path, $expectedArray = [], $expectedParameters = []) + protected function getMultipleProjectsRequestMock($path, $expectedArray = [], $expectedParameters = []): MockObject { $api = $this->getApiMock(); $api->expects($this->once()) @@ -2237,7 +2238,7 @@ public function shouldGetDeploymentsFiltered(): void $this->assertEquals($expectedArray, $api->deployments(1, ['updated_after' => $time])); } - protected function getMultipleProjectsData() + protected function getMultipleProjectsData(): array { return [ ['id' => 1, 'name' => 'A project'], @@ -2245,7 +2246,7 @@ protected function getMultipleProjectsData() ]; } - protected function getMultipleProjectsDataWithNamespace() + protected function getMultipleProjectsDataWithNamespace(): array { return [ ['id' => 1, 'name' => 'A project', 'namespace' => ['id' => 4, 'name' => 'A namespace', 'path' => 'a_namespace']], @@ -2264,7 +2265,7 @@ public static function possibleAccessLevels(): array ]; } - public function getBadgeExpectedArray() + public function getBadgeExpectedArray(): array { return [ [ @@ -2730,7 +2731,7 @@ public function shouldRemoveProtectedTag(): void $this->assertEquals($expectedBool, $api->deleteProtectedTag(1, 'release-*')); } - protected function getApiClass() + protected function getApiClass(): string { return Projects::class; } diff --git a/tests/Api/RepositoriesTest.php b/tests/Api/RepositoriesTest.php index b58fa61d..3b5d7334 100644 --- a/tests/Api/RepositoriesTest.php +++ b/tests/Api/RepositoriesTest.php @@ -652,7 +652,7 @@ public function shouldCherryPick(): void $this->assertEquals($expectedArray, $api->cherryPick(1, '123456123456', ['branch' => 'feature_branch'])); } - protected function getApiClass() + protected function getApiClass(): string { return Repositories::class; } diff --git a/tests/Api/ScheduleTest.php b/tests/Api/ScheduleTest.php index e535ead4..e5f64e98 100644 --- a/tests/Api/ScheduleTest.php +++ b/tests/Api/ScheduleTest.php @@ -213,7 +213,7 @@ public function shouldPlay(): void $this->assertEquals($expectedBool, $api->play(1, 2)); } - protected function getApiClass() + protected function getApiClass(): string { return Schedules::class; } diff --git a/tests/Api/SearchTest.php b/tests/Api/SearchTest.php index 3d52b13f..cbb39a2e 100644 --- a/tests/Api/SearchTest.php +++ b/tests/Api/SearchTest.php @@ -49,7 +49,7 @@ public function shouldGetAll(): void ])); } - protected function getApiClass() + protected function getApiClass(): string { return Search::class; } diff --git a/tests/Api/SnippetsTest.php b/tests/Api/SnippetsTest.php index 96032f52..0d75c5c9 100644 --- a/tests/Api/SnippetsTest.php +++ b/tests/Api/SnippetsTest.php @@ -219,7 +219,7 @@ public function shouldRevokeSnippetAwardEmoji(): void $this->assertEquals(true, $api->removeAwardEmoji(1, 2, 3)); } - protected function getApiClass() + protected function getApiClass(): string { return Snippets::class; } diff --git a/tests/Api/SystemHooksTest.php b/tests/Api/SystemHooksTest.php index 1a441995..6c0d3845 100644 --- a/tests/Api/SystemHooksTest.php +++ b/tests/Api/SystemHooksTest.php @@ -80,7 +80,7 @@ public function shouldRemoveHook(): void $this->assertEquals($expectedBool, $api->remove(3)); } - protected function getApiClass() + protected function getApiClass(): string { return SystemHooks::class; } diff --git a/tests/Api/TagsTest.php b/tests/Api/TagsTest.php index 24696ecc..2be94e67 100644 --- a/tests/Api/TagsTest.php +++ b/tests/Api/TagsTest.php @@ -144,7 +144,7 @@ public static function releaseDataProvider(): array ]; } - protected function getApiClass() + protected function getApiClass(): string { return Tags::class; } diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index a3da91c8..fdda2693 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -17,6 +17,7 @@ use Gitlab\Api\Users; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\MockObject\MockObject; class UsersTest extends TestCase { @@ -100,7 +101,7 @@ public function shouldShowUser(): void $this->assertEquals($expectedArray, $api->show(1)); } - protected function getUsersMembershipsData() + protected function getUsersMembershipsData(): array { return [ [ @@ -118,7 +119,7 @@ protected function getUsersMembershipsData() ]; } - protected function getUsersMembershipsRequestMock($path, $expectedArray = [], $expectedParameters = []) + protected function getUsersMembershipsRequestMock($path, $expectedArray = [], $expectedParameters = []): MockObject { $api = $this->getApiMock(); $api->expects($this->once()) @@ -160,7 +161,7 @@ public function shouldShowUsersMembershipsWithTypeNamespace(): void $this->assertEquals($expectedArray, $api->usersMemberships(1, ['type' => 'Namespace'])); } - protected function getUsersProjectsData() + protected function getUsersProjectsData(): array { return [ ['id' => 1, 'name' => 'matt-project-1'], @@ -168,7 +169,7 @@ protected function getUsersProjectsData() ]; } - protected function getUsersProjectsRequestMock($path, $expectedArray = [], $expectedParameters = []) + protected function getUsersProjectsRequestMock($path, $expectedArray = [], $expectedParameters = []): MockObject { $api = $this->getApiMock(); $api->expects($this->once()) @@ -799,7 +800,7 @@ public function shouldGetCurrentUserInactiveImpersonationTokens(): void $this->assertEquals($expectedArray, $api->userImpersonationTokens(1, ['state' => 'inactive'])); } - protected function getApiClass() + protected function getApiClass(): string { return Users::class; } diff --git a/tests/Api/VersionTest.php b/tests/Api/VersionTest.php index 927dbef1..63080a79 100644 --- a/tests/Api/VersionTest.php +++ b/tests/Api/VersionTest.php @@ -35,7 +35,7 @@ public function shouldShowVersion(): void $this->assertEquals($expectedArray, $api->show()); } - protected function getApiClass() + protected function getApiClass(): string { return Version::class; } diff --git a/tests/Api/WikiTest.php b/tests/Api/WikiTest.php index 4c4444eb..4bb28b52 100644 --- a/tests/Api/WikiTest.php +++ b/tests/Api/WikiTest.php @@ -122,7 +122,7 @@ public function shouldRemoveWiki(): void $this->assertEquals($expectedBool, $api->remove(1, 'Test-Wiki')); } - protected function getApiClass() + protected function getApiClass(): string { return Wiki::class; } From 2e70a0f8b33d3c7de30e4ee7427f78182bf24973 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 19:53:46 +0000 Subject: [PATCH 114/117] Update SECURITY.md --- .github/SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 017f9671..7236d4b1 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -3,7 +3,7 @@ ## Supported Versions After each new major release, the previous release will be supported for no -less than 2 years, unless explictly stated otherwise. This may mean that there +less than 2 years, unless explicitly stated otherwise. This may mean that there are multiple supported versions at any given time. ## Reporting a Vulnerability From 27eb0dd53924806e46e65e8918716f7b2cd0e00f Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 20:33:43 +0000 Subject: [PATCH 115/117] Get ready for release --- src/HttpClient/Plugin/History.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/HttpClient/Plugin/History.php b/src/HttpClient/Plugin/History.php index b138bd8b..5e41ca93 100644 --- a/src/HttpClient/Plugin/History.php +++ b/src/HttpClient/Plugin/History.php @@ -30,6 +30,14 @@ final class History implements Journal { private ?ResponseInterface $lastResponse; + public function __construct() + { + $this->lastResponse = null; + } + + /** + * Get the last response. + */ public function getLastResponse(): ?ResponseInterface { return $this->lastResponse; From 362450ff932296bc15796f97da8cf57941650037 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 23 Feb 2025 20:36:49 +0000 Subject: [PATCH 116/117] Release 12.0.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc32cd98..65398fb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [12.0.0] - UPCOMING +## [12.0.0] - 2025-02-23 * Add PHP 8.4 support * Drop support for PHP earlier than 8.1 From 1bf53260712eb03174df3a242529b0684a6ec13b Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 24 Mar 2025 12:11:30 +0000 Subject: [PATCH 117/117] CS fixes --- tests/Api/ProjectsTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 1ef556ea..62b5dfcc 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -713,8 +713,8 @@ public function shouldGetPipelineWithDateParam(): void ['id' => 3, 'status' => 'pending', 'ref' => 'test-pipeline'], ]; - $updated_after = new \DateTime('2018-01-01 00:00:00'); - $updated_before = new \DateTime('2018-01-31 00:00:00'); + $updated_after = new DateTime('2018-01-01 00:00:00'); + $updated_before = new DateTime('2018-01-31 00:00:00'); $expectedWithArray = [ 'updated_after' => $updated_after->format('Y-m-d'), @@ -1515,8 +1515,8 @@ public function shouldGetEventsWithDateTimeParams(): void ['id' => 2, 'title' => 'Another event'], ]; - $after = new \DateTime('2018-01-01 00:00:00'); - $before = new \DateTime('2018-01-31 00:00:00'); + $after = new DateTime('2018-01-01 00:00:00'); + $before = new DateTime('2018-01-31 00:00:00'); $expectedWithArray = [ 'after' => $after->format('Y-m-d'), @@ -1757,8 +1757,8 @@ public function shouldGetForksUsingParameters(): void ], ], ]; - $updated_after = new \DateTime('2018-01-01 00:00:00'); - $updated_before = new \DateTime('2018-01-31 00:00:00'); + $updated_after = new DateTime('2018-01-01 00:00:00'); + $updated_before = new DateTime('2018-01-31 00:00:00'); $api = $this->getApiMock(); $api->expects($this->once())