File tree Expand file tree Collapse file tree 3 files changed +12
-27
lines changed Expand file tree Collapse file tree 3 files changed +12
-27
lines changed Original file line number Diff line number Diff line change 1919
2020class Client
2121{
22- /**
23- * @var UriInterface
24- */
25- protected $ uri ;
26-
27- /**
28- * @var Coroutine\Http\Client
29- */
30- protected $ client ;
22+ protected Coroutine \Http \Client $ client ;
3123
32- public function __construct (UriInterface $ uri )
24+ public function __construct (protected UriInterface $ uri )
3325 {
34- $ this ->uri = $ uri ;
3526 $ host = $ uri ->getHost ();
3627 $ port = $ uri ->getPort ();
3728 $ ssl = $ uri ->getScheme () === 'wss ' ;
Original file line number Diff line number Diff line change 1313
1414use Swoole \WebSocket \Frame as SwFrame ;
1515
16- class Frame
16+ class Frame implements \Stringable
1717{
18- /**
19- * @var bool
20- */
21- public $ finish = true ;
18+ public bool $ finish = true ;
2219
23- /**
24- * @var string
25- */
26- public $ opcode ;
20+ public int $ opcode ;
2721
28- /**
29- * @var string
30- */
31- public $ data ;
22+ public string $ data ;
3223
3324 public function __construct (SwFrame $ frame )
3425 {
@@ -37,7 +28,7 @@ public function __construct(SwFrame $frame)
3728 $ this ->data = $ frame ->data ;
3829 }
3930
40- public function __toString ()
31+ public function __toString (): string
4132 {
4233 return $ this ->data ;
4334 }
@@ -53,7 +44,7 @@ public function getOpcodeDefinition(): string
5344 return $ map [$ this ->opcode ] ?? 'WEBSOCKET_BAD_OPCODE ' ;
5445 }
5546
56- public function getOpcode (): string
47+ public function getOpcode (): int
5748 {
5849 return $ this ->opcode ;
5950 }
Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ class FrameTest extends TestCase
2424{
2525 public function testFrame ()
2626 {
27- $ frame = new Frame (Mockery::mock (SwFrame::class));
27+ $ swframe = Mockery::mock (SwFrame::class);
28+ $ swframe ->finish = true ;
29+ $ swframe ->opcode = 1 ;
30+ $ frame = new Frame ($ swframe );
2831
2932 $ this ->assertSame ($ frame ->data , (string ) $ frame );
3033 }
You can’t perform that action at this time.
0 commit comments