Skip to content

Commit

Permalink
fix: destination 的类型约束去掉 array (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
yansongda authored Jul 9, 2023
1 parent c222940 commit b9cf6ee
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## v3.5.0

### fixed

- fix: `destination` 的类型约束去掉 array(#824)

## v3.5.0

### deleted

- deleted: 移除 `Yansongda\Pay\Direction\ArrayDirection` 类(#818, #819)
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function call(string $plugin, array $params = []): Collection|MessageInte
* @throws ContainerException
* @throws InvalidParamsException
*/
public function pay(array $plugins, array $params): Collection|MessageInterface|array|null
public function pay(array $plugins, array $params): Collection|MessageInterface|null
{
Logger::info('[AbstractProvider] 即将进行 pay 操作', func_get_args());

Expand Down
6 changes: 3 additions & 3 deletions src/Rocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Rocket implements JsonSerializableInterface, ArrayAccess

private string $direction = DirectionInterface::class;

private array|null|MessageInterface|Collection $destination = null;
private null|MessageInterface|Collection $destination = null;

private null|RequestInterface|ResponseInterface $destinationOrigin = null;

Expand Down Expand Up @@ -114,12 +114,12 @@ public function setDirection(string $direction): Rocket
return $this;
}

public function getDestination(): Collection|MessageInterface|array|null
public function getDestination(): Collection|MessageInterface|null
{
return $this->destination;
}

public function setDestination(Collection|MessageInterface|array|null $destination): Rocket
public function setDestination(Collection|MessageInterface|null $destination): Rocket
{
$this->destination = $destination;

Expand Down
2 changes: 1 addition & 1 deletion tests/Plugin/Unipay/LaunchPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function testArrayDirection()
];

$rocket = new Rocket();
$rocket->setDestination($response);
$rocket->setDestination(Collection::wrap($response));

$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

Expand Down
4 changes: 2 additions & 2 deletions tests/Plugin/Wechat/LaunchPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ public function testArrayDestination()

$rocket = new Rocket();
$rocket->setDirection(OriginResponseDirection::class);
$rocket->setDestination($destination);
$rocket->setDestination(Collection::wrap($destination));
$rocket->setDestinationOrigin(new ServerRequest('POST', 'http://localhost'));

$result = $this->plugin->assembly($rocket, function ($rocket) { return $rocket; });

self::assertEquals($destination, $result->getDestination());
self::assertEquals($destination, $result->getDestination()->toArray());
}

public function testCollectionDestination()
Expand Down

0 comments on commit b9cf6ee

Please sign in to comment.