Skip to content

Commit f79dbe9

Browse files
authored
Update the PHP CS Fixer configuration (#479)
1 parent 40d78e9 commit f79dbe9

11 files changed

Lines changed: 26 additions & 2 deletions

.github/workflows/rector-cs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ jobs:
2424
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
2525
with:
2626
repository: ${{ github.event.pull_request.head.repo.full_name }}
27-
php: '8.5'
27+
php: '8.1'
2828
required-packages: >-
2929
['db']

.gitignore

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

3737
# PHP CS Fixer
3838
/.php-cs-fixer.cache
39+
/.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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Enh #477, #478: Improve performance of `ArrayParser::parse()` method (@Tigrov)
66
- Enh #478: Improve performance of `StructuredParser::parse()` method (@Tigrov)
7+
- Enh #479: Explicitly import functions and constants in "use" section (@mspirkov)
78

89
## 2.0.0 December 05, 2025
910

src/Column/BitColumn.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Yiisoft\Db\Schema\Column\AbstractColumn;
1010

1111
use function bindec;
12+
use function is_string;
1213

1314
final class BitColumn extends AbstractColumn
1415
{

src/Column/ColumnBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Yiisoft\Db\Schema\Column\DateTimeColumn;
1010
use Yiisoft\Db\Schema\Column\DoubleColumn;
1111

12+
use const PHP_INT_SIZE;
13+
1214
final class ColumnBuilder extends \Yiisoft\Db\Schema\Column\ColumnBuilder
1315
{
1416
public static function boolean(): BooleanColumn

src/Column/RangeBoundColumnFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Yiisoft\Db\Schema\Column\DateTimeColumn;
99
use Yiisoft\Db\Schema\Column\DoubleColumn;
1010

11+
use const PHP_INT_SIZE;
12+
1113
/**
1214
* @internal
1315
*/

tests/CommandTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Yiisoft\Db\Tests\Common\CommonCommandTest;
1616

1717
use function serialize;
18+
use function strlen;
1819

1920
/**
2021
* @group pgsql

tests/Provider/QueryBuilderProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ public static function multiOperandFunctionBuilder(): iterable
628628
];
629629
$data['Longest with 3 operands'][2] = "(SELECT value FROM (SELECT :qp0 AS value UNION SELECT (SELECT 'longest'::text)"
630630
. ' AS value UNION SELECT :qp1 AS value) AS t ORDER BY LENGTH(value) DESC LIMIT 1)';
631-
$data['Shortest with 3 operands'][1] = static fn(Connectioninterface $db) => [
631+
$data['Shortest with 3 operands'][1] = static fn(ConnectionInterface $db) => [
632632
new Value('short'),
633633
$db->select(new Expression("'longest'::text")),
634634
new Param('string', DataType::STRING),

tests/Provider/SchemaProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
use Yiisoft\Db\Schema\Column\StringColumn;
2727
use Yiisoft\Db\Tests\Support\Assert;
2828

29+
use function sprintf;
30+
2931
final class SchemaProvider extends \Yiisoft\Db\Tests\Provider\SchemaProvider
3032
{
3133
public static function columns(): array

0 commit comments

Comments
 (0)