diff --git a/composer.json b/composer.json
index e966320..a99648f 100644
--- a/composer.json
+++ b/composer.json
@@ -30,7 +30,7 @@
"thecodingmachine/safe": "^1.0"
},
"require-dev": {
- "cdn77/coding-standard": "^3.0",
+ "cdn77/coding-standard": "^4.0",
"infection/infection": "^0.16.0",
"nyholm/psr7": "^1.2",
"php-http/curl-client": "^2.1",
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index c8ad423..c3adc0d 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -14,6 +14,7 @@
+
diff --git a/src/Client/Http/RequestFactory.php b/src/Client/Http/RequestFactory.php
index b731098..44c6cfa 100644
--- a/src/Client/Http/RequestFactory.php
+++ b/src/Client/Http/RequestFactory.php
@@ -8,7 +8,9 @@
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UriFactoryInterface;
+
use function http_build_query;
+
use const PHP_QUERY_RFC3986;
final class RequestFactory
diff --git a/src/Client/PsrClickHouseAsyncClient.php b/src/Client/PsrClickHouseAsyncClient.php
index 2c602c6..867b356 100644
--- a/src/Client/PsrClickHouseAsyncClient.php
+++ b/src/Client/PsrClickHouseAsyncClient.php
@@ -16,6 +16,7 @@
use SimPod\ClickHouseClient\Output\Output;
use SimPod\ClickHouseClient\Sql\SqlFactory;
use SimPod\ClickHouseClient\Sql\ValueFormatter;
+
use function GuzzleHttp\Promise\promise_for;
class PsrClickHouseAsyncClient implements ClickHouseAsyncClient
diff --git a/src/Client/PsrClickHouseClient.php b/src/Client/PsrClickHouseClient.php
index cb2d7d1..c471a29 100644
--- a/src/Client/PsrClickHouseClient.php
+++ b/src/Client/PsrClickHouseClient.php
@@ -17,6 +17,7 @@
use SimPod\ClickHouseClient\Sql\Escaper;
use SimPod\ClickHouseClient\Sql\SqlFactory;
use SimPod\ClickHouseClient\Sql\ValueFormatter;
+
use function array_key_first;
use function array_keys;
use function array_map;
diff --git a/src/Exception/UnsupportedValueType.php b/src/Exception/UnsupportedValueType.php
index a727164..9af2830 100644
--- a/src/Exception/UnsupportedValueType.php
+++ b/src/Exception/UnsupportedValueType.php
@@ -5,6 +5,7 @@
namespace SimPod\ClickHouseClient\Exception;
use InvalidArgumentException;
+
use function get_class;
use function gettype;
use function is_object;
diff --git a/src/Snippet/CurrentDatabase.php b/src/Snippet/CurrentDatabase.php
index 698bb2e..f3f05a5 100644
--- a/src/Snippet/CurrentDatabase.php
+++ b/src/Snippet/CurrentDatabase.php
@@ -6,6 +6,7 @@
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\JsonEachRow;
+
use function assert;
use function is_string;
diff --git a/src/Snippet/DatabaseSize.php b/src/Snippet/DatabaseSize.php
index 75d080b..8df96b1 100644
--- a/src/Snippet/DatabaseSize.php
+++ b/src/Snippet/DatabaseSize.php
@@ -7,6 +7,7 @@
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\JsonEachRow;
use SimPod\ClickHouseClient\Sql\Expression;
+
use function assert;
final class DatabaseSize
diff --git a/src/Snippet/Parts.php b/src/Snippet/Parts.php
index f9163f7..13eb52f 100644
--- a/src/Snippet/Parts.php
+++ b/src/Snippet/Parts.php
@@ -6,6 +6,7 @@
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\JsonEachRow;
+
use function Safe\sprintf;
final class Parts
diff --git a/src/Snippet/ShowCreateTable.php b/src/Snippet/ShowCreateTable.php
index 32758a8..1907726 100644
--- a/src/Snippet/ShowCreateTable.php
+++ b/src/Snippet/ShowCreateTable.php
@@ -7,6 +7,7 @@
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\JsonEachRow;
use Webmozart\Assert\Assert;
+
use function trim;
final class ShowCreateTable
diff --git a/src/Snippet/ShowDatabases.php b/src/Snippet/ShowDatabases.php
index 619eae3..d14d587 100644
--- a/src/Snippet/ShowDatabases.php
+++ b/src/Snippet/ShowDatabases.php
@@ -6,6 +6,7 @@
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\JsonEachRow;
+
use function array_map;
use function assert;
use function is_string;
diff --git a/src/Snippet/Version.php b/src/Snippet/Version.php
index 117f24a..47cb0dc 100644
--- a/src/Snippet/Version.php
+++ b/src/Snippet/Version.php
@@ -6,6 +6,7 @@
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\JsonEachRow;
+
use function assert;
use function is_string;
diff --git a/src/Sql/ValueFormatter.php b/src/Sql/ValueFormatter.php
index 7e74299..7ca8fca 100644
--- a/src/Sql/ValueFormatter.php
+++ b/src/Sql/ValueFormatter.php
@@ -7,6 +7,7 @@
use DateTimeImmutable;
use DateTimeZone;
use SimPod\ClickHouseClient\Exception\UnsupportedValueType;
+
use function array_map;
use function implode;
use function is_array;
@@ -70,7 +71,8 @@ public function format($value, ?string $paramName = null, ?string $sql = null) :
}
if (is_array($value)) {
- if ($paramName !== null && $sql !== null
+ if (
+ $paramName !== null && $sql !== null
&& preg_match(sprintf('~\s+IN\s+\\(:%s\\)~', $paramName), $sql) === 1
) {
return implode(
diff --git a/tests/Client/SelectAsyncTest.php b/tests/Client/SelectAsyncTest.php
index ce534e4..8c8c54f 100644
--- a/tests/Client/SelectAsyncTest.php
+++ b/tests/Client/SelectAsyncTest.php
@@ -9,6 +9,7 @@
use SimPod\ClickHouseClient\Format\TabSeparated;
use SimPod\ClickHouseClient\Tests\TestCaseBase;
use SimPod\ClickHouseClient\Tests\WithClient;
+
use function GuzzleHttp\Promise\all;
final class SelectAsyncTest extends TestCaseBase
diff --git a/tests/Exception/UnsupportedValueTypeTest.php b/tests/Exception/UnsupportedValueTypeTest.php
index 6d76cd8..434a53a 100644
--- a/tests/Exception/UnsupportedValueTypeTest.php
+++ b/tests/Exception/UnsupportedValueTypeTest.php
@@ -8,6 +8,7 @@
use SimPod\ClickHouseClient\Exception\UnsupportedValueType;
use SimPod\ClickHouseClient\Tests\TestCaseBase;
use stdClass;
+
use function Safe\opendir;
/** @covers \SimPod\ClickHouseClient\Exception\UnsupportedValueType */
diff --git a/tests/Snippet/ShowCreateTableTest.php b/tests/Snippet/ShowCreateTableTest.php
index e7fbeb0..ad7431c 100644
--- a/tests/Snippet/ShowCreateTableTest.php
+++ b/tests/Snippet/ShowCreateTableTest.php
@@ -7,6 +7,7 @@
use SimPod\ClickHouseClient\Snippet\ShowCreateTable;
use SimPod\ClickHouseClient\Tests\TestCaseBase;
use SimPod\ClickHouseClient\Tests\WithClient;
+
use function Safe\preg_replace;
use function str_replace;
diff --git a/tests/Snippet/ShowDatabasesTest.php b/tests/Snippet/ShowDatabasesTest.php
index a89b0db..9979d32 100644
--- a/tests/Snippet/ShowDatabasesTest.php
+++ b/tests/Snippet/ShowDatabasesTest.php
@@ -7,6 +7,7 @@
use SimPod\ClickHouseClient\Snippet\ShowDatabases;
use SimPod\ClickHouseClient\Tests\TestCaseBase;
use SimPod\ClickHouseClient\Tests\WithClient;
+
use function array_filter;
use function array_shift;
use function array_values;
diff --git a/tests/Sql/ValueFormatterTest.php b/tests/Sql/ValueFormatterTest.php
index 1ad9a13..421f98d 100644
--- a/tests/Sql/ValueFormatterTest.php
+++ b/tests/Sql/ValueFormatterTest.php
@@ -55,7 +55,7 @@ public function providerFormat() : iterable
yield 'Stringable' => [
"'stringable'",
- new class() {
+ new class () {
public function __toString() : string
{
return 'stringable';
diff --git a/tests/WithClient.php b/tests/WithClient.php
index 59bc295..2b654ed 100644
--- a/tests/WithClient.php
+++ b/tests/WithClient.php
@@ -13,6 +13,7 @@
use SimPod\ClickHouseClient\Client\Http\RequestFactory;
use SimPod\ClickHouseClient\Client\PsrClickHouseAsyncClient;
use SimPod\ClickHouseClient\Client\PsrClickHouseClient;
+
use function assert;
use function getenv;
use function is_string;
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 25157db..9763af0 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -6,6 +6,7 @@
use function date_default_timezone_set;
use function error_reporting;
+
use const E_ALL;
require_once __DIR__ . '/../vendor/autoload.php';