Skip to content

Commit

Permalink
chore(deps): remove thecodingmachine/phpstan-safe-rule
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Jan 15, 2024
1 parent c8e8cdd commit 8041f3f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

0 comments on commit 8041f3f

Please sign in to comment.