Skip to content

Commit 6c07765

Browse files
committed
made routing an optional paramater
1 parent ccc79df commit 6c07765

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

src/Bolt.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,11 @@ public function __destruct()
394394
/**
395395
* fetch the current routing table, if the message specification allows it.
396396
*
397-
* @param array $routing
397+
* @param array|null $routing
398+
*
398399
* @return array|null
399400
*/
400-
public function route(array $routing): ?array
401+
public function route(?array $routing = null): ?array
401402
{
402403
if (!method_exists($this->protocol, 'route')) {
403404
return null;

src/protocol/V4_3.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
*/
1717
class V4_3 extends V4_1
1818
{
19-
public function route(array $routing): array
19+
public function route(?array $routing = null): array
2020
{
21-
$this->write($this->packer->pack(0x66, $routing));
21+
$this->write($this->packer->pack(0x66, $routing ?? []));
2222

2323
$signature = 0;
2424
$output = $this->read($signature);

tests/protocol/V4_3Test.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,14 @@ public function test__construct()
2929
return $cls;
3030
}
3131

32+
/**
33+
* @return V4_3
34+
*/
35+
public function testRoute(): void
36+
{
37+
$v4_3 = $this->test__construct();
38+
39+
self::assertEquals([], $v4_3->route());
40+
}
41+
3242
}

0 commit comments

Comments
 (0)