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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ composer.phar

# PHP CS Fixer
/.php-cs-fixer.cache
/.php-cs-fixer.php
12 changes: 12 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,23 @@
]);

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
],
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
])
->setFinder($finder);
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 2.0.1 under development

- no changes in this release.
Enh #246: Explicitly import functions and constants in "use" section (@mspirkov)

## 2.0.0 December 13, 2025

Expand Down
3 changes: 3 additions & 0 deletions src/Paginator/KeysetPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
use function reset;
use function sprintf;

use const SORT_ASC;
use const SORT_DESC;

/**
* Keyset paginator.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Reader/Iterable/IterableDataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
use function iterator_to_array;
use function uasort;

use const SORT_DESC;

/**
* Iterable data reader takes iterable data as a source and can:
*
Expand Down
2 changes: 2 additions & 0 deletions src/Reader/OrderHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use function substr;
use function trim;

use const PREG_SPLIT_NO_EMPTY;

/**
* @psalm-import-type TOrder from Sort
*/
Expand Down
3 changes: 3 additions & 0 deletions src/Reader/Sort.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use function is_int;
use function is_string;

use const SORT_ASC;
use const SORT_DESC;

/**
* Sort represents data sorting settings:
*
Expand Down
2 changes: 2 additions & 0 deletions tests/Paginator/KeysetPaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
use function reset;
use function sprintf;

use const SORT_ASC;

final class KeysetPaginatorTest extends TestCase
{
use PageTokenAssertTrait;
Expand Down
2 changes: 2 additions & 0 deletions tests/Paginator/OffsetPaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
use Yiisoft\Data\Tests\Support\StubOffsetData;
use Yiisoft\Data\Tests\TestCase;

use function sprintf;

final class OffsetPaginatorTest extends TestCase
{
use PageTokenAssertTrait;
Expand Down
3 changes: 3 additions & 0 deletions tests/Reader/SortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Yiisoft\Data\Reader\Sort;
use Yiisoft\Data\Tests\TestCase;

use const SORT_ASC;
use const SORT_DESC;

final class SortTest extends TestCase
{
public function testInvalidConfigWithoutFieldName(): void
Expand Down
2 changes: 2 additions & 0 deletions tests/Support/MutationDataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
use Yiisoft\Data\Reader\Sort;
use Yiisoft\Data\Reader\SortableDataInterface;

use function call_user_func;

final class MutationDataReader implements
ReadableDataInterface,
FilterableDataInterface,
Expand Down