Skip to content

Commit b773908

Browse files
mabarMilan Felix Šulc
authored andcommitted
Update build
1 parent 6d8d22a commit b773908

File tree

9 files changed

+85
-84
lines changed

9 files changed

+85
-84
lines changed

.docs/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
# HTTP
1+
# Contributte HTTP
22

33
## Content
44

5-
- [Curl - provides CurlExtension and simple cURL client](#curl)
6-
- [SAPI - provides SapiRequestExtension (fake request in console mode)](#sapi)
5+
- [Setup](#setup)
6+
- [Curl - simple http client (CurlExtension)](#curl)
7+
- [SAPI - fake request (CliRequestExtension)](#sapi)
78
- [BasicAuth - simple basic authentication](#basic-authentication)
8-
- Useful classes
9-
- [URL - extra methods](#url)
9+
- [Useful classes](#useful-classes)
10+
- [Url](#url)
11+
12+
## Setup
13+
14+
```bash
15+
composer require contributte/http
16+
```
1017

1118
## Curl
1219

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ tests export-ignore
55
.gitattributes export-ignore
66
.gitignore export-ignore
77
.travis.yml export-ignore
8+
Makefile export-ignore
89
phpstan.neon export-ignore
910
README.md export-ignore
1011
ruleset.xml export-ignore

.travis.yml

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,55 @@
11
language: php
22
php:
3-
- 7.1
43
- 7.2
54
- 7.3
5+
- 7.4snapshot
6+
- nightly
67

78
before_install:
8-
# Turn off XDebug
9-
- phpenv config-rm xdebug.ini || return 0
9+
- phpenv config-rm xdebug.ini || return 0 # Turn off XDebug
1010

1111
install:
12-
# Composer
13-
- travis_retry composer install --no-progress --prefer-dist
12+
- travis_retry composer install --no-progress --prefer-dist # Install dependencies
1413

1514
script:
16-
# Tests
17-
- composer run-script tests
15+
- make tests # Tests
1816

1917
after_failure:
20-
# Print *.actual content
21-
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
18+
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done # Print *.actual content
2219

2320
jobs:
2421
include:
25-
- env: title="Lowest Dependencies 7.1"
26-
php: 7.1
22+
- env: title="Lowest Dependencies 7.2"
23+
php: 7.2
2724
install:
28-
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest
25+
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable
2926
script:
30-
- composer run-script tests
27+
- make tests
3128

3229
- stage: Quality Assurance
33-
php: 7.1
30+
php: 7.3
3431
script:
35-
- composer run-script qa
36-
37-
- stage: Phpstan
38-
php: 7.1
39-
script:
40-
- composer run-script phpstan-install
41-
- composer run-script phpstan
32+
- make qa
4233

4334
- stage: Test Coverage
4435
if: branch = master AND type = push
45-
php: 7.1
36+
php: 7.3
4637
script:
47-
- composer run-script coverage
38+
- make coverage
4839
after_script:
49-
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
50-
- php php-coveralls.phar --verbose --config tests/.coveralls.yml
40+
- composer global require php-coveralls/php-coveralls ^2.1.0
41+
- ~/.composer/vendor/bin/php-coveralls --verbose --config tests/.coveralls.yml
5142

5243
- stage: Outdated Dependencies
5344
if: branch = master AND type = cron
54-
php: 7.1
45+
php: 7.3
5546
script:
56-
- composer outdated --direct --strict
47+
- composer outdated --direct
5748

5849
allow_failures:
5950
- stage: Test Coverage
51+
- php: 7.4snapshot
52+
- php: nightly
6053

6154
sudo: false
6255

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.PHONY: qa lint cs csf phpstan tests coverage
2+
3+
all:
4+
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
5+
6+
vendor: composer.json composer.lock
7+
composer install
8+
9+
qa: lint phpstan cs
10+
11+
lint: vendor
12+
vendor/bin/linter src tests
13+
14+
cs: vendor
15+
vendor/bin/codesniffer src tests
16+
17+
csf: vendor
18+
vendor/bin/codefixer src tests
19+
20+
phpstan: vendor
21+
vendor/bin/phpstan analyse -l max -c phpstan.neon src
22+
23+
tests: vendor
24+
vendor/bin/tester -s -p php --colors 1 -C tests/cases
25+
26+
coverage: vendor
27+
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases

README.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
# Contributte > HTTP
1+
# Contributte HTTP
22

3-
:sparkles: Extra contribution to [`nette/http`](https://github.com/nette/http).
4-
5-
-----
3+
Extra contribution to [`nette/http`](https://github.com/nette/http).
64

75
[![Build Status](https://img.shields.io/travis/contributte/http.svg?style=flat-square)](https://travis-ci.org/contributte/http)
86
[![Code coverage](https://img.shields.io/coveralls/contributte/http.svg?style=flat-square)](https://coveralls.io/r/contributte/http)
97
[![Licence](https://img.shields.io/packagist/l/contributte/http.svg?style=flat-square)](https://packagist.org/packages/contributte/http)
108
[![Downloads this Month](https://img.shields.io/packagist/dm/contributte/http.svg?style=flat-square)](https://packagist.org/packages/contributte/http)
119
[![Downloads total](https://img.shields.io/packagist/dt/contributte/http.svg?style=flat-square)](https://packagist.org/packages/contributte/http)
1210
[![Latest stable](https://img.shields.io/packagist/v/contributte/http.svg?style=flat-square)](https://packagist.org/packages/contributte/http)
13-
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)
11+
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat-square)](https://github.com/phpstan/phpstan)
1412

1513
## Discussion / Help
1614

1715
[![Join the chat](https://img.shields.io/gitter/room/contributte/contributte.svg?style=flat-square)](http://bit.ly/ctteg)
1816

19-
## Install
17+
## Documentation
2018

21-
```
22-
composer require contributte/http
23-
```
19+
- [Setup](.docs/README.md#setup)
20+
- [Curl - simple http client (CurlExtension)](.docs/README.md#curl)
21+
- [SAPI - fake request (CliRequestExtension)](.docs/README.md#sapi)
22+
- [BasicAuth - simple basic authentication](.docs/README.md#basic-authentication)
23+
- [Useful classes](.docs/README.md#useful-classes)
24+
- [Url](.docs/README.md#url)
2425

2526
## Versions
2627

@@ -30,14 +31,6 @@ composer require contributte/http
3031
| stable | `^0.2` | `master` | `>= 7.1` |
3132
| stable | `^0.1` | `master` | `>= 5.6` |
3233

33-
## Overview
34-
35-
- [Curl - simple http client (CurlExtension)](https://github.com/contributte/http/blob/master/.docs/README.md#curl)
36-
- [SAPI - fake request (CliRequestExtension)](https://github.com/contributte/http/blob/master/.docs/README.md#sapi)
37-
- [BasicAuth - simple basic authentication](https://github.com/contributte/http/blob/master/.docs/README.md#basic-authentication)
38-
- Collection of useful classes:
39-
- [Url](https://github.com/contributte/http/blob/master/.docs/README.md#url)
40-
4134
## Maintainers
4235

4336
<table>

composer.json

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@
2323
"nette/http": "~2.4.9"
2424
},
2525
"require-dev": {
26-
"ninjify/qa": "^0.8.0",
27-
"ninjify/nunjuck": "^0.2.0",
2826
"nette/di": "~2.4.13",
27+
"ninjify/nunjuck": "^0.2.0",
28+
"ninjify/qa": "^0.8.0",
29+
"phpstan/extension-installer": "^1.0",
30+
"phpstan/phpstan-deprecation-rules": "^0.11",
31+
"phpstan/phpstan-nette": "^0.11",
32+
"phpstan/phpstan-shim": "^0.11",
33+
"phpstan/phpstan-strict-rules": "^0.11",
2934
"tracy/tracy": "~2.5.1"
3035
},
3136
"conflict": {
@@ -42,27 +47,8 @@
4247
},
4348
"minimum-stability": "dev",
4449
"prefer-stable": true,
45-
"scripts": {
46-
"qa": [
47-
"linter src tests",
48-
"codesniffer src tests"
49-
],
50-
"tests": [
51-
"tester -s -p php --colors 1 -C tests/cases"
52-
],
53-
"coverage": [
54-
"tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases"
55-
],
56-
"phpstan-install": [
57-
"mkdir -p temp/phpstan",
58-
"composer require -d temp/phpstan phpstan/phpstan:^0.10",
59-
"composer require -d temp/phpstan phpstan/phpstan-deprecation-rules:^0.10",
60-
"composer require -d temp/phpstan phpstan/phpstan-nette:^0.10",
61-
"composer require -d temp/phpstan phpstan/phpstan-strict-rules:^0.10"
62-
],
63-
"phpstan": [
64-
"temp/phpstan/vendor/bin/phpstan analyse -l max -c phpstan.neon src"
65-
]
50+
"config": {
51+
"sort-packages": true
6652
},
6753
"extra": {
6854
"branch-alias": {

phpstan.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
includes:
2-
- temp/phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon
3-
- temp/phpstan/vendor/phpstan/phpstan-nette/extension.neon
4-
- temp/phpstan/vendor/phpstan/phpstan-nette/rules.neon
5-
- temp/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon
6-
71
parameters:
82
ignoreErrors:
93
- '#Parameter \#1 \$body of method Contributte\\Http\\Curl\\ResponseFactory::setBody\(\) expects string, bool\|string given.#'

ruleset.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<ruleset name="Contributte">
2+
<ruleset>
33
<!-- Contributte Coding Standard -->
44
<rule ref="./vendor/ninjify/coding-standard/contributte.xml"/>
55

src/Curl/Response.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ public function isJson(): bool
9898
* @return mixed
9999
*/
100100
public function getJsonBody()
101-
{
102-
$body = $this->getBody();
103-
if ($body === null) return null;
101+
{
102+
$body = $this->getBody();
103+
if ($body === null) return null;
104104

105-
return @json_decode((string) $this->getBody(), true);
106-
}
105+
return @json_decode((string) $this->getBody(), true);
106+
}
107107

108108
public function getStatusCode(): int
109109
{

0 commit comments

Comments
 (0)