Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade CS #45

Merged
merged 1 commit into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<rule ref="Cdn77">
<exclude name="SlevomatCodingStandard.Files.LineLength"/>
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint" />
</rule>

<rule ref="SlevomatCodingStandard.Files.LineLength">
Expand Down
2 changes: 2 additions & 0 deletions src/Client/Http/RequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Client/PsrClickHouseAsyncClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Client/PsrClickHouseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/Exception/UnsupportedValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace SimPod\ClickHouseClient\Exception;

use InvalidArgumentException;

use function get_class;
use function gettype;
use function is_object;
Expand Down
1 change: 1 addition & 0 deletions src/Snippet/CurrentDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\JsonEachRow;

use function assert;
use function is_string;

Expand Down
1 change: 1 addition & 0 deletions src/Snippet/DatabaseSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Snippet/Parts.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\JsonEachRow;

use function Safe\sprintf;

final class Parts
Expand Down
1 change: 1 addition & 0 deletions src/Snippet/ShowCreateTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\JsonEachRow;
use Webmozart\Assert\Assert;

use function trim;

final class ShowCreateTable
Expand Down
1 change: 1 addition & 0 deletions src/Snippet/ShowDatabases.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/Snippet/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Format\JsonEachRow;

use function assert;
use function is_string;

Expand Down
4 changes: 3 additions & 1 deletion src/Sql/ValueFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use DateTimeImmutable;
use DateTimeZone;
use SimPod\ClickHouseClient\Exception\UnsupportedValueType;

use function array_map;
use function implode;
use function is_array;
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions tests/Client/SelectAsyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/Exception/UnsupportedValueTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions tests/Snippet/ShowCreateTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions tests/Snippet/ShowDatabasesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/Sql/ValueFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function providerFormat() : iterable

yield 'Stringable' => [
"'stringable'",
new class() {
new class () {
public function __toString() : string
{
return 'stringable';
Expand Down
1 change: 1 addition & 0 deletions tests/WithClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use function date_default_timezone_set;
use function error_reporting;

use const E_ALL;

require_once __DIR__ . '/../vendor/autoload.php';
Expand Down