@@ -115,15 +115,15 @@ public function __construct($host, $port, $username, $password, $authMethod = nu
115
115
}
116
116
117
117
118
- public function setCurler ()
118
+ public function setCurler () : void
119
119
{
120
120
$ this ->_curler = new CurlerRolling ();
121
121
}
122
122
123
123
/**
124
124
* @param CurlerRolling $curler
125
125
*/
126
- public function setDirtyCurler (CurlerRolling $ curler )
126
+ public function setDirtyCurler (CurlerRolling $ curler ) : void
127
127
{
128
128
if ($ curler instanceof CurlerRolling) {
129
129
$ this ->_curler = $ curler ;
@@ -133,7 +133,7 @@ public function setDirtyCurler(CurlerRolling $curler)
133
133
/**
134
134
* @return CurlerRolling
135
135
*/
136
- public function getCurler ()
136
+ public function getCurler (): ? CurlerRolling
137
137
{
138
138
return $ this ->_curler ;
139
139
}
@@ -142,7 +142,7 @@ public function getCurler()
142
142
* @param string $host
143
143
* @param int $port
144
144
*/
145
- public function setHost ($ host , $ port = -1 )
145
+ public function setHost (string $ host , $ port = -1 ) : void
146
146
{
147
147
if ($ port > 0 ) {
148
148
$ this ->_port = $ port ;
@@ -156,15 +156,15 @@ public function setHost($host, $port = -1)
156
156
*
157
157
* @param string $caPath
158
158
*/
159
- public function setSslCa ($ caPath )
159
+ public function setSslCa (string $ caPath ) : void
160
160
{
161
161
$ this ->sslCA = $ caPath ;
162
162
}
163
163
164
164
/**
165
165
* @return string
166
166
*/
167
- public function getUri ()
167
+ public function getUri (): string
168
168
{
169
169
$ proto = 'http ' ;
170
170
if ($ this ->settings ()->isHttps ()) {
@@ -183,7 +183,7 @@ public function getUri()
183
183
/**
184
184
* @return Settings
185
185
*/
186
- public function settings ()
186
+ public function settings (): Settings
187
187
{
188
188
return $ this ->_settings ;
189
189
}
@@ -192,7 +192,7 @@ public function settings()
192
192
* @param bool|int $flag
193
193
* @return mixed
194
194
*/
195
- public function verbose ($ flag )
195
+ public function verbose ($ flag ): mixed
196
196
{
197
197
$ this ->_verbose = $ flag ;
198
198
return $ flag ;
@@ -202,7 +202,7 @@ public function verbose($flag)
202
202
* @param array $params
203
203
* @return string
204
204
*/
205
- private function getUrl ($ params = [])
205
+ private function getUrl ($ params = []): string
206
206
{
207
207
$ settings = $ this ->settings ()->getSettings ();
208
208
@@ -229,7 +229,7 @@ private function getUrl($params = [])
229
229
* @param array $extendinfo
230
230
* @return CurlerRequest
231
231
*/
232
- private function newRequest ($ extendinfo )
232
+ private function newRequest ($ extendinfo ): CurlerRequest
233
233
{
234
234
$ new = new CurlerRequest ();
235
235
@@ -276,7 +276,7 @@ private function newRequest($extendinfo)
276
276
* @return CurlerRequest
277
277
* @throws \ClickHouseDB\Exception\TransportException
278
278
*/
279
- private function makeRequest (Query $ query , $ urlParams = [], $ query_as_string = false )
279
+ private function makeRequest (Query $ query , $ urlParams = [], $ query_as_string = false ): CurlerRequest
280
280
{
281
281
$ sql = $ query ->toSql ();
282
282
@@ -314,7 +314,7 @@ private function makeRequest(Query $query, $urlParams = [], $query_as_string = f
314
314
* @param string|Query $sql
315
315
* @return CurlerRequest
316
316
*/
317
- public function writeStreamData ($ sql )
317
+ public function writeStreamData ($ sql ): CurlerRequest
318
318
{
319
319
320
320
if ($ sql instanceof Query) {
@@ -351,7 +351,7 @@ public function writeStreamData($sql)
351
351
* @return Statement
352
352
* @throws \ClickHouseDB\Exception\TransportException
353
353
*/
354
- public function writeAsyncCSV ($ sql , $ file_name )
354
+ public function writeAsyncCSV ($ sql , $ file_name ): Statement
355
355
{
356
356
$ query = new Query ($ sql );
357
357
@@ -392,7 +392,7 @@ public function writeAsyncCSV($sql, $file_name)
392
392
*
393
393
* @return int
394
394
*/
395
- public function getCountPendingQueue ()
395
+ public function getCountPendingQueue (): int
396
396
{
397
397
return $ this ->_curler ->countPending ();
398
398
}
@@ -402,7 +402,7 @@ public function getCountPendingQueue()
402
402
*
403
403
* @param int $connectTimeOut
404
404
*/
405
- public function setConnectTimeOut ($ connectTimeOut )
405
+ public function setConnectTimeOut (int $ connectTimeOut )
406
406
{
407
407
$ this ->_connectTimeOut = $ connectTimeOut ;
408
408
}
@@ -412,13 +412,13 @@ public function setConnectTimeOut($connectTimeOut)
412
412
*
413
413
* @return int
414
414
*/
415
- public function getConnectTimeOut ()
415
+ public function getConnectTimeOut (): int
416
416
{
417
417
return $ this ->_connectTimeOut ;
418
418
}
419
419
420
420
421
- public function __findXClickHouseProgress ($ handle )
421
+ public function __findXClickHouseProgress ($ handle ): bool
422
422
{
423
423
$ code = curl_getinfo ($ handle , CURLINFO_HTTP_CODE );
424
424
@@ -455,7 +455,7 @@ public function __findXClickHouseProgress($handle)
455
455
}
456
456
457
457
}
458
-
458
+ return false ;
459
459
}
460
460
461
461
/**
@@ -465,7 +465,7 @@ public function __findXClickHouseProgress($handle)
465
465
* @return CurlerRequest
466
466
* @throws \Exception
467
467
*/
468
- public function getRequestRead (Query $ query , $ whereInFile = null , $ writeToFile = null )
468
+ public function getRequestRead (Query $ query , $ whereInFile = null , $ writeToFile = null ): CurlerRequest
469
469
{
470
470
$ urlParams = ['readonly ' => 2 ];
471
471
$ query_as_string = false ;
@@ -526,13 +526,13 @@ public function getRequestRead(Query $query, $whereInFile = null, $writeToFile =
526
526
527
527
}
528
528
529
- public function cleanQueryDegeneration ()
529
+ public function cleanQueryDegeneration (): bool
530
530
{
531
531
$ this ->_query_degenerations = [];
532
532
return true ;
533
533
}
534
534
535
- public function addQueryDegeneration (Degeneration $ degeneration )
535
+ public function addQueryDegeneration (Degeneration $ degeneration ): bool
536
536
{
537
537
$ this ->_query_degenerations [] = $ degeneration ;
538
538
return true ;
@@ -543,7 +543,7 @@ public function addQueryDegeneration(Degeneration $degeneration)
543
543
* @return CurlerRequest
544
544
* @throws \ClickHouseDB\Exception\TransportException
545
545
*/
546
- public function getRequestWrite (Query $ query )
546
+ public function getRequestWrite (Query $ query ): CurlerRequest
547
547
{
548
548
$ urlParams = ['readonly ' => 0 ];
549
549
return $ this ->makeRequest ($ query , $ urlParams );
@@ -566,7 +566,7 @@ public function ping(): bool
566
566
* @param mixed[] $bindings
567
567
* @return Query
568
568
*/
569
- private function prepareQuery ($ sql , $ bindings )
569
+ private function prepareQuery ($ sql , $ bindings ): Query
570
570
{
571
571
572
572
// add Degeneration query
@@ -586,7 +586,7 @@ private function prepareQuery($sql, $bindings)
586
586
* @return CurlerRequest
587
587
* @throws \Exception
588
588
*/
589
- private function prepareSelect ($ sql , $ bindings , $ whereInFile , $ writeToFile = null )
589
+ private function prepareSelect ($ sql , $ bindings , $ whereInFile , $ writeToFile = null ): CurlerRequest
590
590
{
591
591
if ($ sql instanceof Query) {
592
592
return $ this ->getRequestWrite ($ sql );
@@ -603,7 +603,7 @@ private function prepareSelect($sql, $bindings, $whereInFile, $writeToFile = nul
603
603
* @return CurlerRequest
604
604
* @throws \ClickHouseDB\Exception\TransportException
605
605
*/
606
- private function prepareWrite ($ sql , $ bindings = [])
606
+ private function prepareWrite ($ sql , $ bindings = []): CurlerRequest
607
607
{
608
608
if ($ sql instanceof Query) {
609
609
return $ this ->getRequestWrite ($ sql );
@@ -617,7 +617,7 @@ private function prepareWrite($sql, $bindings = [])
617
617
* @return bool
618
618
* @throws \ClickHouseDB\Exception\TransportException
619
619
*/
620
- public function executeAsync ()
620
+ public function executeAsync (): bool
621
621
{
622
622
return $ this ->_curler ->execLoopWait ();
623
623
}
@@ -631,7 +631,7 @@ public function executeAsync()
631
631
* @throws \ClickHouseDB\Exception\TransportException
632
632
* @throws \Exception
633
633
*/
634
- public function select ($ sql , array $ bindings = [], $ whereInFile = null , $ writeToFile = null )
634
+ public function select ($ sql , array $ bindings = [], $ whereInFile = null , $ writeToFile = null ): Statement
635
635
{
636
636
$ request = $ this ->prepareSelect ($ sql , $ bindings , $ whereInFile , $ writeToFile );
637
637
$ this ->_curler ->execOne ($ request );
@@ -647,7 +647,7 @@ public function select($sql, array $bindings = [], $whereInFile = null, $writeTo
647
647
* @throws \ClickHouseDB\Exception\TransportException
648
648
* @throws \Exception
649
649
*/
650
- public function selectAsync ($ sql , array $ bindings = [], $ whereInFile = null , $ writeToFile = null )
650
+ public function selectAsync ($ sql , array $ bindings = [], $ whereInFile = null , $ writeToFile = null ): Statement
651
651
{
652
652
$ request = $ this ->prepareSelect ($ sql , $ bindings , $ whereInFile , $ writeToFile );
653
653
$ this ->_curler ->addQueLoop ($ request );
@@ -669,7 +669,7 @@ public function setProgressFunction(callable $callback) : void
669
669
* @return Statement
670
670
* @throws \ClickHouseDB\Exception\TransportException
671
671
*/
672
- public function write ($ sql , array $ bindings = [], $ exception = true )
672
+ public function write ($ sql , array $ bindings = [], $ exception = true ): Statement
673
673
{
674
674
$ request = $ this ->prepareWrite ($ sql , $ bindings );
675
675
$ this ->_curler ->execOne ($ request );
@@ -688,7 +688,7 @@ public function write($sql, array $bindings = [], $exception = true)
688
688
* @return Statement
689
689
* @throws \ClickHouseDB\Exception\TransportException
690
690
*/
691
- private function streaming (Stream $ streamRW , CurlerRequest $ request )
691
+ private function streaming (Stream $ streamRW , CurlerRequest $ request ): Statement
692
692
{
693
693
$ callable = $ streamRW ->getClosure ();
694
694
$ stream = $ streamRW ->getStream ();
@@ -757,7 +757,7 @@ private function streaming(Stream $streamRW, CurlerRequest $request)
757
757
* @return Statement
758
758
* @throws \ClickHouseDB\Exception\TransportException
759
759
*/
760
- public function streamRead (Stream $ streamRead , $ sql , $ bindings = [])
760
+ public function streamRead (Stream $ streamRead , $ sql , $ bindings = []): Statement
761
761
{
762
762
$ sql = $ this ->prepareQuery ($ sql , $ bindings );
763
763
$ request = $ this ->getRequestRead ($ sql );
@@ -772,7 +772,7 @@ public function streamRead(Stream $streamRead, $sql, $bindings = [])
772
772
* @return Statement
773
773
* @throws \ClickHouseDB\Exception\TransportException
774
774
*/
775
- public function streamWrite (Stream $ streamWrite , $ sql , $ bindings = [])
775
+ public function streamWrite (Stream $ streamWrite , $ sql , $ bindings = []): Statement
776
776
{
777
777
$ sql = $ this ->prepareQuery ($ sql , $ bindings );
778
778
$ request = $ this ->writeStreamData ($ sql );
0 commit comments