Skip to content

Commit af83cbe

Browse files
committed
Refactored, min php version 7.1
1 parent c9d996c commit af83cbe

94 files changed

Lines changed: 833 additions & 644 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

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

.github/workflows/main.yml

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
name: 'build'
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
push:
8+
branches:
9+
- 'master'
10+
11+
env:
12+
extensions: 'json'
13+
cache-version: '1'
14+
composer-version: 'v2'
15+
composer-install: 'composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-stable'
16+
17+
jobs:
18+
coding_style:
19+
name: 'Coding style'
20+
runs-on: '${{ matrix.operating-system }}'
21+
22+
strategy:
23+
matrix:
24+
php-version: [ '7.4' ]
25+
operating-system: [ 'ubuntu-latest' ]
26+
fail-fast: false
27+
28+
steps:
29+
- name: 'Checkout'
30+
uses: 'actions/checkout@v2'
31+
32+
- name: 'Setup PHP cache environment'
33+
id: 'extcache'
34+
uses: 'shivammathur/cache-extensions@v1'
35+
with:
36+
php-version: '${{ matrix.php-version }}'
37+
extensions: '${{ env.extensions }}'
38+
key: '${{ env.cache-version }}'
39+
40+
- name: 'Cache PHP extensions'
41+
uses: 'actions/cache@v2'
42+
with:
43+
path: '${{ steps.extcache.outputs.dir }}'
44+
key: '${{ steps.extcache.outputs.key }}'
45+
restore-keys: '${{ steps.extcache.outputs.key }}'
46+
47+
- name: 'Install PHP'
48+
uses: 'shivammathur/setup-php@v2'
49+
with:
50+
php-version: '${{ matrix.php-version }}'
51+
extensions: '${{ env.extensions }}'
52+
tools: 'composer:${{ env.composer-version }}'
53+
54+
- name: "Setup problem matchers for PHP"
55+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
56+
57+
- name: 'Get Composer cache directory'
58+
id: 'composercache'
59+
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
60+
61+
- name: 'Cache PHP dependencies'
62+
uses: "actions/cache@v2"
63+
with:
64+
path: '${{ steps.composercache.outputs.dir }}'
65+
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
66+
restore-keys: '${{ runner.os }}-composer-'
67+
68+
- name: 'Validate Composer'
69+
run: 'composer validate'
70+
71+
- name: 'Install dependencies'
72+
run: '${{ env.composer-install }}'
73+
74+
- name: 'Coding Standard'
75+
run: 'bin/cs'
76+
77+
php_stan:
78+
name: 'PHP Stan'
79+
runs-on: '${{ matrix.operating-system }}'
80+
81+
strategy:
82+
matrix:
83+
php-version: [ '7.4' ]
84+
operating-system: [ 'ubuntu-latest' ]
85+
fail-fast: false
86+
87+
steps:
88+
- name: 'Checkout'
89+
uses: 'actions/checkout@v2'
90+
91+
- name: 'Setup PHP cache environment'
92+
id: 'extcache'
93+
uses: 'shivammathur/cache-extensions@v1'
94+
with:
95+
php-version: '${{ matrix.php-version }}'
96+
extensions: '${{ env.extensions }}'
97+
key: '${{ env.cache-version }}'
98+
99+
- name: 'Cache PHP extensions'
100+
uses: 'actions/cache@v2'
101+
with:
102+
path: '${{ steps.extcache.outputs.dir }}'
103+
key: '${{ steps.extcache.outputs.key }}'
104+
restore-keys: '${{ steps.extcache.outputs.key }}'
105+
106+
- name: 'Install PHP'
107+
uses: 'shivammathur/setup-php@v2'
108+
with:
109+
php-version: '${{ matrix.php-version }}'
110+
extensions: '${{ env.extensions }}'
111+
tools: 'composer:${{ env.composer-version }}'
112+
113+
- name: 'Setup problem matchers for PHP'
114+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
115+
116+
- name: 'Get Composer cache directory'
117+
id: 'composercache'
118+
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
119+
120+
- name: 'Cache PHP dependencies'
121+
uses: 'actions/cache@v2'
122+
with:
123+
path: '${{ steps.composercache.outputs.dir }}'
124+
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
125+
restore-keys: '${{ runner.os }}-composer-'
126+
127+
- name: 'Install dependencies'
128+
run: '${{ env.composer-install }}'
129+
130+
- name: 'PHPStan'
131+
run: 'bin/stan'
132+
133+
tests:
134+
name: 'Tests'
135+
runs-on: '${{ matrix.operating-system }}'
136+
137+
strategy:
138+
matrix:
139+
php-version: [ '7.1', '7.2', '7.3', '7.4', '8.0' ]
140+
operating-system: [ 'ubuntu-latest' ]
141+
composer-args: [ '' ]
142+
143+
fail-fast: false
144+
145+
steps:
146+
- name: 'Checkout'
147+
uses: 'actions/checkout@v2'
148+
149+
- name: 'Setup PHP cache environment'
150+
id: 'extcache'
151+
uses: 'shivammathur/cache-extensions@v1'
152+
with:
153+
php-version: '${{ matrix.php-version }}'
154+
extensions: '${{ env.extensions }}'
155+
key: '${{ env.cache-version }}'
156+
157+
- name: 'Cache PHP extensions'
158+
uses: 'actions/cache@v2'
159+
with:
160+
path: '${{ steps.extcache.outputs.dir }}'
161+
key: '${{ steps.extcache.outputs.key }}'
162+
restore-keys: '${{ steps.extcache.outputs.key }}'
163+
164+
- name: 'Install PHP'
165+
uses: 'shivammathur/setup-php@v2'
166+
with:
167+
php-version: '${{ matrix.php-version }}'
168+
extensions: '${{ env.extensions }}'
169+
tools: 'composer:${{ env.composer-version }}'
170+
171+
- name: 'Setup problem matchers for PHP'
172+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
173+
174+
- name: 'Get Composer cache directory'
175+
id: 'composercache'
176+
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
177+
178+
- name: 'Cache PHP dependencies'
179+
uses: 'actions/cache@v2'
180+
with:
181+
path: '${{ steps.composercache.outputs.dir }}'
182+
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
183+
restore-keys: '${{ runner.os }}-composer-'
184+
185+
- name: 'Install dependencies'
186+
run: '${{ env.composer-install }} ${{ matrix.composer-args }}'
187+
188+
- name: 'Tests'
189+
run: 'vendor/bin/tester tests -C'
190+
191+
tests_code_coverage:
192+
name: 'Tests with code coverage'
193+
runs-on: '${{ matrix.operating-system }}'
194+
195+
strategy:
196+
matrix:
197+
php-version: [ '7.4' ]
198+
operating-system: [ 'ubuntu-latest' ]
199+
fail-fast: false
200+
201+
if: "github.event_name == 'push'"
202+
203+
steps:
204+
- name: 'Checkout'
205+
uses: 'actions/checkout@v2'
206+
207+
- name: 'Setup PHP cache environment'
208+
id: 'extcache'
209+
uses: 'shivammathur/cache-extensions@v1'
210+
with:
211+
php-version: '${{ matrix.php-version }}'
212+
extensions: '${{ env.extensions }}'
213+
key: '${{ env.cache-version }}'
214+
215+
- name: 'Cache PHP extensions'
216+
uses: 'actions/cache@v2'
217+
with:
218+
path: '${{ steps.extcache.outputs.dir }}'
219+
key: '${{ steps.extcache.outputs.key }}'
220+
restore-keys: '${{ steps.extcache.outputs.key }}'
221+
222+
- name: 'Install PHP'
223+
uses: 'shivammathur/setup-php@v2'
224+
with:
225+
php-version: '${{ matrix.php-version }}'
226+
extensions: '${{ env.extensions }}'
227+
tools: 'composer:${{ env.composer-version }}'
228+
229+
- name: 'Setup problem matchers for PHP'
230+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
231+
232+
- name: 'Get Composer cache directory'
233+
id: 'composercache'
234+
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
235+
236+
- name: 'Cache PHP dependencies'
237+
uses: 'actions/cache@v2'
238+
with:
239+
path: '${{ steps.composercache.outputs.dir }}'
240+
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
241+
restore-keys: '${{ runner.os }}-composer-'
242+
243+
- name: 'Install dependencies'
244+
run: '${{ env.composer-install }}'
245+
246+
- name: 'Tests'
247+
run: vendor/bin/tester tests -C --coverage coverage.xml --coverage-src src
248+
249+
- uses: codecov/codecov-action@v1
250+
with:
251+
token: ${{ secrets.CODECOV_TOKEN }}
252+
fail_ci_if_error: true

