Skip to content

Commit a1476e3

Browse files
committed
PHPStan update to ^2.0 & decrease level to 9
1 parent 4d48851 commit a1476e3

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"require-dev": {
3737
"guzzlehttp/guzzle": "^7.5",
3838
"nette/tester": "^2.4",
39-
"phpstan/phpstan": "^1.8",
40-
"phpstan/phpstan-strict-rules": "^1.4",
39+
"phpstan/phpstan": "^2.1",
40+
"phpstan/phpstan-strict-rules": "^2.0",
4141
"tracy/tracy": "^2.9"
4242
},
4343
"config": {

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: max
2+
level: 9
33
paths:
44
- src
55
- tests/src

src/Vies/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use stdClass;
88

99
/**
10-
* @phpstan-type ViesResponse object{countryCode: string, vatNumber: string, requestDate: string, valid: bool, requestIdentifier: string, name: string, address: string, traderName: string, traderStreet: string, traderPostalCode: string, traderCity: string, traderCompanyType: string, traderNameMatch: string, traderStreetMatch: string, traderPostalCodeMatch: string, traderCityMatch: string, traderCompanyTypeMatch: string}
10+
* @phpstan-type ViesResponse object{countryCode: string, vatNumber: string, requestDate: string, valid: bool, requestIdentifier: string, name: string, address: string, traderName: string, traderStreet: string, traderPostalCode: string, traderCity: string, traderCompanyType: string, traderNameMatch: string, traderStreetMatch: string, traderPostalCodeMatch: string, traderCityMatch: string, traderCompanyTypeMatch: string}&\stdClass
1111
*/
1212
final class Client
1313
{
@@ -30,8 +30,8 @@ public function checkVatNumber(ViesEntity $viesEntity): object
3030
$response = $this->transportProvider->response($request);
3131

3232
$data = $this->transportProvider->toJson($response);
33-
if (isset($data->errorWrappers[0], $data->errorWrappers[0]->error)) {
34-
if (isset($data->errorWrappers[0]->message)) {
33+
if (array_key_exists(0, $data->errorWrappers) && property_exists($data->errorWrappers[0], 'error')) {
34+
if (property_exists($data->errorWrappers[0], 'message')) {
3535
throw new ServerResponseException(sprintf('%s: %s', $data->errorWrappers[0]->error, $data->errorWrappers[0]->message));
3636
}
3737

src/Vies/ViesEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(
2828
public function toParam(): array
2929
{
3030
/** @var viesParam $data */
31-
$data = array_filter(get_object_vars($this));
31+
$data = array_filter(get_object_vars($this), fn ($value) => $value !== '' && $value !== null);
3232

3333
return $data;
3434
}

0 commit comments

Comments
 (0)