Skip to content

Commit 5a75e78

Browse files
Removed routing for init/hello extra parameter. It has to be part of extra parameter.
1 parent 7500780 commit 5a75e78

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

src/Bolt.php

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ final class Bolt
5252
*/
5353
private $version;
5454

55-
/**
56-
* @var array|null
57-
*/
58-
private $routing = null;
59-
6055
/**
6156
* Print debug info
6257
* @var bool
@@ -190,12 +185,12 @@ private function packProtocolVersions(): string
190185
* @throws Exception
191186
* @version <3
192187
*/
193-
public function init(array $extra)
188+
public function init(array $extra): array
194189
{
195190
if ($this->connection->connect() && $this->handshake()) {
196191
if (self::$debug)
197192
echo 'INIT';
198-
return $this->protocol->init($extra, $this->routing);
193+
return $this->protocol->init($extra);
199194
}
200195

201196
// I don't think it will reach this point, but otherwise I've to end method with return
@@ -209,25 +204,11 @@ public function init(array $extra)
209204
* @throws Exception
210205
* @version >=3
211206
*/
212-
public function hello(array $extra)
207+
public function hello(array $extra): array
213208
{
214209
return $this->init($extra);
215210
}
216211

217-
/**
218-
* Set routing table for HELLO message
219-
* @param array|null $routing routing::Dictionary(address::String)
220-
* <pre>null - the server should not carry out routing
221-
* [] - the server should carry out routing
222-
* ['address' => 'ip:port'] - the server should carry out routing according to the given routing context</pre>
223-
* @return Bolt
224-
*/
225-
public function setRouting(?array $routing = null): Bolt
226-
{
227-
$this->routing = $routing;
228-
return $this;
229-
}
230-
231212
/**
232213
* Send RUN message
233214
* @param string $statement

src/protocol/V4_1.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ class V4_1 extends V4
2121
*/
2222
public function hello(...$args): array
2323
{
24-
if (count($args) < 2) {
24+
if (count($args) < 1) {
2525
throw new PackException('Wrong arguments count');
2626
}
2727

28-
$args[0]['routing'] = is_array($args[1]) ? (object)$args[1] : null;
28+
$args[0]['routing'] = array_key_exists('routing', $args[0]) && is_array($args[0]['routing']) ? (object)$args[1] : null;
2929
$this->write($this->packer->pack(0x01, $args[0]));
3030

3131
$signature = 0;

0 commit comments

Comments
 (0)