Skip to content

Commit

Permalink
Use list collection
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-novotny committed Sep 5, 2024
1 parent 1800f54 commit d38c86a
Show file tree
Hide file tree
Showing 72 changed files with 247 additions and 217 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
"ext-curl": "*",
"ext-json": "*",
"guzzlehttp/psr7": "^1.5 || ^2.0",
"inspirum/arrayable": "^1.2",
"inspirum/arrayable": "^1.3",
"psr/http-message": "^1.1 || ^2.0"
},
"require-dev": {
"inspirum/coding-standard": "^1.5",
"inspirum/coding-standard": "^1.6",
"inspirum/phpunit-extension": "^1.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^1.12",
"phpunit/phpunit": "^10.5",
"shipmonk/composer-dependency-analyser": "^1.5",
"squizlabs/php_codesniffer": "^3.9"
"shipmonk/composer-dependency-analyser": "^1.7",
"squizlabs/php_codesniffer": "^3.10"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ parameters:
treatPhpDocTypesAsCertain: false
ignoreErrors:
-
message: '#^Parameter \#2 \$value of method Inspirum\\Balikobot\\Model\\BasePerCarrierCollection\<TItemKey of \(int\|string\),TItemValue,TKey of \(int\|string\),TValue of Inspirum\\Arrayable\\Arrayable\<TItemKey of \(int\|string\), TItemValue\>&Inspirum\\Balikobot\\Model\\WithCarrierId\>\:\:offsetSet\(\) expects TValue of Inspirum\\Arrayable\\Arrayable\<TItemKey of \(int\|string\), TItemValue\>&Inspirum\\Balikobot\\Model\\WithCarrierId, Inspirum\\Arrayable\\Arrayable\<TItemKey of \(int\|string\), TItemValue\>&Inspirum\\Balikobot\\Model\\WithCarrierId given\.$#'
message: '#^Parameter \#2 \$value of method Inspirum\\Balikobot\\Model\\BasePerCarrierCollection\<TItemKey of \(int\|string\),TItemValue,TValue of Inspirum\\Arrayable\\Arrayable\<TItemKey of \(int\|string\), TItemValue\>&Inspirum\\Balikobot\\Model\\WithCarrierId\>\:\:offsetSet\(\) expects TValue of Inspirum\\Arrayable\\Arrayable\<TItemKey of \(int\|string\), TItemValue\>&Inspirum\\Balikobot\\Model\\WithCarrierId, Inspirum\\Arrayable\\Arrayable\<TItemKey of \(int\|string\), TItemValue\>&Inspirum\\Balikobot\\Model\\WithCarrierId given\.$#'
count: 1
path: src/Model/BasePerCarrierCollection.php
-
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Response/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function validateResponseItemHasAttribute(array $item, string $attribute,
* Validate that response item has some attributes
*
* @param array<string,mixed> $item
* @param array<string> $attributes
* @param list<string> $attributes
* @param array<mixed,mixed> $response
*
* @throws \Inspirum\Balikobot\Exception\BadRequestException
Expand Down
2 changes: 1 addition & 1 deletion src/Definitions/BaseEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
abstract class BaseEnum
{
/**
* @return array<string>
* @return list<string>
*/
public static function getAll(): array
{
Expand Down
74 changes: 37 additions & 37 deletions src/Definitions/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -2242,15 +2242,15 @@ final class Service extends BaseEnum
public const SDS_STANDART = 'Standard';

/**
* @return array<string>|null
* @return list<string>|null
*/
public static function getForCarrier(string $carrier): ?array
{
return self::getForCarriers()[$carrier] ?? null;
}

/**
* @return array<string,array<string>>
* @return array<string,list<string>>
*/
private static function getForCarriers(): array
{
Expand Down Expand Up @@ -2293,7 +2293,7 @@ private static function getForCarriers(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function cp(): array
{
return [
Expand Down Expand Up @@ -2326,7 +2326,7 @@ private static function cp(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function dpd(): array
{
return [
Expand All @@ -2341,7 +2341,7 @@ private static function dpd(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function dhl(): array
{
return [
Expand All @@ -2356,7 +2356,7 @@ private static function dhl(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function geis(): array
{
return [
Expand All @@ -2370,7 +2370,7 @@ private static function geis(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function gls(): array
{
return [
Expand All @@ -2383,7 +2383,7 @@ private static function gls(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function intime(): array
{
return [
Expand All @@ -2401,7 +2401,7 @@ private static function intime(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function pbh(): array
{
return [
Expand Down Expand Up @@ -2440,7 +2440,7 @@ private static function pbh(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function ppl(): array
{
return [
Expand All @@ -2458,7 +2458,7 @@ private static function ppl(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function sp(): array
{
return [
Expand All @@ -2475,7 +2475,7 @@ private static function sp(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function sps(): array
{
return [
Expand All @@ -2486,7 +2486,7 @@ private static function sps(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function topTrans(): array
{
return [
Expand All @@ -2499,7 +2499,7 @@ private static function topTrans(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function ulozenka(): array
{
return [
Expand All @@ -2520,7 +2520,7 @@ private static function ulozenka(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function ups(): array
{
return [
Expand All @@ -2531,7 +2531,7 @@ private static function ups(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function zasilkovna(): array
{
return [
Expand Down Expand Up @@ -2684,7 +2684,7 @@ private static function zasilkovna(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function tnt(): array
{
return [
Expand All @@ -2708,7 +2708,7 @@ private static function tnt(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function gw(): array
{
return [
Expand All @@ -2724,7 +2724,7 @@ private static function gw(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function gwcz(): array
{
return [
Expand All @@ -2736,7 +2736,7 @@ private static function gwcz(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function messenger(): array
{
return [
Expand All @@ -2754,7 +2754,7 @@ private static function messenger(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function dhlde(): array
{
return [
Expand All @@ -2766,7 +2766,7 @@ private static function dhlde(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function fedex(): array
{
return [
Expand All @@ -2789,7 +2789,7 @@ private static function fedex(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function fofr(): array
{
return [
Expand All @@ -2803,7 +2803,7 @@ private static function fofr(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function dachser(): array
{
return [
Expand All @@ -2821,15 +2821,15 @@ private static function dachser(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function dhlparcel(): array
{
return [
self::DHLPARCEL_CONNECT,
];
}

/** @return array<string> */
/** @return list<string> */
private static function raben(): array
{
return [
Expand All @@ -2842,7 +2842,7 @@ private static function raben(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function spring(): array
{
return [
Expand All @@ -2852,7 +2852,7 @@ private static function spring(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function dsv(): array
{
return [
Expand All @@ -2861,7 +2861,7 @@ private static function dsv(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function dhlfreightec(): array
{
return [
Expand All @@ -2872,7 +2872,7 @@ private static function dhlfreightec(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function kurier(): array
{
return [
Expand All @@ -2884,7 +2884,7 @@ private static function kurier(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function dbschenker(): array
{
return [
Expand All @@ -2902,7 +2902,7 @@ private static function dbschenker(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function airway(): array
{
return [
Expand All @@ -2918,15 +2918,15 @@ private static function airway(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function japo(): array
{
return [
self::JAPO_STANDARD,
];
}

/** @return array<string> */
/** @return list<string> */
private static function liftago(): array
{
return [
Expand All @@ -2946,7 +2946,7 @@ private static function liftago(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function magyarposta(): array
{
return [
Expand All @@ -2959,7 +2959,7 @@ private static function magyarposta(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function sameday(): array
{
return [
Expand All @@ -2975,7 +2975,7 @@ private static function sameday(): array
];
}

/** @return array<string> */
/** @return list<string> */
private static function sds(): array
{
return [
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/ServiceContainerNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class ServiceContainerNotFoundException extends InvalidArgumentException
{
/**
* @param array<string> $alternatives
* @param list<string> $alternatives
*/
public function __construct(string $connection, array $alternatives)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Model/AdrUnit/DefaultAdrUnitFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function createCollection(string $carrier, array $data): AdrUnitCollectio
{
return new DefaultAdrUnitCollection(
$carrier,
array_map(fn(array $unit): AdrUnit => $this->create($carrier, $unit), $data['units'] ?? []),
array_map(fn (array $unit): AdrUnit => $this->create($carrier, $unit), $data['units'] ?? []),
);
}
}
Loading

0 comments on commit d38c86a

Please sign in to comment.