Skip to content

Commit 05358f6

Browse files
committed
Add support php 8.4
1 parent ba32b01 commit 05358f6

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414
],
1515
"require": {
16-
"php": "^7.3|^8.0",
16+
"php": "^8.0",
1717
"ext-curl": "*",
1818
"ext-json": "*"
1919
},

src/Client.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,13 @@ public function settings()
292292
* @param string|null $useSessionId
293293
* @return $this
294294
*/
295-
public function useSession(string $useSessionId = null)
295+
public function useSession(string $useSessionId = '')
296296
{
297297
if (!$this->settings()->getSessionId()) {
298298
if (!$useSessionId) {
299299
$this->settings()->makeSessionId();
300300
} else {
301-
$this->settings()->session_id($useSessionId);
301+
$this->settings()->swhereInFileession_id($useSessionId);
302302
}
303303
}
304304
return $this;
@@ -383,14 +383,15 @@ public function enableExtremes(bool $flag = true)
383383
}
384384

385385
/**
386-
* @param mixed[] $bindings
386+
* @param string $sql
387+
* @param array $bindings
387388
* @return Statement
388389
*/
389390
public function select(
390391
string $sql,
391392
array $bindings = [],
392-
WhereInFile $whereInFile = null,
393-
WriteToFile $writeToFile = null
393+
?WhereInFile $whereInFile = null,
394+
?WriteToFile $writeToFile = null
394395
)
395396
{
396397
return $this->transport()->select($sql, $bindings, $whereInFile, $writeToFile);
@@ -437,8 +438,8 @@ public function progressFunction(callable $callback)
437438
public function selectAsync(
438439
string $sql,
439440
array $bindings = [],
440-
WhereInFile $whereInFile = null,
441-
WriteToFile $writeToFile = null
441+
?WhereInFile $whereInFile = null,
442+
?WriteToFile $writeToFile = null
442443
)
443444
{
444445
return $this->transport()->selectAsync($sql, $bindings, $whereInFile, $writeToFile);
@@ -805,14 +806,14 @@ public function isExists(string $database, string $table)
805806
/**
806807
* List of partitions
807808
*
808-
* @return mixed[][]
809+
* @return array
809810
* @throws \Exception
810811
*/
811-
public function partitions(string $table, int $limit = null, bool $active = null)
812+
public function partitions(string $table, int $limit = 0, ?bool $active = null)
812813
{
813814
$database = $this->settings()->getDatabase();
814815
$whereActiveClause = $active === null ? '' : sprintf(' AND active = %s', (int)$active);
815-
$limitClause = $limit !== null ? ' LIMIT ' . $limit : '';
816+
$limitClause = $limit > 0 ? ' LIMIT ' . $limit : '';
816817

817818
return $this->select(<<<CLICKHOUSE
818819
SELECT *

src/Transport/CurlerRequest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ public function __construct($id = false)
124124
CURLOPT_HEADER => TRUE,
125125
CURLOPT_FOLLOWLOCATION => TRUE,
126126
CURLOPT_AUTOREFERER => 1, // при редиректе подставлять в «Referer:» значение из «Location:»
127-
CURLOPT_BINARYTRANSFER => 1, // передавать в binary-safe
128127
CURLOPT_RETURNTRANSFER => TRUE,
129128
CURLOPT_USERAGENT => 'smi2/PHPClickHouse/client',
130129
);

tests/ClientTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private function create_fake_file($file_name, $size = 1, $file_type = 'CSV')
118118
fwrite($handle, json_encode($j) . PHP_EOL);
119119
break;
120120
default:
121-
fputcsv($handle, $j);
121+
fputcsv($handle, $j,",",'"',"\\");
122122
}
123123
$rows++;
124124
}
@@ -556,7 +556,7 @@ private function make_csv_SelectWhereIn($file_name, $array)
556556

557557
$handle = fopen($file_name, 'w');
558558
foreach ($array as $row) {
559-
fputcsv($handle, $row);
559+
fputcsv($handle, $row,",",'"',"\\");
560560
}
561561

562562
fclose($handle);

0 commit comments

Comments
 (0)