Skip to content

Commit 9516b2a

Browse files
author
Valerii Maslenykov
committed
Merge branch 'feature/adapt-to-specification'
2 parents 5fa60e8 + 84f3bf8 commit 9516b2a

31 files changed

+545
-93
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ jobs:
2626
run: composer install --no-interaction
2727

2828
- name: Lint code
29-
run: ./vendor/bin/phpcs --standard=PSR12 ./src ./tests
29+
run: composer run lint
30+
31+
- name: PHPStan
32+
run: composer run phpstan
3033

3134
test:
3235
runs-on: ${{ matrix.os }}

.php-cs-fixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
$finder = PhpCsFixer\Finder::create()
4-
->in([__DIR__ . '/src', __DIR__ . '/tests']);
4+
->in([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/examples']);
55

66
$config = new PhpCsFixer\Config();
77
return $config->setRules([

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Source code with the implementation of getContents and getContent
13+
- Flexible caching with PSR-16
14+
- Custom HTTP client with PSR-18
15+
- Examples
16+
- Documentation (README.md)
17+
- GitHub Actions pipeline to check code style + Unit Testing at different PHP versions + different platforms
18+

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"require-dev": {
3838
"guzzlehttp/guzzle": "^7.5",
3939
"phpspec/prophecy": "^1.17",
40+
"phpstan/phpstan": "^1.10",
4041
"phpunit/phpunit": "^8.5",
4142
"squizlabs/php_codesniffer": "^3.7"
4243
},
@@ -54,7 +55,9 @@
5455
"scripts": {
5556
"test": "vendor/bin/phpunit",
5657
"test-coverage": "vendor/bin/phpunit --coverage-html coverage",
57-
"lint": "./vendor/bin/phpcs --standard=./phpcs.xml ./src ./tests",
58+
"lint": "./vendor/bin/phpcs --standard=./phpcs.xml ./src ./tests ./examples",
59+
"phpstan": " vendor/bin/phpstan analyse -c ./phpstan-src.neon && vendor/bin/phpstan analyse -c ./phpstan-tests.neon",
60+
"dev-test": "composer run test-coverage && composer run lint && composer run phpstan",
5861
"lint-fix": "./tools/php-cs-fixer/vendor/bin/php-cs-fixer fix"
5962
},
6063
"config": {

composer.lock

Lines changed: 60 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/custom-http-client/PerformanceMeasurementClient.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<?php
22

3+
declare(strict_types=1);
4+
5+
namespace JoystickCustomHttpClient;
6+
37
use Psr\Http\Client\ClientInterface;
48
use Psr\Http\Message\RequestInterface;
59
use Psr\Http\Message\ResponseInterface;
610
use Symfony\Component\HttpClient\Psr18Client;
711

8-
912
class PerformanceMeasurementClient implements ClientInterface
1013
{
1114
private $httpClient;

examples/custom-http-client/main.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Symfony\Component\HttpClient\HttpClient;
46
use Symfony\Component\HttpClient\Psr18Client;
57

examples/helpers/get-content-ids.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
<?php
1+
<?php
22

3-
function getContentIdsFromEnv() {
3+
declare(strict_types=1);
4+
5+
function getContentIdsFromEnv()
6+
{
47
return explode(',', getenv('CONTENT_IDS'));
5-
}
8+
}

examples/zero-configuration/main.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
// Uses library from the parent folder, not from the packagist or repository
46
require(__DIR__ . '/../../vendor/autoload.php');
57
require(__DIR__ . '/../helpers/get-content-ids.php');

phpstan-src.neon

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
ignoreErrors:
3+
- '#.+is not subtype of Throwable#'
4+
level: 9
5+
paths:
6+
- src
7+

0 commit comments

Comments
 (0)