Skip to content

Commit

Permalink
PHP - support only v.8
Browse files Browse the repository at this point in the history
  • Loading branch information
pekral committed Feb 16, 2022
1 parent 7cb385d commit af49526
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
17 changes: 11 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"MIT"
],
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
Expand All @@ -30,9 +30,8 @@
"phpunit/phpunit": "^9.0",
"slevomat/coding-standard": "^6.0 || ^7.0"
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"EcomailFlexibee\\": [
Expand All @@ -48,6 +47,12 @@
"tests/"
]
},
"minimum-stability": "dev",
"prefer-stable": true
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"phpstan/extension-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
}
}
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
parameters:
level: max
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
3 changes: 1 addition & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ public function searchInEvidencePaginated(string $query, array $uriParameters):
}

/**
* @param mixed $queryFilterOrId
* @param array<mixed> $uriParameters
* @param array<mixed> $postFields
* @param array<string> $headers
Expand All @@ -472,7 +471,7 @@ public function searchInEvidencePaginated(string $query, array $uriParameters):
* @throws \EcomailFlexibee\Exception\EcomailFlexibeeNotAcceptableRequest
* @throws \EcomailFlexibee\Exception\EcomailFlexibeeRequestFail
*/
public function callRequest(Method $httpMethod, $queryFilterOrId, array $uriParameters, array $postFields, array $headers): array
public function callRequest(Method $httpMethod, mixed $queryFilterOrId, array $uriParameters, array $postFields, array $headers): array
{
$response = $this->httpClient->request(
$this->queryBuilder->createUri($queryFilterOrId, $uriParameters),
Expand Down
5 changes: 2 additions & 3 deletions src/Http/HttpCurlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace EcomailFlexibee\Http;

use CurlHandle;
use EcomailFlexibee\Config;
use function count;
use function curl_init;
Expand All @@ -30,11 +31,9 @@ final class HttpCurlBuilder
* @param array<string> $postFields
* @param array<string> $queryParameters
* @param array<string> $headers
* @return resource
*/
public function build(string $url, Method $httpMethod, array $postFields, array $queryParameters, array $headers, Config $config)
public function build(string $url, Method $httpMethod, array $postFields, array $queryParameters, array $headers, Config $config): CurlHandle
{
/** @var resource $ch */
$ch = curl_init();
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
Expand Down
8 changes: 2 additions & 6 deletions src/Http/UrlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,9 @@ public function getUrl(): string
}

/**
* @param mixed $filterQueryOrId
* @param array<mixed> $uriParams
*/
public function createUri($filterQueryOrId, array $uriParams): string
public function createUri(mixed $filterQueryOrId, array $uriParams): string
{
if ($filterQueryOrId === null) {
$this->setPath($this->buildPathForOnlyEvidence());
Expand All @@ -162,10 +161,7 @@ public function createUri($filterQueryOrId, array $uriParams): string
return $this->getUrl();
}

/**
* @param string|int $filterQueryOrId
*/
private function buildPathWithIdOrFilter($filterQueryOrId, string $format = 'json'): Path
private function buildPathWithIdOrFilter(string|int $filterQueryOrId, string $format = 'json'): Path
{
return new Path(sprintf('c/%s/%s/%s.%s', $this->company, $this->evidence, $filterQueryOrId, $format));
}
Expand Down

0 comments on commit af49526

Please sign in to comment.