@@ -18,19 +18,14 @@ class Factory
1818
1919 /**
2020 * @param LoopInterface $loop
21- * @param ConnectorInterface|\React\SocketClient\ConnectorInterface|null $connector
22- * [optional] Connector to use. Should be `null` in order to use default
23- * Connector. Passing a `\React\SocketClient\ConnectorInterface` is
24- * deprecated and only supported for BC reasons and will be removed in
25- * future versions.
21+ * @param ConnectorInterface|null $connector [optional] Connector to use.
22+ * Should be `null` in order to use default Connector.
2623 * @param ProtocolFactory|null $protocol
2724 */
28- public function __construct (LoopInterface $ loop , $ connector = null , ProtocolFactory $ protocol = null )
25+ public function __construct (LoopInterface $ loop , ConnectorInterface $ connector = null , ProtocolFactory $ protocol = null )
2926 {
3027 if ($ connector === null ) {
3128 $ connector = new Connector ($ loop );
32- } elseif (!$ connector instanceof ConnectorInterface) {
33- $ connector = new ConnectorUpcaster ($ connector );
3429 }
3530
3631 if ($ protocol === null ) {
@@ -44,12 +39,10 @@ public function __construct(LoopInterface $loop, $connector = null, ProtocolFact
4439 /**
4540 * create redis client connected to address of given redis instance
4641 *
47- * @param string|null $target Redis server URI to connect to. Not passing
48- * this parameter is deprecated and only supported for BC reasons and
49- * will be removed in future versions.
42+ * @param string $target Redis server URI to connect to
5043 * @return \React\Promise\PromiseInterface resolves with Client or rejects with \Exception
5144 */
52- public function createClient ($ target = null )
45+ public function createClient ($ target )
5346 {
5447 try {
5548 $ parts = $ this ->parseUrl ($ target );
@@ -95,21 +88,18 @@ function ($error) use ($client) {
9588 }
9689
9790 /**
98- * @param string|null $target
91+ * @param string $target
9992 * @return array with keys host, port, auth and db
10093 * @throws InvalidArgumentException
10194 */
10295 private function parseUrl ($ target )
10396 {
104- if ($ target === null ) {
105- $ target = 'tcp://127.0.0.1 ' ;
106- }
10797 if (strpos ($ target , ':// ' ) === false ) {
108- $ target = 'tcp :// ' . $ target ;
98+ $ target = 'redis :// ' . $ target ;
10999 }
110100
111101 $ parts = parse_url ($ target );
112- if ($ parts === false || !isset ($ parts ['scheme ' ], $ parts ['host ' ]) || !in_array ($ parts ['scheme ' ], array ('tcp ' , ' redis ' , 'rediss ' ))) {
102+ if ($ parts === false || !isset ($ parts ['scheme ' ], $ parts ['host ' ]) || !in_array ($ parts ['scheme ' ], array ('redis ' , 'rediss ' ))) {
113103 throw new InvalidArgumentException ('Given URL can not be parsed ' );
114104 }
115105
@@ -121,15 +111,8 @@ private function parseUrl($target)
121111 $ parts ['host ' ] = '127.0.0.1 ' ;
122112 }
123113
124- $ auth = null ;
125- if (isset ($ parts ['user ' ]) && $ parts ['scheme ' ] === 'tcp ' ) {
126- $ auth = rawurldecode ($ parts ['user ' ]);
127- }
128114 if (isset ($ parts ['pass ' ])) {
129- $ auth .= ($ parts ['scheme ' ] === 'tcp ' ? ': ' : '' ) . rawurldecode ($ parts ['pass ' ]);
130- }
131- if ($ auth !== null ) {
132- $ parts ['auth ' ] = $ auth ;
115+ $ parts ['auth ' ] = rawurldecode ($ parts ['pass ' ]);
133116 }
134117
135118 if (isset ($ parts ['path ' ]) && $ parts ['path ' ] !== '' ) {
0 commit comments