Skip to content

Commit 30796e3

Browse files
authored
Merge pull request #45 from packagist/t/php8
PHP8 support
2 parents db13f01 + 1c150a2 commit 30796e3

28 files changed

+234
-180
lines changed

.github/workflows/php.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "master"
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
php-version:
17+
- "7.2"
18+
- "7.3"
19+
- "7.4"
20+
- "8.0"
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: "Install PHP"
26+
uses: "shivammathur/setup-php@v2"
27+
with:
28+
coverage: "none"
29+
ini-values: "memory_limit=-1, phar.readonly=0"
30+
php-version: "${{ matrix.php-version }}"
31+
32+
- name: Validate composer.json
33+
run: composer validate
34+
35+
- name: Install dependencies
36+
run: composer install --prefer-dist --no-progress --no-suggest
37+
38+
- name: PHPUnit
39+
run: ./vendor/bin/phpunit tests
40+
41+
- name: PHP-CS-Fixer
42+
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.php_cs.cache
2+
.php-cs-fixer.cache
23
vendor
34
composer.lock
45

.php-cs-fixer.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->files()
5+
->in(__DIR__.'/src')
6+
->in(__DIR__.'/tests')
7+
->name('*.php')
8+
;
9+
10+
return (new PhpCsFixer\Config())
11+
->setUsingCache(true)
12+
->setRiskyAllowed(true)
13+
->setRules(array(
14+
'@PSR2' => true,
15+
))
16+
->setFinder($finder)
17+
;

.travis.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108

109109
## Requirements
110110

111-
* PHP >= 5.6
111+
* PHP >= 7.2
112112
* [Guzzle](https://github.com/guzzle/guzzle) library,
113113

114114
## Install

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^5.6 || ^7.0",
14+
"php": "^7.2 || ^8.0",
1515
"psr/http-message": "^1.0",
1616
"php-http/httplug": "^1.1 || ^2.0",
1717
"php-http/discovery": "^1.0",
@@ -20,12 +20,12 @@
2020
"composer-runtime-api": "^2.0"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^5.5 || ^7.0",
23+
"phpunit/phpunit": "^8.0 || ^9.0",
2424
"php-http/guzzle6-adapter": "^1.0 || ^2.0",
2525
"php-http/mock-client": "^1.0",
2626
"guzzlehttp/psr7": "^1.2",
27-
"cache/array-adapter": "^0.4",
28-
"friendsofphp/php-cs-fixer": "^2.10"
27+
"cache/array-adapter": "^1.1.0",
28+
"friendsofphp/php-cs-fixer": "^3.0"
2929
},
3030
"autoload": {
3131
"psr-4": { "PrivatePackagist\\ApiClient\\": "src/" }

src/Exception/JobTimeoutException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44

55
class JobTimeoutException extends RuntimeException
66
{
7-
87
}

tests/Api/ApiTestCase.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace PrivatePackagist\ApiClient\Api;
1111

1212
use Http\Client\HttpClient;
13+
use PHPUnit\Framework\MockObject\MockObject;
1314
use PHPUnit\Framework\TestCase;
1415
use PrivatePackagist\ApiClient\Client;
1516
use PrivatePackagist\ApiClient\HttpClient\HttpPluginClientBuilder;
@@ -22,11 +23,11 @@ abstract class ApiTestCase extends TestCase
2223
abstract protected function getApiClass();
2324

2425
/**
25-
* @return \PHPUnit_Framework_MockObject_MockObject
26+
* @return MockObject
2627
*/
2728
protected function getApiMock()
2829
{
29-
/** @var HttpClient&\PHPUnit_Framework_MockObject_MockObject $httpClient */
30+
/** @var HttpClient&MockObject $httpClient */
3031
$httpClient = $this->getMockBuilder(HttpClient::class)
3132
->setMethods(['sendRequest'])
3233
->getMock();

tests/Api/CredentialsTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace PrivatePackagist\ApiClient\Api;
1111

12+
use PHPUnit\Framework\MockObject\MockObject;
13+
1214
class CredentialsTest extends ApiTestCase
1315
{
1416
public function testAll()
@@ -24,7 +26,7 @@ public function testAll()
2426
],
2527
];
2628

27-
/** @var Customers&\PHPUnit_Framework_MockObject_MockObject $api */
29+
/** @var Credentials&MockObject $api */
2830
$api = $this->getApiMock();
2931
$api->expects($this->once())
3032
->method('get')
@@ -45,7 +47,7 @@ public function testShow()
4547
'type' => 'http-basic',
4648
];
4749

48-
/** @var Customers&\PHPUnit_Framework_MockObject_MockObject $api */
50+
/** @var Credentials&MockObject $api */
4951
$api = $this->getApiMock();
5052
$api->expects($this->once())
5153
->method('get')
@@ -66,7 +68,7 @@ public function testCreate()
6668
'type' => 'http-basic',
6769
];
6870

69-
/** @var Customers&\PHPUnit_Framework_MockObject_MockObject $api */
71+
/** @var Credentials&MockObject $api */
7072
$api = $this->getApiMock();
7173
$api->expects($this->once())
7274
->method('post')
@@ -87,7 +89,7 @@ public function testEdit()
8789
'type' => 'http-basic',
8890
];
8991

90-
/** @var Customers&\PHPUnit_Framework_MockObject_MockObject $api */
92+
/** @var Credentials&MockObject $api */
9193
$api = $this->getApiMock();
9294
$api->expects($this->once())
9395
->method('put')
@@ -101,7 +103,7 @@ public function testRemove()
101103
{
102104
$expected = [];
103105

104-
/** @var Customers&\PHPUnit_Framework_MockObject_MockObject $api */
106+
/** @var Credentials&MockObject $api */
105107
$api = $this->getApiMock();
106108
$api->expects($this->once())
107109
->method('delete')

tests/Api/Customers/MagentoLegacyKeysTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace PrivatePackagist\ApiClient\Api\Customers;
1111

12+
use PHPUnit\Framework\MockObject\MockObject;
1213
use PrivatePackagist\ApiClient\Api\ApiTestCase;
1314

1415
class MagentoLegacyKeysTest extends ApiTestCase
@@ -22,7 +23,7 @@ public function testAll()
2223
],
2324
];
2425

25-
/** @var MagentoLegacyKeys&\PHPUnit_Framework_MockObject_MockObject $api */
26+
/** @var MagentoLegacyKeys&MockObject $api */
2627
$api = $this->getApiMock();
2728
$api->expects($this->once())
2829
->method('get')
@@ -39,7 +40,7 @@ public function testCreate()
3940
'privateKey' => 'private-fjdgkfdgk233443554mn45',
4041
];
4142

42-
/** @var MagentoLegacyKeys&\PHPUnit_Framework_MockObject_MockObject $api */
43+
/** @var MagentoLegacyKeys&MockObject $api */
4344
$api = $this->getApiMock();
4445
$api->expects($this->once())
4546
->method('post')
@@ -53,7 +54,7 @@ public function testRemove()
5354
{
5455
$expected = [];
5556

56-
/** @var MagentoLegacyKeys&\PHPUnit_Framework_MockObject_MockObject $api */
57+
/** @var MagentoLegacyKeys&MockObject $api */
5758
$api = $this->getApiMock();
5859
$api->expects($this->once())
5960
->method('delete')

0 commit comments

Comments
 (0)