Skip to content

Commit fab14c3

Browse files
authored
Update the PHP CS Fixer configuration (#317)
1 parent 26f94b7 commit fab14c3

18 files changed

Lines changed: 42 additions & 9 deletions

.github/workflows/rector-cs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
2727
with:
2828
repository: ${{ github.event.pull_request.head.repo.full_name }}
29-
php: '8.5'
29+
php: '8.1'
3030
required-packages: >-
3131
['db']
3232
composer-root-version: 2.0.0

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ analysis.txt
3535

3636
# PHP CS Fixer
3737
/.php-cs-fixer.cache
38+
/.php-cs-fixer.php

.php-cs-fixer.dist.php

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

1616
return (new Config())
17+
->setRiskyAllowed(true)
1718
->setParallelConfig(ParallelConfigFactory::detect())
1819
->setRules([
1920
'@PER-CS3.0' => true,
2021
'no_unused_imports' => true,
2122
'ordered_class_elements' => true,
2223
'class_attributes_separation' => ['elements' => ['method' => 'one']],
24+
'declare_strict_types' => true,
25+
'native_function_invocation' => true,
26+
'native_constant_invocation' => true,
27+
'fully_qualified_strict_types' => [
28+
'import_symbols' => true
29+
],
30+
'global_namespace_import' => [
31+
'import_classes' => true,
32+
'import_constants' => true,
33+
'import_functions' => true,
34+
],
2335
])
2436
->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.2 under development
44

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

77
## 2.0.1 December 20, 2025
88

resources/views/addColumnMigration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
use Yiisoft\Db\Migration\Service\Generate\Column;
66
use Yiisoft\Db\Migration\Service\Generate\ForeignKey;
77
use Yiisoft\Db\Migration\Service\Generate\PhpRenderer;
8+
use Yiisoft\Db\Migration\Command\CreateCommand;
89

910
/**
10-
* This view is used by {@see Yiisoft\Db\Migration\Command\CreateCommand}.
11+
* This view is used by {@see CreateCommand}.
1112
*
1213
* The following variables are available in this view:
1314
*

resources/views/createTableMigration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
use Yiisoft\Db\Migration\Service\Generate\Column;
66
use Yiisoft\Db\Migration\Service\Generate\ForeignKey;
77
use Yiisoft\Db\Migration\Service\Generate\PhpRenderer;
8+
use Yiisoft\Db\Migration\Command\CreateCommand;
89

910
/**
10-
* This view is used by {@see Yiisoft\Db\Migration\Command\CreateCommand}.
11+
* This view is used by {@see CreateCommand}.
1112
*
1213
* The following variables are available in this view:
1314
*

resources/views/dropColumnMigration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
use Yiisoft\Db\Migration\Service\Generate\Column;
66
use Yiisoft\Db\Migration\Service\Generate\ForeignKey;
77
use Yiisoft\Db\Migration\Service\Generate\PhpRenderer;
8+
use Yiisoft\Db\Migration\Command\CreateCommand;
89

910
/**
10-
* This view is used by {@see Yiisoft\Db\Migration\Command\CreateCommand}.
11+
* This view is used by {@see CreateCommand}.
1112
*
1213
* The following variables are available in this view:
1314
*

resources/views/dropTableMigration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
use Yiisoft\Db\Migration\Service\Generate\Column;
66
use Yiisoft\Db\Migration\Service\Generate\ForeignKey;
77
use Yiisoft\Db\Migration\Service\Generate\PhpRenderer;
8+
use Yiisoft\Db\Migration\Command\CreateCommand;
89

910
/**
10-
* This view is used by {@see Yiisoft\Db\Migration\Command\CreateCommand}.
11+
* This view is used by {@see CreateCommand}.
1112
*
1213
* The following variables are available in this view:
1314
*

resources/views/migration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
declare(strict_types=1);
44

55
use Yiisoft\Db\Migration\Service\Generate\PhpRenderer;
6+
use Yiisoft\Db\Migration\Command\CreateCommand;
67

78
/**
8-
* This view is used by {@see Yiisoft\Db\Migration\Command\CreateCommand}.
9+
* This view is used by {@see CreateCommand}.
910
*
1011
* The following variables are available in this view:
1112
*

src/Command/CreateCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
use function preg_match;
2525
use function strlen;
2626

27+
use const DIRECTORY_SEPARATOR;
28+
use const LOCK_EX;
29+
2730
/**
2831
* Creates a new migration.
2932
*

0 commit comments

Comments
 (0)