diff --git a/psalm.xml b/psalm.xml
index 23bfcce1..5001d0a7 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -14,4 +14,7 @@
+
+
+
diff --git a/src/Command.php b/src/Command.php
index 5f8f71af..c7c665b7 100644
--- a/src/Command.php
+++ b/src/Command.php
@@ -14,7 +14,6 @@ final class Command extends AbstractPdoCommand
{
public function insertWithReturningPks(string $table, array $columns): bool|array
{
- /** @psalm-suppress RiskyTruthyFalsyComparison */
if (empty($this->db->getSchema()->getTableSchema($table)?->getPrimaryKey())) {
if ($this->insert($table, $columns)->execute() === 0) {
return false;
diff --git a/src/DDLQueryBuilder.php b/src/DDLQueryBuilder.php
index 6796a2c4..ad610ec0 100644
--- a/src/DDLQueryBuilder.php
+++ b/src/DDLQueryBuilder.php
@@ -191,17 +191,17 @@ private function buildAddCommentSql(string $comment, string $table, string $colu
throw new InvalidArgumentException("Table not found: $table");
}
- $schemaName = $tableSchema->getSchemaName() !== null
+ $schemaName = $tableSchema->getSchemaName()
? "N'" . (string) $tableSchema->getSchemaName() . "'" : 'SCHEMA_NAME()';
$tableName = 'N' . (string) $this->quoter->quoteValue($tableSchema->getName());
- $columnName = $column !== null ? 'N' . (string) $this->quoter->quoteValue($column) : null;
+ $columnName = $column ? 'N' . (string) $this->quoter->quoteValue($column) : null;
$comment = 'N' . (string) $this->quoter->quoteValue($comment);
$functionParams = "
@name = N'MS_description',
@value = $comment,
@level0type = N'SCHEMA', @level0name = $schemaName,
@level1type = N'TABLE', @level1name = $tableName"
- . ($column !== null ? ", @level2type = N'COLUMN', @level2name = $columnName" : '') . ';';
+ . ($column ? ", @level2type = N'COLUMN', @level2name = $columnName" : '') . ';';
return "
IF NOT EXISTS (
@@ -210,7 +210,7 @@ private function buildAddCommentSql(string $comment, string $table, string $colu
N'MS_description',
'SCHEMA', $schemaName,
'TABLE', $tableName,
- " . ($column !== null ? "'COLUMN', $columnName " : ' DEFAULT, DEFAULT ') . "
+ " . ($column ? "'COLUMN', $columnName " : ' DEFAULT, DEFAULT ') . "
)
)
EXEC sys.sp_addextendedproperty $functionParams
@@ -242,10 +242,10 @@ private function buildRemoveCommentSql(string $table, string $column = null): st
throw new InvalidArgumentException("Table not found: $table");
}
- $schemaName = $tableSchema->getSchemaName() !== null
+ $schemaName = $tableSchema->getSchemaName()
? "N'" . (string) $tableSchema->getSchemaName() . "'" : 'SCHEMA_NAME()';
$tableName = 'N' . (string) $this->quoter->quoteValue($tableSchema->getName());
- $columnName = $column !== null ? 'N' . (string) $this->quoter->quoteValue($column) : null;
+ $columnName = $column ? 'N' . (string) $this->quoter->quoteValue($column) : null;
return "
IF EXISTS (
@@ -254,14 +254,14 @@ private function buildRemoveCommentSql(string $table, string $column = null): st
N'MS_description',
'SCHEMA', $schemaName,
'TABLE', $tableName,
- " . ($column !== null ? "'COLUMN', $columnName " : ' DEFAULT, DEFAULT ') . "
+ " . ($column ? "'COLUMN', $columnName " : ' DEFAULT, DEFAULT ') . "
)
)
EXEC sys.sp_dropextendedproperty
@name = N'MS_description',
@level0type = N'SCHEMA', @level0name = $schemaName,
@level1type = N'TABLE', @level1name = $tableName"
- . ($column !== null ? ", @level2type = N'COLUMN', @level2name = $columnName" : '') . ';';
+ . ($column ? ", @level2type = N'COLUMN', @level2name = $columnName" : '') . ';';
}
/**
diff --git a/src/DMLQueryBuilder.php b/src/DMLQueryBuilder.php
index d0d33393..4d68e3d6 100644
--- a/src/DMLQueryBuilder.php
+++ b/src/DMLQueryBuilder.php
@@ -35,7 +35,6 @@ public function insertWithReturningPks(string $table, QueryInterface|array $colu
$tableSchema = $this->schema->getTableSchema($table);
$primaryKeys = $tableSchema?->getPrimaryKey();
- /** @psalm-suppress RiskyTruthyFalsyComparison */
if (empty($primaryKeys)) {
return $this->insert($table, $columns, $params);
}
diff --git a/src/Dsn.php b/src/Dsn.php
index 21907955..24137bb0 100644
--- a/src/Dsn.php
+++ b/src/Dsn.php
@@ -45,7 +45,7 @@ public function asString(): string
$server = "Server=$this->host;";
}
- if ($this->databaseName !== null && $this->databaseName !== '') {
+ if (!empty($this->databaseName)) {
$dsn = "$this->driver:" . $server . "Database=$this->databaseName";
} else {
$dsn = "$this->driver:" . $server;
diff --git a/src/Schema.php b/src/Schema.php
index 1215fa52..ca7a32c5 100644
--- a/src/Schema.php
+++ b/src/Schema.php
@@ -186,7 +186,7 @@ protected function findSchemaNames(): array
*/
protected function findTableComment(TableSchemaInterface $tableSchema): void
{
- $schemaName = $tableSchema->getSchemaName() !== null
+ $schemaName = $tableSchema->getSchemaName()
? "N'" . (string) $tableSchema->getSchemaName() . "'" : 'SCHEMA_NAME()';
$tableName = 'N' . (string) $this->db->getQuoter()->quoteValue($tableSchema->getName());