Skip to content

Commit

Permalink
Update for PHP 8.0 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardStyles authored Oct 7, 2021
1 parent 4a8babb commit 62984fa
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 30 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
}
],
"require": {
"guzzlehttp/guzzle": "^6.0.0"
"php": "^7.2.5 || ^8.0",
"guzzlehttp/guzzle": "^7.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.0.*"
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 1 addition & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
stopOnFailure="false">
<testsuites>
<testsuite name="Test Suite">
<directory suffix=".php">./tests/</directory>
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Documentation https://wonde.com/docs/api/1.0/

## Installation

Requires PHP 5.6.
Requires PHP 7.2.5+ (including PHP 8.0)

Using Composer:

```json
{
"require": {
"wondeltd/php-client": "1.*"
"wondeltd/php-client": "3.*"
}
}
```
Expand Down
7 changes: 6 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class Client
*/
public $meta;

/**
* @var Schools
*/
public $schools;

/**
* @var string
*/
Expand All @@ -31,7 +36,7 @@ class Client
/**
* @var string
*/
const version = '2.1.2';
const version = '3.0.0';

/**
* Client constructor.
Expand Down
23 changes: 6 additions & 17 deletions src/Endpoints/BootstrapEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,12 @@ public function __construct($token, $uri = false)
*/
private function client()
{
if ((float) Client::VERSION >= 6) {
return new Client([
'headers' => [
'Authorization' => 'Basic ' . base64_encode($this->token . ':'),
'User-Agent' => 'wonde-php-client-' . \Wonde\Client::version
]
]);
} else {
return new Client([
'defaults' => [
'headers' => [
'Authorization' => 'Basic ' . base64_encode($this->token . ':'),
'User-Agent' => 'wonde-php-client-' . \Wonde\Client::version
]
]
]);
}
return new Client([
'headers' => [
'Authorization' => 'Basic ' . base64_encode($this->token . ':'),
'User-Agent' => 'wonde-php-client-' . \Wonde\Client::version
]
]);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions tests/AssessmentTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php
use PHPUnit\Framework\TestCase;

class AssessmentTest extends PHPUnit_Framework_TestCase
class AssessmentTest extends TestCase
{
/**
* @var \Wonde\Endpoints\Schools
*/
public $school;

public function setUp()
public function setUp(): void
{
ini_set('memory_limit','3000M');
$client = new \Wonde\Client(file_get_contents(__DIR__ . '/../.token'));
Expand Down
5 changes: 3 additions & 2 deletions tests/MiscEndPointsRegionalDomainTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
use PHPUnit\Framework\TestCase;

class MiscEndPointsRegionalDomainTest extends PHPUnit_Framework_TestCase
class MiscEndPointsRegionalDomainTest extends TestCase
{
/**
* @var \Wonde\Endpoints\Schools
Expand All @@ -16,7 +17,7 @@ class MiscEndPointsRegionalDomainTest extends PHPUnit_Framework_TestCase
*/
private $client;

public function setUp()
public function setUp(): void
{
ini_set('memory_limit', '3000M');
$this->token = file_get_contents(__DIR__ . '/../.token');
Expand Down
5 changes: 3 additions & 2 deletions tests/MiscEndPointsTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
use PHPUnit\Framework\TestCase;

class MiscEndPointsTest extends PHPUnit_Framework_TestCase
class MiscEndPointsTest extends TestCase
{
/**
* @var \Wonde\Endpoints\Schools
Expand All @@ -16,7 +17,7 @@ class MiscEndPointsTest extends PHPUnit_Framework_TestCase
*/
private $client;

public function setUp()
public function setUp(): void
{
ini_set('memory_limit', '3000M');
$this->token = file_get_contents(__DIR__ . '/../.token');
Expand Down

0 comments on commit 62984fa

Please sign in to comment.