Skip to content
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
4 changes: 4 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@
]);

return (new Config())
->setRiskyAllowed(true)
->setParallelConfig(ParallelConfigFactory::detect())
->setRules([
'@PER-CS3.0' => true,
'no_unused_imports' => true,
'ordered_class_elements' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one']],
'declare_strict_types' => true,
'native_function_invocation' => true,
'native_constant_invocation' => true,
'fully_qualified_strict_types' => [
'import_symbols' => true
],
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

- Bug #1127: Fix `AbstractSchema::hasTable()` and `AbstractSchema::hasView()` methods to support names quoted with curly
brackets `{{%table}}` (@batyrmastyr)
- Enh #1145: Explicitly import classes, functions, and constants in "use" section (@mspirkov)
- Enh #1145, #1148: Explicitly import classes, functions, and constants in "use" section (@mspirkov)
- Enh #1148: Add `declare(strict_types=1)` to `Yiisoft\Db\Constant\ColumnInfoSource` (@mspirkov)

## 2.0.0 December 05, 2025

Expand Down
2 changes: 2 additions & 0 deletions src/Constant/ColumnInfoSource.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Db\Constant;

use Yiisoft\Db\Schema\Column\ColumnFactoryInterface;
Expand Down
3 changes: 3 additions & 0 deletions src/Debug/CommandInterfaceProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\Schema\Column\ColumnInterface;

use function count;
use function func_get_args;

final class CommandInterfaceProxy implements CommandInterface
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions src/Debug/DatabaseCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Yiisoft\Yii\Debug\Collector\CollectorTrait;
use Yiisoft\Yii\Debug\Collector\SummaryCollectorInterface;

use function count;

final class DatabaseCollector implements SummaryCollectorInterface
{
use CollectorTrait;
Expand Down
2 changes: 2 additions & 0 deletions src/Debug/TransactionInterfaceDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use Yiisoft\Db\Transaction\TransactionInterface;

use function func_get_args;

final class TransactionInterfaceDecorator implements TransactionInterface
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/ConvertException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use PDOException;

use const PHP_EOL;

/**
* Converts an exception into a more specific one.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use Stringable;

use const PHP_EOL;

/**
* Represents an exception that's caused by some DB-related operations.
*
Expand Down
4 changes: 4 additions & 0 deletions src/Helper/DbArrayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
use function iterator_to_array;
use function range;

use const PREG_SPLIT_NO_EMPTY;
use const SORT_ASC;
use const SORT_NUMERIC;

/**
* Array manipulation methods.
*
Expand Down
1 change: 1 addition & 0 deletions src/Helper/DbUuidHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use function hex2bin;
use function preg_match;
use function str_replace;
use function strlen;

final class DbUuidHelper
{
Expand Down
5 changes: 5 additions & 0 deletions src/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
use function substr;
use function trim;

use const PHP_INT_MAX;
use const PREG_SPLIT_NO_EMPTY;
use const SORT_ASC;
use const SORT_DESC;

/**
* Represents a `SELECT` SQL statement in a way that's independent of DBMS.
*
Expand Down
2 changes: 2 additions & 0 deletions src/QueryBuilder/AbstractDDLQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use function is_string;
use function preg_split;

use const PREG_SPLIT_NO_EMPTY;

/**
* It's used to create and change the structure of database objects in a database.
*
Expand Down
3 changes: 3 additions & 0 deletions src/QueryBuilder/AbstractDQLQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
use function strtoupper;
use function trim;

use const PREG_SPLIT_NO_EMPTY;
use const SORT_DESC;

/**
* It's used to query data from a database.
*
Expand Down
1 change: 1 addition & 0 deletions src/QueryBuilder/Condition/Simple.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Yiisoft\Db\Expression\ExpressionInterface;

use function array_key_exists;
use function is_string;

/**
* Represents a simple condition like `"column" operator value`.
Expand Down
2 changes: 2 additions & 0 deletions src/Schema/Column/BitColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Yiisoft\Db\Constant\ColumnType;
use Yiisoft\Db\Expression\ExpressionInterface;

use function is_int;

/**
* Represents the metadata for a bit column.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Schema/Column/ColumnBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use Yiisoft\Db\Constant\ColumnType;

use const PHP_INT_SIZE;

/**
* Column builder for database {@see ColumnInterface} instances.
*
Expand Down
2 changes: 2 additions & 0 deletions tests/Common/CommonColumnFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use Yiisoft\Db\Tests\Provider\ColumnFactoryProvider;
use Yiisoft\Db\Tests\Support\IntegrationTestCase;

use function is_scalar;

abstract class CommonColumnFactoryTest extends IntegrationTestCase
{
public function testConstructColumnClassMap(): void
Expand Down
4 changes: 4 additions & 0 deletions tests/Common/CommonCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
use function is_string;
use function setlocale;
use function str_starts_with;
use function count;
use function is_resource;

use const LC_NUMERIC;

abstract class CommonCommandTest extends IntegrationTestCase
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Common/CommonQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@
use function PHPUnit\Framework\assertEmpty;
use function PHPUnit\Framework\assertSame;
use function sort;
use function in_array;

use const SORT_NATURAL;
use const SORT_ASC;
use const SORT_DESC;

abstract class CommonQueryBuilderTest extends IntegrationTestCase
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Common/CommonQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

use function array_keys;

use const SORT_ASC;
use const SORT_DESC;

abstract class CommonQueryTest extends IntegrationTestCase
{
public function testAddGroupByExpression(): void
Expand Down
2 changes: 2 additions & 0 deletions tests/Db/Driver/Pdo/PdoDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use SensitiveParameterValue;
use TypeError;

use const PHP_VERSION_ID;

/**
* @group db
*
Expand Down
2 changes: 2 additions & 0 deletions tests/Db/Exception/ConvertExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use PHPUnit\Framework\TestCase;
use Yiisoft\Db\Exception\ConvertException;

use const PHP_EOL;

/**
* @group db
*
Expand Down
2 changes: 2 additions & 0 deletions tests/Db/Helper/DbArrayHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use Yiisoft\Db\Tests\Provider\DbArrayHelperProvider;
use Exception;

use const E_WARNING;

/**
* @group db
*/
Expand Down
2 changes: 2 additions & 0 deletions tests/Db/Query/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

use function PHPUnit\Framework\assertSame;

use const SORT_DESC;

/**
* @group db
*/
Expand Down
2 changes: 2 additions & 0 deletions tests/Db/QueryBuilder/QueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
use function fopen;
use function stream_context_create;

use const SORT_DESC;

/**
* @group db
*/
Expand Down
2 changes: 2 additions & 0 deletions tests/Provider/QueryBuilderProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

use function fopen;

use const PREG_SET_ORDER;

class QueryBuilderProvider
{
protected static string $likeEscapeCharSql = '';
Expand Down
2 changes: 2 additions & 0 deletions tests/Provider/SchemaProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use Yiisoft\Db\Constraint\Index;
use Yiisoft\Db\Schema\SchemaInterface;

use function sprintf;

class SchemaProvider
{
public static function columns(): array
Expand Down
1 change: 1 addition & 0 deletions tests/Support/AnyCaseValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Yiisoft\Db\Tests\Support;

use function strtolower;
use function is_array;

final class AnyCaseValue extends CompareValue
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Support/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
use function ksort;
use function ltrim;
use function strtolower;
use function count;

use const SORT_STRING;

/**
* @psalm-suppress PropertyNotSetInConstructor
Expand Down
2 changes: 2 additions & 0 deletions tests/Support/TraversableObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Exception;
use Iterator;

use function array_key_exists;

/**
* TraversableObject
*
Expand Down
Loading