diff --git a/src/Builder/JsonExpressionBuilder.php b/src/Builder/JsonExpressionBuilder.php index fda5e123..a2dbd7b8 100644 --- a/src/Builder/JsonExpressionBuilder.php +++ b/src/Builder/JsonExpressionBuilder.php @@ -19,7 +19,7 @@ use function count; /** - * Builds expressions for {@see `Yiisoft\Db\Expression\JsonExpression`} for MySQL, MariaDb Server. + * Builds expressions for {@see `Yiisoft\Db\Expression\JsonExpression`} for MySQL, MariaDB. */ final class JsonExpressionBuilder implements ExpressionBuilderInterface { diff --git a/src/Column.php b/src/Column.php index 6a1f39b9..15e53136 100644 --- a/src/Column.php +++ b/src/Column.php @@ -6,13 +6,12 @@ use Exception; use Yiisoft\Db\Schema\Builder\AbstractColumn; -use Yiisoft\Db\Schema\QuoterInterface; /** - * It's a utility that provides a convenient way to create column schema for use with {@see `\Yiisoft\Db\Mysql\Schema`} - * for MySQL, MariaDb Server. + * Provides a convenient way to create column schema for use with {@see `\Yiisoft\Db\Mysql\Schema`} + * for MySQL, MariaDB. * - * It provides methods for specifying the properties of a column, such as its type, size, default value, and whether it + * It has methods for specifying the properties of a column, such as its type, size, default value, and whether it * is nullable or not. It also provides a method for creating a column schema based on the specified properties. * * For example, the following code creates a column schema for an integer column: @@ -26,12 +25,10 @@ */ final class Column extends AbstractColumn { - private QuoterInterface|null $quoter = null; - /** * Builds the unsigned string for column. Defaults to unsupported. * - * @return string a string containing UNSIGNED keyword. + * @return string A string containing `UNSIGNED` keyword. */ protected function buildUnsignedString(): string { @@ -43,7 +40,7 @@ protected function buildUnsignedString(): string * * @throws Exception * - * @return string a string containing the COMMENT keyword and the comment itself. + * @return string A string containing the `COMMENT` keyword and the comment itself. */ protected function buildCommentString(): string { diff --git a/src/ColumnSchema.php b/src/ColumnSchema.php index e3d849d6..529fb05d 100644 --- a/src/ColumnSchema.php +++ b/src/ColumnSchema.php @@ -13,11 +13,11 @@ use function json_decode; /** - * Represents the metadata of a column in a database table for MySQL, MariaDb Server. + * Represents the metadata of a column in a database table for MySQL, MariaDB. * * It provides information about the column's name, type, size, precision, and other details. * - * Is used to store and retrieve metadata about a column in a database table. It's typically used in conjunction with + * It's used to store and retrieve metadata about a column in a database table, typically in conjunction with * the {@see TableSchema}, which represents the metadata of a database table as a whole. * * The following code shows how to use: @@ -43,7 +43,7 @@ final class ColumnSchema extends AbstractColumnSchema * * If the value is `null` or an {@see \Yiisoft\Db\Expression\Expression}, it won't be converted. * - * @param mixed $value The value to be converted. + * @param mixed $value The value to convert. * * @throws JsonException If the value can't be decoded. * @@ -67,7 +67,7 @@ public function phpTypecast(mixed $value): mixed * * If the value is `null` or an {@see \Yiisoft\Db\Expression\Expression}, it won't be converted. * - * @param mixed $value The value to be converted. + * @param mixed $value The value to convert. * * @return mixed The converted value. This may also be an array containing the value as the first element and the * PDO type as the second element. diff --git a/src/CommandPDO.php b/src/CommandPDO.php index 4eb685a0..bc0e382d 100644 --- a/src/CommandPDO.php +++ b/src/CommandPDO.php @@ -12,8 +12,8 @@ use Yiisoft\Db\QueryBuilder\QueryBuilderInterface; /** - * Implements a database command that can be executed against a PDO (PHP Data Object) database connection for MySQL, - * MariaDb Server. + * Implements a database command that can be executed with a PDO (PHP Data Object) database connection for MySQL, + * MariaDB. */ final class CommandPDO extends AbstractCommandPDO { diff --git a/src/ConnectionPDO.php b/src/ConnectionPDO.php index de6aa3fb..811aad20 100644 --- a/src/ConnectionPDO.php +++ b/src/ConnectionPDO.php @@ -14,7 +14,7 @@ use Yiisoft\Db\Transaction\TransactionInterface; /** - * Implements a connection to a database via PDO (PHP Data Objects) for MySQL, MariaDb Server. + * Implements a connection to a database via PDO (PHP Data Objects) for MySQL, MariaDB. * * @link https://www.php.net/manual/en/ref.pdo-mysql.php */ diff --git a/src/DDLQueryBuilder.php b/src/DDLQueryBuilder.php index 152775bd..d0924253 100644 --- a/src/DDLQueryBuilder.php +++ b/src/DDLQueryBuilder.php @@ -17,7 +17,7 @@ use function trim; /** - * Implements a (Data Definition Language) SQL statements for MySQL, MariaDb Server. + * Implements a (Data Definition Language) SQL statements for MySQL, MariaDB. */ final class DDLQueryBuilder extends AbstractDDLQueryBuilder { diff --git a/src/DMLQueryBuilder.php b/src/DMLQueryBuilder.php index e8d7b6b0..46e46bee 100644 --- a/src/DMLQueryBuilder.php +++ b/src/DMLQueryBuilder.php @@ -21,7 +21,7 @@ use function reset; /** - * Implements a DML (Data Manipulation Language) SQL statements for MySQL, MariaDb Server. + * Implements a DML (Data Manipulation Language) SQL statements for MySQL, MariaDB. */ final class DMLQueryBuilder extends AbstractDMLQueryBuilder { @@ -115,9 +115,9 @@ public function upsert( /** * Prepares a `VALUES` part for an `INSERT` SQL statement. * - * @param string $table The table that new rows will be inserted into. - * @param array|QueryInterface $columns The column data (name => value) to be inserted into the table or instance of - * {@see Query} to perform INSERT INTO ... SELECT SQL statement. + * @param string $table The table to insert new rows into. + * @param array|QueryInterface $columns The column data (name => value) to insert into the table or instance of + * {@see Query} to perform `INSERT INTO ... SELECT` SQL statement. * @param array $params The binding parameters that will be generated by this method. * They should be bound to the DB command later. * @@ -126,7 +126,7 @@ public function upsert( * @throws InvalidConfigException * @throws NotSupportedException * - * @return array Array of column names, placeholders, values and params. + * @return array Array of column names, placeholders, values, and params. */ protected function prepareInsertValues(string $table, QueryInterface|array $columns, array $params = []): array { diff --git a/src/DQLQueryBuilder.php b/src/DQLQueryBuilder.php index 90082b13..294398fd 100644 --- a/src/DQLQueryBuilder.php +++ b/src/DQLQueryBuilder.php @@ -14,7 +14,7 @@ use function ctype_digit; /** - * Implements a DQL (Data Query Language) SQL statements for MySQL, MariaDb Server. + * Implements a DQL (Data Query Language) SQL statements for MySQL, MariaDB. */ final class DQLQueryBuilder extends AbstractDQLQueryBuilder { diff --git a/src/Dsn.php b/src/Dsn.php index 05085aeb..4c46a050 100644 --- a/src/Dsn.php +++ b/src/Dsn.php @@ -7,7 +7,7 @@ use Yiisoft\Db\Connection\AbstractDsn; /** - * Implement a Data Source Name (DSN) for an MySQL, MariaDb Server. + * Implement a Data Source Name (DSN) for an MySQL, MariaDB. * * @link https://www.php.net/manual/en/ref.pdo-mysql.connection.php */ diff --git a/src/DsnSocket.php b/src/DsnSocket.php index a0f6d1b5..d136613b 100644 --- a/src/DsnSocket.php +++ b/src/DsnSocket.php @@ -7,7 +7,7 @@ use Yiisoft\Db\Connection\AbstractDsnSocket; /** - * Implement a Data Source Name (DSN) with unix socket for an MySQL, MariaDb Server. + * Implement a Data Source Name (DSN) with unix socket for an MySQL, MariaDB. * * @link https://www.php.net/manual/en/ref.pdo-mysql.connection.php */ diff --git a/src/PDODriver.php b/src/PDODriver.php index acecbfa2..8ba6b3fa 100644 --- a/src/PDODriver.php +++ b/src/PDODriver.php @@ -8,7 +8,7 @@ use Yiisoft\Db\Driver\PDO\AbstractPDODriver; /** - * Implements the MySQL, MariaDb Server driver based on the PDO (PHP Data Objects) extension. + * Implements the MySQL, MariaDB driver based on the PDO (PHP Data Objects) extension. * * @link https://www.php.net/manual/en/ref.pdo-mysql.php */ @@ -28,7 +28,7 @@ public function createConnection(): PDO $pdo->exec('SET NAMES ' . $pdo->quote($this->charset)); } - if (!str_contains($this->dsn, 'charset') && $this->charset === null) { + if ($this->charset === null && !str_contains($this->dsn, 'charset')) { $pdo->exec('SET NAMES ' . $pdo->quote('utf8mb4')); } diff --git a/src/QueryBuilder.php b/src/QueryBuilder.php index 3abecf30..2143f703 100644 --- a/src/QueryBuilder.php +++ b/src/QueryBuilder.php @@ -10,7 +10,7 @@ use Yiisoft\Db\Schema\SchemaInterface; /** - * Implements the MySQL, MariaDb Server specific query builder. + * Implements MySQL, MariaDB specific query builder. */ final class QueryBuilder extends AbstractQueryBuilder { diff --git a/src/Quoter.php b/src/Quoter.php index 1c3c7169..3a17061b 100644 --- a/src/Quoter.php +++ b/src/Quoter.php @@ -10,7 +10,7 @@ use function str_replace; /** - * Implements the MySQL, MariaDb Server quoting and unquoting methods. + * Implements MySQL, MariaDB quoting and unquoting methods. */ final class Quoter extends BaseQuoter { diff --git a/src/Schema.php b/src/Schema.php index 954bd491..c2ce972a 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -37,8 +37,7 @@ use function trim; /** - * Implements the Mysql, Mariadb Server specific schema, supporting Mysql Server 5.7, Mariadb Server 10.4 and higher - * versions. + * Implements MySQL, MariaDB specific schema, supporting MySQL Server 5.7, MariaDB Server 10.4 and higher. * * @psalm-type ColumnArray = array{ * table_schema: string, @@ -193,7 +192,7 @@ protected function findColumns(TableSchemaInterface $table): bool try { $columns = $this->db->createCommand($sql)->queryAll(); - // Chapter 1: cruthes for MariaDB. {@see https://github.com/yiisoft/yii2/issues/19747} + // Chapter 1: crutches for MariaDB. {@see https://github.com/yiisoft/yii2/issues/19747} $columnsExtra = []; if (str_contains($this->db->getServerVersion(), 'MariaDB')) { /** @psalm-var array[] $columnsExtra */ @@ -430,7 +429,7 @@ protected function getCacheTag(): string } /** - * Gets the CREATE TABLE sql string. + * Gets the `CREATE TABLE` SQL string. * * @param TableSchemaInterface $table The table metadata. * @@ -438,7 +437,7 @@ protected function getCacheTag(): string * @throws InvalidConfigException * @throws Throwable * - * @return string $sql The result of 'SHOW CREATE TABLE'. + * @return string $sql The result of `SHOW CREATE TABLE`. */ protected function getCreateTableSql(TableSchemaInterface $table): string { @@ -521,10 +520,10 @@ protected function loadColumnSchema(array $info): ColumnSchemaInterface $column->scale((int) $values[1]); } - if ($column->getSize() === 1 && $type === 'bit') { - $column->type(self::TYPE_BOOLEAN); - } elseif ($type === 'bit') { - if ($column->getSize() > 32) { + if ($type === 'bit') { + if ($column->getSize() === 1) { + $column->type(self::TYPE_BOOLEAN); + } elseif ($column->getSize() > 32) { $column->type(self::TYPE_BIGINT); } elseif ($column->getSize() === 32) { $column->type(self::TYPE_INTEGER); @@ -537,7 +536,7 @@ protected function loadColumnSchema(array $info): ColumnSchemaInterface $column->phpType($this->getColumnPhpType($column)); if (!$column->isPrimaryKey()) { - // Chapter 2: cruthes for MariaDB {@see https://github.com/yiisoft/yii2/issues/19747} + // Chapter 2: crutches for MariaDB {@see https://github.com/yiisoft/yii2/issues/19747} /** @psalm-var string $columnCategory */ $columnCategory = $this->createColumn( $column->getType(), diff --git a/src/TableSchema.php b/src/TableSchema.php index 136bc892..a45053d2 100644 --- a/src/TableSchema.php +++ b/src/TableSchema.php @@ -7,7 +7,7 @@ use Yiisoft\Db\Schema\AbstractTableSchema; /** - * Implements the MySQL, MariaDb Server specific table schema. + * Implements MySQL, MariaDB specific table schema. */ final class TableSchema extends AbstractTableSchema { diff --git a/src/TransactionPDO.php b/src/TransactionPDO.php index 33d7c5a3..10c398c7 100644 --- a/src/TransactionPDO.php +++ b/src/TransactionPDO.php @@ -7,7 +7,7 @@ use Yiisoft\Db\Driver\PDO\AbstractTransactionPDO; /** - * Implements the MySQL, MariaDb Server specific transaction. + * Implements the MySQL, MariaDB specific transaction. */ final class TransactionPDO extends AbstractTransactionPDO {