Avoid implicit conversion to boolean

parent 6f56a4c3
...@@ -98,7 +98,7 @@ final class DB2Connection implements ServerInfoAwareConnection ...@@ -98,7 +98,7 @@ final class DB2Connection implements ServerInfoAwareConnection
public function beginTransaction() : void public function beginTransaction() : void
{ {
if (! db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF)) { if (db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF) !== true) {
throw DB2Exception::fromConnectionError($this->conn); throw DB2Exception::fromConnectionError($this->conn);
} }
} }
...@@ -109,7 +109,7 @@ final class DB2Connection implements ServerInfoAwareConnection ...@@ -109,7 +109,7 @@ final class DB2Connection implements ServerInfoAwareConnection
throw DB2Exception::fromConnectionError($this->conn); throw DB2Exception::fromConnectionError($this->conn);
} }
if (! db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON)) { if (db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON) !== true) {
throw DB2Exception::fromConnectionError($this->conn); throw DB2Exception::fromConnectionError($this->conn);
} }
} }
...@@ -120,7 +120,7 @@ final class DB2Connection implements ServerInfoAwareConnection ...@@ -120,7 +120,7 @@ final class DB2Connection implements ServerInfoAwareConnection
throw DB2Exception::fromConnectionError($this->conn); throw DB2Exception::fromConnectionError($this->conn);
} }
if (! db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON)) { if (db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON) !== true) {
throw DB2Exception::fromConnectionError($this->conn); throw DB2Exception::fromConnectionError($this->conn);
} }
} }
......
...@@ -314,7 +314,7 @@ class Table extends AbstractAsset ...@@ -314,7 +314,7 @@ class Table extends AbstractAsset
*/ */
public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = [], ?string $name = null) : self public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = [], ?string $name = null) : self
{ {
if (! $name) { if ($name === null) {
$name = $this->_generateIdentifierName( $name = $this->_generateIdentifierName(
array_merge((array) $this->getName(), $localColumnNames), array_merge((array) $this->getName(), $localColumnNames),
'fk', 'fk',
...@@ -747,7 +747,7 @@ class Table extends AbstractAsset ...@@ -747,7 +747,7 @@ class Table extends AbstractAsset
{ {
$constraint->setLocalTable($this); $constraint->setLocalTable($this);
$name = strlen($constraint->getName()) $name = $constraint->getName() !== ''
? $constraint->getName() ? $constraint->getName()
: $this->_generateIdentifierName( : $this->_generateIdentifierName(
array_merge((array) $this->getName(), $constraint->getLocalColumns()), array_merge((array) $this->getName(), $constraint->getLocalColumns()),
...@@ -819,7 +819,7 @@ class Table extends AbstractAsset ...@@ -819,7 +819,7 @@ class Table extends AbstractAsset
*/ */
private function _createUniqueConstraint(array $columns, string $indexName, array $flags = [], array $options = []) : UniqueConstraint private function _createUniqueConstraint(array $columns, string $indexName, array $flags = [], array $options = []) : UniqueConstraint
{ {
if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName))) { if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName)) === 1) {
throw IndexNameInvalid::new($indexName); throw IndexNameInvalid::new($indexName);
} }
...@@ -847,7 +847,7 @@ class Table extends AbstractAsset ...@@ -847,7 +847,7 @@ class Table extends AbstractAsset
*/ */
private function _createIndex(array $columns, string $indexName, bool $isUnique, bool $isPrimary, array $flags = [], array $options = []) : Index private function _createIndex(array $columns, string $indexName, bool $isUnique, bool $isPrimary, array $flags = [], array $options = []) : Index
{ {
if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName))) { if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName)) === 1) {
throw IndexNameInvalid::new($indexName); throw IndexNameInvalid::new($indexName);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment