Skip to content

Commit 5ce17e1

Browse files
Working on next version
1 parent 16f80f2 commit 5ce17e1

File tree

12 files changed

+52
-154
lines changed

12 files changed

+52
-154
lines changed

.styleci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ enabled:
1616
disabled:
1717
- native_constant_invocation_symfony
1818
- native_function_invocation_symfony
19-
- no_superfluous_phpdoc_tags_symfony
2019
- phpdoc_align
2120
- phpdoc_to_comment
2221
- phpdoc_var_without_name

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [11.15.0] - UPCOMING
8+
## [12.0.0] - UPCOMING
99

10-
* TBC
10+
* Drop support for PHP earlier than 8.1
1111

1212
## [11.14.0] - 2024-03-11
1313

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,21 @@ This version supports [PHP](https://php.net) 7.4-8.3. To get started, simply req
2828
### Standard Installation
2929

3030
```bash
31-
$ composer require "m4tthumphrey/php-gitlab-api:^11.15" \
32-
"guzzlehttp/guzzle:^7.8" "http-interop/http-factory-guzzle:^1.2"
31+
$ composer require "m4tthumphrey/php-gitlab-api:^12.0" "guzzlehttp/guzzle:^7.9.2"
3332
```
3433

3534
### Framework Integration
3635

3736
#### Laravel:
3837

3938
```bash
40-
$ composer require "graham-campbell/gitlab:^7.6"
39+
$ composer require "graham-campbell/gitlab:^8.0"
4140
```
4241

4342
#### Symfony:
4443

4544
```bash
46-
$ composer require "zeichen32/gitlabapibundle:^6.1"
45+
$ composer require "zeichen32/gitlabapibundle:^7.0"
4746
```
4847

4948
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);
9695
$client = new Gitlab\Client($builder);
9796
```
9897

99-
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).
98+
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).
10099

101100

102101
## Contributing

composer.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,23 @@
2626
}
2727
],
2828
"require": {
29-
"php": "^7.4.15 || ^8.0.2",
29+
"php": "^8.1",
3030
"ext-json": "*",
3131
"ext-xml": "*",
32-
"php-http/cache-plugin": "^1.8.1 || ^2.0",
33-
"php-http/client-common": "^2.7.1",
34-
"php-http/discovery": "^1.19.2",
35-
"php-http/httplug": "^2.4",
36-
"php-http/multipart-stream-builder": "^1.3",
37-
"psr/cache": "^1.0 || ^2.0 || ^3.0",
32+
"php-http/cache-plugin": "^2.0.1",
33+
"php-http/client-common": "^2.7.2",
34+
"php-http/discovery": "^1.20.0",
35+
"php-http/httplug": "^2.4.1",
36+
"php-http/multipart-stream-builder": "^1.4.2",
37+
"psr/cache": "^2.0 || ^3.0",
3838
"psr/http-client-implementation": "^1.0",
3939
"psr/http-factory-implementation": "^1.0",
4040
"psr/http-message": "^1.1 || ^2.0",
41-
"symfony/options-resolver": "^4.4 || ^5.0 || ^6.0 || ^7.0",
42-
"symfony/polyfill-php80": "^1.26"
41+
"symfony/options-resolver": "^5.4 || ^6.0 || ^7.0"
4342
},
4443
"require-dev": {
4544
"bamarni/composer-bin-plugin": "^1.8.2",
46-
"guzzlehttp/guzzle": "^7.8",
47-
"http-interop/http-factory-guzzle": "^1.2"
45+
"guzzlehttp/guzzle": "^7.9.2"
4846
},
4947
"autoload": {
5048
"psr-4": {

src/Api/AbstractApi.php

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,14 @@ abstract class AbstractApi
4848
*/
4949
protected const ACCESS_LEVELS = [0, 10, 20, 30, 40, 50];
5050

51-
/**
52-
* The client instance.
53-
*
54-
* @var Client
55-
*/
56-
private $client;
51+
private readonly Client $client;
5752

58-
/**
59-
* The per page parameter.
60-
*
61-
* @var int|null
62-
*/
63-
private $perPage;
53+
private ?int $perPage;
6454

65-
/**
66-
* Create a new API instance.
67-
*
68-
* @param Client $client
69-
*
70-
* @return void
71-
*/
7255
public function __construct(Client $client)
7356
{
7457
$this->client = $client;
58+
$this->perPage = null;
7559
}
7660

7761
/**

src/Api/Groups.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function show($id)
9191
*
9292
* @return mixed
9393
*/
94-
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)
94+
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)
9595
{
9696
$params = [
9797
'name' => $name,
@@ -917,7 +917,7 @@ private function getSubgroupSearchResolver()
917917
*
918918
* @return mixed
919919
*/
920-
public function deployTokens($group_id, bool $active = null)
920+
public function deployTokens($group_id, ?bool $active = null)
921921
{
922922
return $this->get('groups/'.self::encodePath($group_id).'/deploy_tokens', (null !== $active) ? ['active' => $active] : []);
923923
}

src/Api/Projects.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public function pipelineTestReportSummary($project_id, int $pipeline_id)
466466
*
467467
* @return mixed
468468
*/
469-
public function createPipeline($project_id, string $commit_ref, array $variables = null)
469+
public function createPipeline($project_id, string $commit_ref, ?array $variables = null)
470470
{
471471
$parameters = [];
472472

@@ -588,7 +588,7 @@ public function allMember($project_id, int $user_id)
588588
*
589589
* @return mixed
590590
*/
591-
public function addMember($project_id, int $user_id, int $access_level, string $expires_at = null)
591+
public function addMember($project_id, int $user_id, int $access_level, ?string $expires_at = null)
592592
{
593593
$params = [
594594
'user_id' => $user_id,
@@ -609,7 +609,7 @@ public function addMember($project_id, int $user_id, int $access_level, string $
609609
*
610610
* @return mixed
611611
*/
612-
public function saveMember($project_id, int $user_id, int $access_level, string $expires_at = null)
612+
public function saveMember($project_id, int $user_id, int $access_level, ?string $expires_at = null)
613613
{
614614
$params = [
615615
'access_level' => $access_level,
@@ -868,7 +868,7 @@ public function enableDeployKey($project_id, int $key_id)
868868
*
869869
* @return mixed
870870
*/
871-
public function deployTokens($project_id, bool $active = null)
871+
public function deployTokens($project_id, ?bool $active = null)
872872
{
873873
return $this->get($this->getProjectPath($project_id, 'deploy_tokens'), (null !== $active) ? ['active' => $active] : []);
874874
}

src/Api/Repositories.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ public function postCommitBuildStatus($project_id, string $sha, string $state, a
419419
*
420420
* @return mixed
421421
*/
422-
public function compare($project_id, string $fromShaOrMaster, string $toShaOrMaster, bool $straight = false, string $fromProjectId = null)
422+
public function compare($project_id, string $fromShaOrMaster, string $toShaOrMaster, bool $straight = false, ?string $fromProjectId = null)
423423
{
424424
$params = [
425425
'from' => $fromShaOrMaster,

src/Client.php

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,30 +100,12 @@ class Client
100100
*
101101
* @var string
102102
*/
103-
private const USER_AGENT = 'gitlab-php-api-client/11.15';
103+
private const USER_AGENT = 'gitlab-php-api-client/12.0';
104104

105-
/**
106-
* The HTTP client builder.
107-
*
108-
* @var Builder
109-
*/
110-
private $httpClientBuilder;
111-
112-
/**
113-
* The response history plugin.
114-
*
115-
* @var History
116-
*/
117-
private $responseHistory;
105+
private readonly Builder $httpClientBuilder;
106+
private readonly History $responseHistory;
118107

119-
/**
120-
* Instantiate a new Gitlab client.
121-
*
122-
* @param Builder|null $httpClientBuilder
123-
*
124-
* @return void
125-
*/
126-
public function __construct(Builder $httpClientBuilder = null)
108+
public function __construct(?Builder $httpClientBuilder = null)
127109
{
128110
$this->httpClientBuilder = $builder = $httpClientBuilder ?? new Builder();
129111
$this->responseHistory = new History();
@@ -425,7 +407,7 @@ public function wiki(): Wiki
425407
*
426408
* @return void
427409
*/
428-
public function authenticate(string $token, string $authMethod, string $sudo = null): void
410+
public function authenticate(string $token, string $authMethod, ?string $sudo = null): void
429411
{
430412
$this->getHttpClientBuilder()->removePlugin(Authentication::class);
431413
$this->getHttpClientBuilder()->addPlugin(new Authentication($authMethod, $token, $sudo));

src/HttpClient/Builder.php

Lines changed: 15 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -38,77 +38,34 @@
3838
*/
3939
final class Builder
4040
{
41-
/**
42-
* The object that sends HTTP messages.
43-
*
44-
* @var ClientInterface
45-
*/
46-
private $httpClient;
47-
48-
/**
49-
* The HTTP request factory.
50-
*
51-
* @var RequestFactoryInterface
52-
*/
53-
private $requestFactory;
54-
55-
/**
56-
* The HTTP stream factory.
57-
*
58-
* @var StreamFactoryInterface
59-
*/
60-
private $streamFactory;
61-
62-
/**
63-
* The URI factory.
64-
*
65-
* @var UriFactoryInterface
66-
*/
67-
private $uriFactory;
41+
private readonly ClientInterface $httpClient;
42+
private readonly RequestFactoryInterface $requestFactory;
43+
private readonly StreamFactoryInterface $streamFactory;
44+
private readonly UriFactoryInterface $uriFactory;
6845

6946
/**
70-
* The currently registered plugins.
71-
*
7247
* @var Plugin[]
7348
*/
74-
private $plugins = [];
49+
private array $plugins = [];
7550

76-
/**
77-
* The cache plugin to use.
78-
*
79-
* This plugin is specially treated because it has to be the very last plugin.
80-
*
81-
* @var CachePlugin|null
82-
*/
83-
private $cachePlugin;
51+
private ?CachePlugin $cachePlugin;
8452

85-
/**
86-
* A HTTP client with all our plugins.
87-
*
88-
* @var HttpMethodsClientInterface|null
89-
*/
90-
private $pluginClient;
53+
private ?HttpMethodsClientInterface $pluginClient;
9154

92-
/**
93-
* Create a new http client builder instance.
94-
*
95-
* @param ClientInterface|null $httpClient
96-
* @param RequestFactoryInterface|null $requestFactory
97-
* @param StreamFactoryInterface|null $streamFactory
98-
* @param UriFactoryInterface|null $uriFactory
99-
*
100-
* @return void
101-
*/
10255
public function __construct(
103-
ClientInterface $httpClient = null,
104-
RequestFactoryInterface $requestFactory = null,
105-
StreamFactoryInterface $streamFactory = null,
106-
UriFactoryInterface $uriFactory = null
56+
?ClientInterface $httpClient = null,
57+
?RequestFactoryInterface $requestFactory = null,
58+
?StreamFactoryInterface $streamFactory = null,
59+
?UriFactoryInterface $uriFactory = null
10760
) {
10861
$this->httpClient = $httpClient ?? Psr18ClientDiscovery::find();
10962
$this->requestFactory = $requestFactory ?? Psr17FactoryDiscovery::findRequestFactory();
11063
$this->streamFactory = $streamFactory ?? Psr17FactoryDiscovery::findStreamFactory();
11164
$this->uriFactory = $uriFactory ?? Psr17FactoryDiscovery::findUriFactory();
65+
66+
$this->plugins = [];
67+
$this->cachePlugin = null;
68+
$this->pluginClient = null;
11269
}
11370

11471
/**

0 commit comments

Comments
 (0)