Skip to content

Commit 6da5dfa

Browse files
authored
Merge pull request #46 from j0k3r/fix/typing
Fixing types
2 parents d316f2e + a6bd0ef commit 6da5dfa

9 files changed

+25
-29
lines changed

.gitattributes

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/.editorconfig export-ignore
22
/.gitattributes export-ignore
33
/.gitignore export-ignore
4-
/.scrutinizer.yml export-ignore
5-
/.php_cs export-ignore
4+
/.php-cs-fixer.php export-ignore
5+
/phpstan.neon export-ignore
66
/phpunit.xml.dist export-ignore
77
/tests export-ignore
88
/.github export-ignore

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
# Check for updates to GitHub Actions every week
7+
interval: "weekly"

.github/workflows/coding-standards.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: "Checkout"
23-
uses: "actions/checkout@v2"
23+
uses: "actions/checkout@v4"
2424

2525
- name: "Install PHP"
2626
uses: "shivammathur/setup-php@v2"
@@ -33,7 +33,7 @@ jobs:
3333
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3434

3535
- name: "Install dependencies with Composer"
36-
uses: "ramsey/composer-install@v1"
36+
uses: "ramsey/composer-install@v2"
3737

3838
- name: "Run PHP CS Fixer"
3939
run: "vendor/bin/php-cs-fixer fix --verbose --dry-run"

.github/workflows/continuous-integration.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ jobs:
2222
- "7.4"
2323
- "8.0"
2424
- "8.1"
25+
- "8.2"
2526

2627
steps:
2728
- name: "Checkout"
28-
uses: "actions/checkout@v2"
29+
uses: "actions/checkout@v4"
2930
with:
3031
fetch-depth: 2
3132

@@ -41,7 +42,7 @@ jobs:
4142
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4243

4344
- name: "Install dependencies with Composer"
44-
uses: "ramsey/composer-install@v1"
45+
uses: "ramsey/composer-install@v2"
4546

4647
- name: "Run PHPUnit"
4748
run: "php vendor/bin/simple-phpunit -v"
@@ -57,7 +58,7 @@ jobs:
5758

5859
steps:
5960
- name: "Checkout"
60-
uses: "actions/checkout@v2"
61+
uses: "actions/checkout@v4"
6162
with:
6263
fetch-depth: 2
6364

@@ -73,7 +74,7 @@ jobs:
7374
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7475

7576
- name: "Install dependencies with Composer"
76-
uses: "ramsey/composer-install@v1"
77+
uses: "ramsey/composer-install@v2"
7778

7879
- name: "Setup logs"
7980
run: "mkdir -p build/logs"

.scrutinizer.yml

-15
This file was deleted.

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
![CI](https://github.com/j0k3r/php-imgur-api-client/workflows/CI/badge.svg)
44
[![Coverage Status](https://coveralls.io/repos/j0k3r/php-imgur-api-client/badge.svg?branch=master&service=github)](https://coveralls.io/github/j0k3r/php-imgur-api-client?branch=master)
5-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/j0k3r/php-imgur-api-client/badges/quality-score.png?branch=master)](https://scrutinizer-ci.com/g/j0k3r/php-imgur-api-client/?branch=master)
65
[![Total Downloads](https://poser.pugx.org/j0k3r/php-imgur-api-client/downloads)](https://packagist.org/packages/j0k3r/php-imgur-api-client)
76
[![License](https://poser.pugx.org/j0k3r/php-imgur-api-client/license)](https://packagist.org/packages/j0k3r/php-imgur-api-client)
87

lib/Imgur/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function getOption(string $name): ?string
9797
/**
9898
* @throws InvalidArgumentException
9999
*/
100-
public function setOption(string $name, $value): void
100+
public function setOption(string $name, string $value = null): void
101101
{
102102
if (!\array_key_exists($name, $this->options)) {
103103
throw new InvalidArgumentException(sprintf('Undefined option called: "%s"', $name));

tests/Api/ApiTestCase.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,13 @@ protected function getApiTopicMock()
8989
}
9090

9191
/**
92-
* @param class-string $class
92+
* @template T of object
93+
*
94+
* @param class-string<T> $className
95+
*
96+
* @return T&MockObject
9397
*/
94-
private function getApiMock($class)
98+
private function getApiMock($className): object
9599
{
96100
$httpClient = $this->getMockBuilder('Imgur\HttpClient\HttpClient')
97101
->disableOriginalConstructor()
@@ -111,7 +115,7 @@ private function getApiMock($class)
111115

112116
$client = new Client(null, $httpClient);
113117

114-
return $this->getMockBuilder($class)
118+
return $this->getMockBuilder($className)
115119
->onlyMethods(['get', 'post', 'put', 'delete'])
116120
->setConstructorArgs([$client])
117121
->getMock();

tests/ClientTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function testGetAuthenticationUrl(): void
139139
// $this->assertSame('https://api.imgur.com/oauth2/authorize?response_type=code&state=draft', $client->getAuthenticationUrl('code', 'draft'));
140140

141141
$client = new Client();
142-
$client->setOption('client_id', 123);
142+
$client->setOption('client_id', '123');
143143
$client->setOption('client_secret', 'xx');
144144
$this->assertSame('https://api.imgur.com/oauth2/authorize?client_id=123&response_type=pin', $client->getAuthenticationUrl('pin'));
145145
$this->assertSame('https://api.imgur.com/oauth2/authorize?client_id=123&response_type=code', $client->getAuthenticationUrl());

0 commit comments

Comments
 (0)