Skip to content

Commit db4b0a6

Browse files
authored
Update StyleCI config + fixes
1 parent e756a71 commit db4b0a6

12 files changed

+234
-156
lines changed

.styleci.yml

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,90 @@
11
preset: psr12
2+
risky: true
3+
4+
version: 8
25

36
finder:
4-
exclude:
5-
- docs
6-
- vendor
7+
exclude:
8+
- docs
9+
- vendor
10+
- resources
11+
- views
12+
- public
13+
not-name:
14+
- UnionCar.php
15+
16+
enabled:
17+
- alpha_ordered_imports
18+
- alpha_ordered_traits
19+
- array_indentation
20+
- array_push
21+
- combine_consecutive_issets
22+
- combine_consecutive_unsets
23+
- combine_nested_dirname
24+
- declare_strict_types
25+
- dir_constant
26+
- final_static_access
27+
- fully_qualified_strict_types
28+
- function_to_constant
29+
- hash_to_slash_comment
30+
- is_null
31+
- logical_operators
32+
- magic_constant_casing
33+
- magic_method_casing
34+
- method_separation
35+
- modernize_types_casting
36+
- native_function_casing
37+
- native_function_type_declaration_casing
38+
- no_alias_functions
39+
- no_alternative_syntax
40+
- no_empty_comment
41+
- no_empty_phpdoc
42+
- no_empty_statement
43+
- no_extra_block_blank_lines
44+
- no_short_bool_cast
45+
- no_short_echo_tag
46+
- no_superfluous_elseif
47+
- no_unneeded_control_parentheses
48+
- no_unneeded_curly_braces
49+
- no_unneeded_final_method
50+
- no_unset_cast
51+
- no_unused_imports
52+
- no_unused_lambda_imports
53+
- no_useless_else
54+
- no_useless_return
55+
- normalize_index_brace
56+
- php_unit_dedicate_assert
57+
- php_unit_dedicate_assert_internal_type
58+
- php_unit_expectation
59+
- php_unit_mock
60+
- php_unit_mock_short_will_return
61+
- php_unit_namespaced
62+
- php_unit_no_expectation_annotation
63+
- phpdoc_no_empty_return
64+
- phpdoc_no_useless_inheritdoc
65+
- phpdoc_order
66+
- phpdoc_property
67+
- phpdoc_scalar
68+
- phpdoc_separation
69+
- phpdoc_singular_inheritdoc
70+
- phpdoc_trim
71+
- phpdoc_trim_consecutive_blank_line_separation
72+
- phpdoc_type_to_var
73+
- phpdoc_types
74+
- phpdoc_types_order
75+
- phpdoc_var_without_name
76+
- print_to_echo
77+
- regular_callable_call
78+
- return_assignment
79+
- self_accessor
80+
- self_static_accessor
81+
- set_type_to_cast
82+
- short_array_syntax
83+
- short_list_syntax
84+
- simplified_if_return
85+
- single_quote
86+
- standardize_not_equals
87+
- ternary_to_null_coalescing
88+
- trailing_comma_in_multiline_array
89+
- unalign_double_arrow
90+
- unalign_equals

src/ArrayExpressionBuilder.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44

55
namespace Yiisoft\Db\Pgsql;
66

7+
use function get_class;
8+
use function implode;
9+
use function in_array;
10+
use function is_array;
11+
use function str_repeat;
712
use Traversable;
813
use Yiisoft\Db\Exception\Exception;
914
use Yiisoft\Db\Exception\InvalidArgumentException;
1015
use Yiisoft\Db\Exception\InvalidConfigException;
1116
use Yiisoft\Db\Exception\NotSupportedException;
1217
use Yiisoft\Db\Expression\ArrayExpression;
18+
1319
use Yiisoft\Db\Expression\ExpressionBuilderInterface;
1420
use Yiisoft\Db\Expression\ExpressionBuilderTrait;
1521
use Yiisoft\Db\Expression\ExpressionInterface;
1622
use Yiisoft\Db\Expression\JsonExpression;
1723
use Yiisoft\Db\Query\Query;
1824

