Skip to content

Commit c65b484

Browse files
author
Martin Brecht-Precht
committed
Language level migration.
1 parent 0ca59ce commit c65b484

8 files changed

+42
-119
lines changed

.codeclimate.yml

-28
This file was deleted.

.travis.yml

-29
This file was deleted.

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# PHP JSON HTTP Client
22

33
[![Build Status](https://travis-ci.org/markenwerk/php-json-http-client.svg?branch=master)](https://travis-ci.org/markenwerk/php-json-http-client)
4-
[![Test Coverage](https://codeclimate.com/github/markenwerk/php-json-http-client/badges/coverage.svg)](https://codeclimate.com/github/markenwerk/php-json-http-client/coverage)
5-
[![Dependency Status](https://www.versioneye.com/user/projects/5728e298a0ca35004baf7cb7/badge.svg)](https://www.versioneye.com/user/projects/5728e298a0ca35004baf7cb7)
64
[![SensioLabs Insight](https://img.shields.io/sensiolabs/i/6b8db506-121a-4875-8b1d-560b505e0444.svg)](https://insight.sensiolabs.com/projects/6b8db506-121a-4875-8b1d-560b505e0444)
75
[![Code Climate](https://codeclimate.com/github/markenwerk/php-json-http-client/badges/gpa.svg)](https://codeclimate.com/github/markenwerk/php-json-http-client)
86
[![Latest Stable Version](https://poser.pugx.org/markenwerk/json-http-client/v/stable)](https://packagist.org/packages/markenwerk/json-http-client)

composer.json

+32-33
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
{
2-
"name": "markenwerk/json-http-client",
3-
"type": "library",
4-
"description": "A JSON HTTP client library. This project also is the reference implementation for extending the PHP Basic HTTP Client.",
5-
"keywords": [
6-
"HTTP client",
7-
"RESTful",
8-
"JSON",
9-
"SSL",
10-
"Basic Auth",
11-
"Client Certificate Auth"
12-
],
13-
"homepage": "http://markenwerk.net/",
14-
"license": "MIT",
15-
"authors": [
16-
{
17-
"name": "Martin Brecht-Precht",
18-
"email": "[email protected]",
19-
"homepage": "http://markenwerk.net"
20-
}
21-
],
22-
"autoload": {
23-
"psr-4": {
24-
"Markenwerk\\JsonHttpClient\\": "src/"
25-
}
26-
},
27-
"require": {
28-
"php": ">=5.3",
29-
"markenwerk/basic-http-client": "~3.0"
30-
},
31-
"require-dev": {
32-
"phpunit/phpunit": ">=4.8.26",
33-
"codeclimate/php-test-reporter": "dev-master"
34-
}
2+
"name": "markenwerk/json-http-client",
3+
"type": "library",
4+
"description": "A JSON HTTP client library. This project also is the reference implementation for extending the PHP Basic HTTP Client.",
5+
"keywords": [
6+
"HTTP client",
7+
"RESTful",
8+
"JSON",
9+
"SSL",
10+
"Basic Auth",
11+
"Client Certificate Auth"
12+
],
13+
"homepage": "http://markenwerk.net/",
14+
"license": "MIT",
15+
"authors": [
16+
{
17+
"name": "Martin Brecht-Precht",
18+
"email": "[email protected]",
19+
"homepage": "http://markenwerk.net"
20+
}
21+
],
22+
"autoload": {
23+
"psr-4": {
24+
"Markenwerk\\JsonHttpClient\\": "src/"
25+
}
26+
},
27+
"require": {
28+
"php": "^7.1",
29+
"ext-curl": "*",
30+
"ext-json": "*",
31+
"ext-mbstring": "*",
32+
"markenwerk/basic-http-client": "~3.0"
33+
}
3534
}

phpunit.xml.dist

-17
This file was deleted.

src/JsonHttpClient.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct($endpoint)
3737
{
3838
$url = new Url($endpoint);
3939
$transport = new HttpTransport();
40-
if (mb_strtoupper($url->getScheme()) == 'HTTPS') {
40+
if (mb_strtoupper($url->getScheme()) === 'HTTPS') {
4141
$transport = new HttpsTransport();
4242
}
4343
$message = new Message();
@@ -54,7 +54,7 @@ public function __construct($endpoint)
5454
/**
5555
* @return RequestInterface
5656
*/
57-
public function getRequest()
57+
public function getRequest(): RequestInterface
5858
{
5959
return $this->request;
6060
}
@@ -65,7 +65,7 @@ public function getRequest()
6565
* @throws NetworkException
6666
* @throws ConnectionTimeoutException
6767
*/
68-
public function get(array $queryParameters = array())
68+
public function get(array $queryParameters = array()): ResponseInterface
6969
{
7070
$this->request
7171
->setMethod(RequestInterface::REQUEST_METHOD_GET)
@@ -81,7 +81,7 @@ public function get(array $queryParameters = array())
8181
* @throws NetworkException
8282
* @throws ConnectionTimeoutException
8383
*/
84-
public function head(array $queryParameters = array())
84+
public function head(array $queryParameters = array()): ResponseInterface
8585
{
8686
$this->request
8787
->setMethod(RequestInterface::REQUEST_METHOD_HEAD)
@@ -97,7 +97,7 @@ public function head(array $queryParameters = array())
9797
* @throws NetworkException
9898
* @throws ConnectionTimeoutException
9999
*/
100-
public function post(array $postData = array())
100+
public function post(array $postData = array()): ResponseInterface
101101
{
102102
$this->request
103103
->getMessage()
@@ -114,7 +114,7 @@ public function post(array $postData = array())
114114
* @throws NetworkException
115115
* @throws ConnectionTimeoutException
116116
*/
117-
public function put(array $putData = array())
117+
public function put(array $putData = array()): ResponseInterface
118118
{
119119
$this->request
120120
->getMessage()
@@ -131,7 +131,7 @@ public function put(array $putData = array())
131131
* @throws NetworkException
132132
* @throws ConnectionTimeoutException
133133
*/
134-
public function patch(array $patchData = array())
134+
public function patch(array $patchData = array()): ResponseInterface
135135
{
136136
$this->request
137137
->getMessage()
@@ -148,7 +148,7 @@ public function patch(array $patchData = array())
148148
* @throws NetworkException
149149
* @throws ConnectionTimeoutException
150150
*/
151-
public function delete(array $queryParameters = array())
151+
public function delete(array $queryParameters = array()): ResponseInterface
152152
{
153153
$this->request
154154
->setMethod(RequestInterface::REQUEST_METHOD_DELETE)

src/Request/JsonRequest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class JsonRequest extends AbstractRequest
1717
/**
1818
* @return ResponseInterface
1919
*/
20-
protected function buildResponse()
20+
protected function buildResponse(): ResponseInterface
2121
{
2222
return new JsonResponse($this);
2323
}

src/Response/JsonResponse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function setBody($body)
3535
/**
3636
* @return array
3737
*/
38-
public function getBody()
38+
public function getBody(): array
3939
{
4040
return parent::getBody();
4141
}

0 commit comments

Comments
 (0)