Skip to content

Commit dfd9d06

Browse files
authored
Update the PHP CS Fixer configuration (#246)
1 parent 3280c53 commit dfd9d06

File tree

11 files changed

+33
-1
lines changed

11 files changed

+33
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ composer.phar
2929

3030
# PHP CS Fixer
3131
/.php-cs-fixer.cache
32+
/.php-cs-fixer.php

.php-cs-fixer.dist.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,23 @@
1212
]);
1313

1414
return (new Config())
15+
->setRiskyAllowed(true)
1516
->setParallelConfig(ParallelConfigFactory::detect())
1617
->setRules([
1718
'@PER-CS3.0' => true,
1819
'no_unused_imports' => true,
1920
'ordered_class_elements' => true,
2021
'class_attributes_separation' => ['elements' => ['method' => 'one']],
22+
'declare_strict_types' => true,
23+
'native_function_invocation' => true,
24+
'native_constant_invocation' => true,
25+
'fully_qualified_strict_types' => [
26+
'import_symbols' => true
27+
],
28+
'global_namespace_import' => [
29+
'import_classes' => true,
30+
'import_constants' => true,
31+
'import_functions' => true,
32+
],
2133
])
2234
->setFinder($finder);

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 2.0.1 under development
44

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

77
## 2.0.0 December 13, 2025
88

src/Paginator/KeysetPaginator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
use function reset;
2626
use function sprintf;
2727

28+
use const SORT_ASC;
29+
use const SORT_DESC;
30+
2831
/**
2932
* Keyset paginator.
3033
*

src/Reader/Iterable/IterableDataReader.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
use function iterator_to_array;
3434
use function uasort;
3535

36+
use const SORT_DESC;
37+
3638
/**
3739
* Iterable data reader takes iterable data as a source and can:
3840
*

src/Reader/OrderHelper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use function substr;
1010
use function trim;
1111

12+
use const PREG_SPLIT_NO_EMPTY;
13+
1214
/**
1315
* @psalm-import-type TOrder from Sort
1416
*/

src/Reader/Sort.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use function is_int;
1313
use function is_string;
1414

15+
use const SORT_ASC;
16+
use const SORT_DESC;
17+
1518
/**
1619
* Sort represents data sorting settings:
1720
*

tests/Paginator/KeysetPaginatorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
use function reset;
3535
use function sprintf;
3636

37+
use const SORT_ASC;
38+
3739
final class KeysetPaginatorTest extends TestCase
3840
{
3941
use PageTokenAssertTrait;

tests/Paginator/OffsetPaginatorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
use Yiisoft\Data\Tests\Support\StubOffsetData;
2424
use Yiisoft\Data\Tests\TestCase;
2525

26+
use function sprintf;
27+
2628
final class OffsetPaginatorTest extends TestCase
2729
{
2830
use PageTokenAssertTrait;

tests/Reader/SortTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Yiisoft\Data\Reader\Sort;
1010
use Yiisoft\Data\Tests\TestCase;
1111

12+
use const SORT_ASC;
13+
use const SORT_DESC;
14+
1215
final class SortTest extends TestCase
1316
{
1417
public function testInvalidConfigWithoutFieldName(): void

0 commit comments

Comments
 (0)