composer.json

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,32 @@
44
"type": "library",
55
"license": "MIT",
66
"authors": [
7-
{
8-
"name": "Jan-Sebastian Fabík",
9-
"email": "honza@fabik.org"
10-
},
117
{
128
"name": "Jiří Slischka",
139
"email": "slischkaj@gmail.com"
1410
}
1511
],
1612
"require": {
17-
"php": "^7.0",
13+
"php": ">=7.1",
1814
"fapi-cz/http-client": "^0.1"
1915
},
2016
"require-dev": {
21-
"nette/tester": "^2.1",
22-
"nette/di": "^2.4",
23-
"nette/utils": "^2.5",
24-
"guzzlehttp/guzzle": "^6.3",
25-
"tracy/tracy": "^2.5",
26-
"phpstan/phpstan-nette": "^0.10.1",
27-
"phpstan/phpstan": "^0.10.5",
28-
"slevomat/coding-standard": "^4.8"
17+
"nette/tester": ">=2.3",
18+
"nette/di": "^3.0",
19+
"nette/utils": "^3.1",
20+
"guzzlehttp/guzzle": "^6.3 | ^7.0",
21+
"tracy/tracy": ">=2.7",
22+
"phpstan/phpstan-nette": "^0.12.17",
23+
"phpstan/phpstan": "^0.12.85",
24+
"orisai/coding-standard": "^1.1",
25+
"phpstan/phpstan-strict-rules": "^0.12.9"
2926
},
3027
"suggest": {
3128
"nette/di": "to use class FapiClientExtension"
3229
},
3330
"autoload": {
3431
"psr-0": {
3532
"Fapi\\FapiClient\\": "src/"
36-
},
37-
"classmap": [
38-
"src/Fapi/FapiClient/exceptions.php",
39-
"src/Fapi/FapiClient/Rest/exceptions.php"
40-
]
33+
}
4134
}
4235
}

