Skip to content

Commit 253ab7f

Browse files
committed
Remove Safe dependency
1 parent 8781657 commit 253ab7f

File tree

7 files changed

+12
-41
lines changed

7 files changed

+12
-41
lines changed

.github/workflows/build.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
operating-system: [ubuntu-latest]
15-
php-versions: ['7.2', '7.3']
15+
php-versions: ['7.4']
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v1
18+
uses: actions/checkout@v4
1919
- name: Setup PHP, with composer and extensions
20-
uses: shivammathur/setup-php@master
20+
uses: shivammathur/setup-php@v2
2121
with:
2222
php-version: ${{ matrix.php-versions }}
23-
extension-csv: intl
23+
extensions: intl
2424
- name: Install Composer dependencies
2525
run: composer update --no-progress --no-suggest --prefer-dist --no-interaction
2626
- name: Validate composer

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A PHP SDK for the [DAO](http://www.dao.as) [API](https://api.dao.as/docs/).
1313
Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:
1414

1515
```bash
16-
$ composer require setono/dao-php-sdk
16+
composer require setono/dao-php-sdk
1717
```
1818

1919
This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md) of the Composer documentation.

composer.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
],
1212
"require": {
1313
"php": ">=7.4",
14+
"ext-json": "*",
1415
"psr/http-client": "^1.0",
1516
"psr/http-factory": "^1.0",
1617
"psr/http-message": "^1.0",
17-
"thecodingmachine/safe": "^1.0",
1818
"webmozart/assert": "^1.4"
1919
},
2020
"require-dev": {
@@ -26,11 +26,14 @@
2626
"phpstan/phpstan": "^0.12",
2727
"phpstan/phpstan-strict-rules": "^0.12",
2828
"phpunit/phpunit": "^8.0",
29-
"sylius-labs/coding-standard": "^3.1",
30-
"thecodingmachine/phpstan-safe-rule": "^1.0@beta"
29+
"sylius-labs/coding-standard": "^3.1"
3130
},
3231
"config": {
33-
"sort-packages": true
32+
"sort-packages": true,
33+
"allow-plugins": {
34+
"dealerdirect/phpcodesniffer-composer-installer": false,
35+
"ergebnis/composer-normalize": true
36+
}
3437
},
3538
"extra": {
3639
"branch-alias": {

phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
includes:
22
- vendor/korbeil/phpstan-generic-rules/extension.neon
33
- vendor/phpstan/phpstan-strict-rules/rules.neon
4-
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
54

65
parameters:
76
checkMissingIterableValueType: false

spec/Client/ClientSpec.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
use Psr\Http\Message\RequestInterface;
1313
use Psr\Http\Message\ResponseInterface;
1414
use Psr\Http\Message\StreamInterface;
15-
use Safe\Exceptions\JsonException;
16-
use Safe\Exceptions\StringsException;
1715
use Setono\DAO\Client\Client;
1816
use Setono\DAO\Client\ClientInterface;
1917
use Setono\DAO\Exception\ApiException;
@@ -42,11 +40,6 @@ public function it_implements_client_interface(): void
4240
$this->shouldImplement(ClientInterface::class);
4341
}
4442

45-
/**
46-
* @throws ClientExceptionInterface
47-
* @throws JsonException
48-
* @throws StringsException
49-
*/
5043
public function it_gets(
5144
HttpClientInterface $httpClient,
5245
RequestFactoryInterface $requestFactory,
@@ -70,9 +63,6 @@ public function it_gets(
7063
]);
7164
}
7265

73-
/**
74-
* @throws ClientExceptionInterface
75-
*/
7666
public function it_throws_not_ok_status_code_exception(
7767
HttpClientInterface $httpClient,
7868
RequestFactoryInterface $requestFactory,
@@ -88,10 +78,6 @@ public function it_throws_not_ok_status_code_exception(
8878
$this->shouldThrow(NotOkStatusCodeException::class)->during('get', ['endpoint']);
8979
}
9080

91-
/**
92-
* @throws ClientExceptionInterface
93-
* @throws StringsException
94-
*/
9581
public function it_throws_api_exception(
9682
HttpClientInterface $httpClient,
9783
RequestFactoryInterface $requestFactory,

src/Client/Client.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44

55
namespace Setono\DAO\Client;
66

7-
use InvalidArgumentException;
87
use const PHP_QUERY_RFC3986;
98
use Psr\Http\Client\ClientExceptionInterface;
109
use Psr\Http\Client\ClientInterface as HttpClientInterface;
1110
use Psr\Http\Message\RequestFactoryInterface;
12-
use Safe\Exceptions\JsonException;
13-
use Safe\Exceptions\StringsException;
14-
use function Safe\json_decode;
1511
use Setono\DAO\Exception\ApiException;
1612
use Setono\DAO\Exception\NotOkStatusCodeException;
1713
use Webmozart\Assert\Assert;
@@ -47,14 +43,6 @@ public function __construct(
4743
$this->baseUrl = $baseUrl;
4844
}
4945

50-
/**
51-
* {@inheritdoc}
52-
*
53-
* @throws ClientExceptionInterface
54-
* @throws JsonException
55-
* @throws StringsException
56-
* @throws InvalidArgumentException
57-
*/
5846
public function get(string $endpoint, array $params = []): array
5947
{
6048
Assert::notContains($endpoint, '?', 'Do not add query parameters to the endpoint. Instead use the third argument, $params');

src/Exception/RequestException.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
use Psr\Http\Message\RequestInterface;
88
use Psr\Http\Message\ResponseInterface;
99
use RuntimeException;
10-
use Safe\Exceptions\StringsException;
11-
use function Safe\sprintf;
1210

1311
abstract class RequestException extends RuntimeException
1412
{
@@ -21,9 +19,6 @@ abstract class RequestException extends RuntimeException
2119
/** @var int */
2220
private $statusCode;
2321

24-
/**
25-
* @throws StringsException
26-
*/
2722
public function __construct(RequestInterface $request, ResponseInterface $response, int $statusCode)
2823
{
2924
$this->request = $request;

0 commit comments

Comments
 (0)