Skip to content

Commit

Permalink
fix: swoft-cloud/swoft/issues/1127 swoole push 4th params error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Dec 1, 2019
1 parent 8f5a0db commit d724a94
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/websocket-server/src/Message/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ class Response implements ResponseInterface
private $sendToAll = false;

/**
* @var bool
* @var int
*/
private $finish = true;
private $finish = 1;

/**
* @var int WebSocket opcode value
Expand Down Expand Up @@ -364,18 +364,26 @@ public function setOpcode(int $opcode): self
* @return bool
*/
public function isFinish(): bool
{
return $this->finish === 1;
}

/**
* @return int
*/
public function getFinish(): int
{
return $this->finish;
}

/**
* @param bool $finish
* @param bool|int $finish
*
* @return self
*/
public function setFinish(bool $finish): self
public function setFinish($finish): self
{
$this->finish = $finish;
$this->finish = (int)$finish;
return $this;
}

Expand Down
1 change: 1 addition & 0 deletions src/websocket-server/test/unit/Message/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function testBasic(): void
$this->assertSame(7, $w->getOpcode());
$this->assertFalse($w->isSent());
$this->assertFalse($w->isFinish());
$this->assertSame(1, $w->getFinish());

$this->assertFalse($w->isSendToAll());
$w->toAll();
Expand Down

0 comments on commit d724a94

Please sign in to comment.