Skip to content

Commit c5a63bb

Browse files
committed
style: also align @phpstan-type and @phpstan-var
1 parent 7d50bd3 commit c5a63bb

File tree

10 files changed

+69
-20
lines changed

10 files changed

+69
-20
lines changed

.php-cs-fixer.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
'phpstan-param',
6363
'phpstan-property',
6464
'phpstan-return',
65+
'phpstan-type',
66+
'phpstan-var',
6567
'property',
6668
'property-read',
6769
'property-write',

.php-cs-fixer.no-header.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,31 @@
2929
__DIR__ . '/admin/starter/builds',
3030
]);
3131

32-
$overrides = [];
32+
$overrides = [
33+
'phpdoc_align' => [
34+
'align' => 'vertical',
35+
'spacing' => 1,
36+
'tags' => [
37+
'method',
38+
'param',
39+
'phpstan-assert',
40+
'phpstan-assert-if-true',
41+
'phpstan-assert-if-false',
42+
'phpstan-param',
43+
'phpstan-property',
44+
'phpstan-return',
45+
'phpstan-type',
46+
'phpstan-var',
47+
'property',
48+
'property-read',
49+
'property-write',
50+
'return',
51+
'throws',
52+
'type',
53+
'var',
54+
],
55+
],
56+
];
3357

3458
$options = [
3559
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',

.php-cs-fixer.user-guide.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,29 @@
3939
'import_symbols' => false,
4040
'leading_backslash_in_global_namespace' => true,
4141
],
42+
'phpdoc_align' => [
43+
'align' => 'vertical',
44+
'spacing' => 1,
45+
'tags' => [
46+
'method',
47+
'param',
48+
'phpstan-assert',
49+
'phpstan-assert-if-true',
50+
'phpstan-assert-if-false',
51+
'phpstan-param',
52+
'phpstan-property',
53+
'phpstan-return',
54+
'phpstan-type',
55+
'phpstan-var',
56+
'property',
57+
'property-read',
58+
'property-write',
59+
'return',
60+
'throws',
61+
'type',
62+
'var',
63+
],
64+
],
4265
];
4366