19-
use function get_class;
20-
use function implode;
21-
use function in_array;
22-
use function is_array;
23-
use function str_repeat;
24-
2525
final class ArrayExpressionBuilder implements ExpressionBuilderInterface
2626
{
2727
use ExpressionBuilderTrait;
@@ -140,7 +140,7 @@ protected function buildSubqueryArray(string $sql, ArrayExpression $expression):
140140
* @param ArrayExpression $expression
141141
* @param mixed $value
142142
*
143-
* @return int|ExpressionInterface
143+
* @return ExpressionInterface|int
144144
*/
145145
protected function typecastValue(ArrayExpression $expression, $value)
146146
{

src/ColumnSchema.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
namespace Yiisoft\Db\Pgsql;
66

7-
use JsonException;
8-
use Yiisoft\Db\Expression\ArrayExpression;
9-
use Yiisoft\Db\Expression\ExpressionInterface;
10-
use Yiisoft\Db\Expression\JsonExpression;
11-
use Yiisoft\Db\Schema\ColumnSchema as AbstractColumnSchema;
12-
137
use function array_walk_recursive;
148
use function in_array;
159
use function is_array;
1610
use function is_string;
1711
use function json_decode;
12+
13+
use JsonException;
1814
use function strtolower;
15+
use Yiisoft\Db\Expression\ArrayExpression;
16+
use Yiisoft\Db\Expression\ExpressionInterface;
17+
use Yiisoft\Db\Expression\JsonExpression;
18+
use Yiisoft\Db\Schema\ColumnSchema as AbstractColumnSchema;
1919

2020
final class ColumnSchema extends AbstractColumnSchema
2121
{
@@ -94,7 +94,7 @@ public function phpTypecast($value)
9494
/**
9595
* Casts $value after retrieving from the DBMS to PHP representation.
9696
*
97-
* @param string|int|null $value
97+
* @param int|string|null $value
9898
*
9999
* @throws JsonException
100100
*

src/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace Yiisoft\Db\Pgsql;
66

77
use PDO;
8-
use Yiisoft\Db\Connection\Connection as AbstractConnection;
98
use Yiisoft\Db\Command\Command;
9+
use Yiisoft\Db\Connection\Connection as AbstractConnection;
1010

1111
/**
1212
* Database connection class prefilled for PGSQL Server.

src/JsonExpressionBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class JsonExpressionBuilder implements ExpressionBuilderInterface
2727
* @param ExpressionInterface $expression the expression to be built.
2828
* @param array $params the binding parameters.
2929
*
30-
* @throws Exception|JsonException|InvalidArgumentException|InvalidConfigException|NotSupportedException
30+
* @throws Exception|InvalidArgumentException|InvalidConfigException|JsonException|NotSupportedException
3131
*
3232
* @return string the raw SQL that will not be additionally escaped or quoted.
3333
*/

src/QueryBuilder.php

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,25 @@
44

55
namespace Yiisoft\Db\Pgsql;
66

7+
use function array_diff;
8+
use function array_merge;
9+
use function array_unshift;
10+
use function count;
11+
use function explode;
12+
use Generator;
13+
use function implode;
14+
use function is_bool;
15+
use function is_float;
16+
use function is_string;
717
use JsonException;
818
use PDO;
9-
use Generator;
10-
use Yiisoft\Db\Connection\ConnectionInterface;
19+
use function preg_match;
20+
use function preg_replace;
21+
use function reset;
22+
use function strpos;
23+
use function strrpos;
24+
25+
use function version_compare;
1126
use Yiisoft\Db\Constraint\Constraint;
1227
use Yiisoft\Db\Exception\Exception;
1328
use Yiisoft\Db\Exception\InvalidArgumentException;
@@ -23,22 +38,6 @@
2338
use Yiisoft\Db\Query\QueryBuilder as AbstractQueryBuilder;
2439
use Yiisoft\Strings\NumericHelper;
2540

26-
use function array_diff;
27-
use function array_merge;
28-
use function array_unshift;
29-
use function count;
30-
use function explode;
31-
use function implode;
32-
use function is_bool;
33-
use function is_float;
34-
use function is_string;
35-
use function preg_match;
36-
use function preg_replace;
37-
use function reset;
38-
use function strpos;
39-
use function strrpos;
40-
use function version_compare;
41-
4241
final class QueryBuilder extends AbstractQueryBuilder
4342
{
4443
/**
@@ -134,7 +133,7 @@ protected function defaultExpressionBuilders(): array
134133
* @param string $name the name of the index. The name will be properly quoted by the method.
135134
* @param string $table the table that the new index will be created for. The table name will be properly quoted by
136135
* the method.
137-
* @param string|array $columns the column(s) that should be included in the index. If there are multiple columns,
136+
* @param array|string $columns the column(s) that should be included in the index. If there are multiple columns,
138137
* separate them with commas or use an array to represent them. Each column name will be properly quoted by the
139138
* method, unless a parenthesis is found in the name.
140139
* @param bool|string $unique whether to make this a UNIQUE index constraint. You can pass `true` or
@@ -419,7 +418,7 @@ public function insert(string $table, $columns, array &$params = []): string
419418
* @param array $params the binding parameters that will be generated by this method.
420419
* They should be bound to the DB command later.
421420
*
422-
* @throws Exception|JsonException|InvalidConfigException|NotSupportedException if this is not supported by the
421+
* @throws Exception|InvalidConfigException|JsonException|NotSupportedException if this is not supported by the
423422
* underlying DBMS.
424423
*
425424
* @return string the resulting SQL.
@@ -449,7 +448,7 @@ public function upsert(string $table, $insertColumns, $updateColumns, array &$pa
449448
* @param array|bool $updateColumns
450449
* @param array $params
451450
*
452-
* @throws Exception|JsonException|InvalidArgumentException|InvalidConfigException|NotSupportedException
451+
* @throws Exception|InvalidArgumentException|InvalidConfigException|JsonException|NotSupportedException
453452
*
454453
* @return string
455454
*/

src/Schema.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44

55
namespace Yiisoft\Db\Pgsql;
66

7+
use function array_change_key_case;
8+
use function array_merge;
9+
use function array_unique;
10+
use function array_values;
11+
use function bindec;
12+
use function explode;
13+
use function implode;
714
use JsonException;
815
use PDO;
16+
use function preg_match;
17+
use function preg_replace;
18+
use function str_replace;
19+
use function substr;
920
use Throwable;
1021
use Yiisoft\Arrays\ArrayHelper;
11-
use Yiisoft\Db\Connection\ConnectionInterface;
1222
use Yiisoft\Db\Constraint\CheckConstraint;
1323
use Yiisoft\Db\Constraint\Constraint;
1424
use Yiisoft\Db\Constraint\ConstraintFinderInterface;
25+
1526
use Yiisoft\Db\Constraint\ConstraintFinderTrait;
1627
use Yiisoft\Db\Constraint\DefaultValueConstraint;
1728
use Yiisoft\Db\Constraint\ForeignKeyConstraint;
@@ -24,22 +35,10 @@
2435
use Yiisoft\Db\Schema\Schema as AbstractSchema;
2536
use Yiisoft\Db\View\ViewFinderTrait;
2637

27-
use function array_change_key_case;
28-
use function array_merge;
29-
use function array_unique;
30-
use function array_values;
31-
use function bindec;
32-
use function explode;
33-
use function implode;
34-
use function preg_match;
35-
use function preg_replace;
36-
use function str_replace;
37-
use function substr;
38-
3938
final class Schema extends AbstractSchema implements ConstraintFinderInterface
4039
{
41-
use ViewFinderTrait;
4240
use ConstraintFinderTrait;
41+
use ViewFinderTrait;
4342

4443
public const TYPE_JSONB = 'jsonb';
4544

@@ -558,7 +557,7 @@ public function findUniqueIndexes(TableSchema $table): array
558557
*
559558
* @param TableSchema $table the table metadata.
560559
*
561-
* @throws Exception|JsonException|InvalidConfigException|Throwable
560+
* @throws Exception|InvalidConfigException|JsonException|Throwable
562561
*
563562
* @return bool whether the table exists in the database.
564563
*/
@@ -913,7 +912,7 @@ private function createColumnSchema(): ColumnSchema
913912
* This method may be overridden by child classes to create a DBMS-specific column schema builder.
914913
*
915914
* @param string $type type of the column. See {@see ColumnSchemaBuilder::$type}.
916-
* @param int|string|array|null $length length or precision of the column. See {@see ColumnSchemaBuilder::$length}.
915+
* @param array|int|string|null $length length or precision of the column. See {@see ColumnSchemaBuilder::$length}.
917916
*
918917
* @return ColumnSchemaBuilder column schema builder instance
919918
*/

0 commit comments

Comments
 (0)