readme.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77
Library for accessing FAPI API.
88

99
## Requirements
10-
Library fapi-cz/fapi-client requires PHP 7.0 or higher and [fapi-cz/http-client](https://github.com/fapi-cz/http-client).
10+
Library fapi-cz/fapi-client requires PHP 7.1 or higher and [fapi-cz/http-client](https://github.com/fapi-cz/http-client).
1111

1212
## Installation
1313
The best way to install fapi-cz/fapi-client is using [Composer](http://getcomposer.org/).
1414

1515
Run command `composer require fapi-cz/fapi-client`.
1616

1717
## How to run tests
18-
1. Create file `tests/php.ini` (you can use file `php-unix.ini` or `php-win.ini` as a template).
19-
20-
2. Run command `vendor/bin/tester -c tests/php.ini tests`.
18+
Run command `vendor/bin/tester -C tests`.
2119

2220
## How to create client
2321
```php
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Fapi\FapiClient;
4+
5+
use InvalidArgumentException;
6+
7+
/**
8+
* The exception that is thrown when the value of an argument is
9+
* outside the allowable range of values as defined by the invoked method.
10+
*/
11+
class ArgumentOutOfRangeException extends InvalidArgumentException
12+
{
13+
14+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Fapi\FapiClient;
4+
5+
/**
6+
* The exception that is thrown when the user is not authorized for the performed action.
7+
*/
8+
class AuthorizationException extends RuntimeException
9+
{
10+
11+
}

0 commit comments

Comments
 (0)