4467
$options = [

app/Config/View.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class View extends BaseView
3434
* { title|esc(js) }
3535
* { created_on|date(Y-m-d)|esc(attr) }
3636
*
37-
* @var array<string, string>
37+
* @var array<string, string>
3838
* @phpstan-var array<string, ParserCallableString>
3939
*/
4040
public $filters = [];
@@ -44,7 +44,7 @@ class View extends BaseView
4444
* by the core Parser by creating aliases that will be replaced with
4545
* any callable. Can be single or tag pair.
4646
*
47-
* @var array<string, array<string>|callable|string>
47+
* @var array<string, array<string>|callable|string>
4848
* @phpstan-var array<string, array<ParserCallableString>|ParserCallableString|ParserCallable>
4949
*/
5050
public $plugins = [];

system/BaseModel.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@
4242
* - process various callbacks
4343
* - allow intermingling calls to the db connection
4444
*
45-
* @phpstan-type row_array array<int|string, float|int|null|string>
45+
* @phpstan-type row_array array<int|string, float|int|null|string>
4646
* @phpstan-type event_data_beforeinsert array{data: row_array}
47-
* @phpstan-type event_data_afterinsert array{id: int|string, data: row_array, result: bool}
48-
* @phpstan-type event_data_beforefind array{id?: int|string, method: string, singleton: bool, limit?: int, offset?: int}
49-
* @phpstan-type event_data_afterfind array{id: int|string|null|list<int|string>, data: row_array|list<row_array>|object|null, method: string, singleton: bool}
47+
* @phpstan-type event_data_afterinsert array{id: int|string, data: row_array, result: bool}
48+
* @phpstan-type event_data_beforefind array{id?: int|string, method: string, singleton: bool, limit?: int, offset?: int}
49+
* @phpstan-type event_data_afterfind array{id: int|string|null|list<int|string>, data: row_array|list<row_array>|object|null, method: string, singleton: bool}
5050
* @phpstan-type event_data_beforeupdate array{id: null|list<int|string>, data: row_array}
51-
* @phpstan-type event_data_afterupdate array{id: null|list<int|string>, data: row_array|object, result: bool}
51+
* @phpstan-type event_data_afterupdate array{id: null|list<int|string>, data: row_array|object, result: bool}
5252
* @phpstan-type event_data_beforedelete array{id: null|list<int|string>, purge: bool}
53-
* @phpstan-type event_data_afterdelete array{id: null|list<int|string>, data: null, purge: bool, result: bool}
53+
* @phpstan-type event_data_afterdelete array{id: null|list<int|string>, data: null, purge: bool, result: bool}
5454
*/
5555
abstract class BaseModel
5656
{

system/Config/View.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class View extends BaseConfig
3939
*
4040
* @psalm-suppress UndefinedDocblockClass
4141
*
42-
* @var array<string, string>
42+
* @var array<string, string>
4343
* @phpstan-var array<string, parser_callable_string>
4444
*/
4545
public $filters = [];
@@ -51,15 +51,15 @@ class View extends BaseConfig
5151
*
5252
* @psalm-suppress UndefinedDocblockClass
5353
*
54-
* @var array<string, array<string>|callable|string>
54+
* @var array<string, array<string>|callable|string>
5555
* @phpstan-var array<string, array<parser_callable_string>|parser_callable_string|parser_callable>
5656
*/
5757
public $plugins = [];
5858

5959
/**
6060
* Built-in View filters.
6161
*
62-
* @var array<string, string>
62+
* @var array<string, string>
6363
* @phpstan-var array<string, parser_callable_string>
6464
*/
6565
protected $coreFilters = [
@@ -89,7 +89,7 @@ class View extends BaseConfig
8989
/**
9090
* Built-in View plugins.
9191
*
92-
* @var array<string, array<string>|callable|string>
92+
* @var array<string, array<string>|callable|string>
9393
* @phpstan-var array<string, array<parser_callable_string>|parser_callable_string|parser_callable>
9494
*/
9595
protected $corePlugins = [

system/Database/BaseConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,15 @@ abstract class BaseConnection implements ConnectionInterface
195195
/**
196196
* Connection ID
197197
*
198-
* @var false|object|resource
198+
* @var false|object|resource
199199
* @phpstan-var false|TConnection
200200
*/
201201
public $connID = false;
202202

203203
/**
204204
* Result ID
205205
*
206-
* @var false|object|resource
206+
* @var false|object|resource
207207
* @phpstan-var false|TResult
208208
*/
209209
public $resultID = false;

system/Database/BasePreparedQuery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ abstract class BasePreparedQuery implements PreparedQueryInterface
2929
/**
3030
* The prepared statement itself.
3131
*
32-
* @var object|resource|null
32+
* @var object|resource|null
3333
* @phpstan-var TStatement|null
3434
*/
3535
protected $statement;
@@ -59,7 +59,7 @@ abstract class BasePreparedQuery implements PreparedQueryInterface
5959
/**
6060
* A reference to the db connection to use.
6161
*
62-
* @var BaseConnection
62+
* @var BaseConnection
6363
* @phpstan-var BaseConnection<TConnection, TResult>
6464
*/
6565
protected $db;

system/Database/BaseResult.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ abstract class BaseResult implements ResultInterface
2525
/**
2626
* Connection ID
2727
*
28-
* @var object|resource
28+
* @var object|resource
2929
* @phpstan-var TConnection
3030
*/
3131
public $connID;
3232

3333
/**
3434
* Result ID
3535
*
36-
* @var false|object|resource
36+
* @var false|object|resource
3737
* @phpstan-var false|TResult
3838
*/
3939
public $resultID;

system/View/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Parser extends View
6363
/**
6464
* Stores any plugins registered at run-time.
6565
*
66-
* @var array<string, array<string>|callable|string>
66+
* @var array<string, array<string>|callable|string>
6767
* @phpstan-var array<string, array<parser_callable_string>|parser_callable_string|parser_callable>
6868
*/
6969
protected $plugins = [];

0 commit comments

Comments
 (0)