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

chore(deps): remove thecodingmachine/phpstan-safe-rule #234

Merged
merged 1 commit into from
Jan 15, 2024
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
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"psalm/plugin-phpunit": "0.18.4",
"roave/infection-static-analysis-plugin": "^1.6",
"symfony/http-client": "^7.0",
"thecodingmachine/phpstan-safe-rule": "^1.0",
"vimeo/psalm": "^5.0.0"
},
"autoload": {
Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ parameters:
# There's no other way to test-pass without assertions while counting it towards coverage https://github.com/sebastianbergmann/phpunit/issues/3016
- '~Call to static method PHPUnit\\Framework\\Assert::assertTrue\(\) with true will always evaluate to true~'

# Adds unnecessary maintanence overhead. We rather rely on PHPStan telling us the method returns unhandled FALSE
- "~Class DateTime(Immutable)? is unsafe to use. Its methods can return FALSE instead of throwing an exception. Please add 'use Safe\\\\DateTime(Immutable)?;' at the beginning of the file to use the variant provided by the 'thecodingmachine/safe' library~"

# No need to have @throws in some phpunit related methods
- message: "~Method SimPod\\\\ClickHouseClient\\\\Tests\\\\.+?Test(CaseBase)?::(test.+?|provider.+?|setUp(BeforeClass)?|tearDown|setupClickHouseClient|tearDownDataBase)\\(\\) throws checked exception .+? but it's missing from the PHPDoc @throws tag~"
path: tests
Expand Down
4 changes: 4 additions & 0 deletions src/Sql/SqlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Exception\UnsupportedValue;

use function assert;
use function is_string;
use function Safe\preg_replace;
use function sprintf;
use function str_replace;
Expand All @@ -33,9 +35,11 @@ public function createWithParameters(string $query, array $parameters): string
str_replace('\\', '\\\\', $this->valueFormatter->format($value, $name, $query)),
$query,
);
assert(is_string($query));
}

$query = preg_replace('~ ?=([\s]*?)IS NULL~', '$1IS NULL', $query);
assert(is_string($query));

return $query;
}
Expand Down
Loading