diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 6a86ebe205e5..039c7c950ded 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -62,6 +62,8 @@ 'phpstan-param', 'phpstan-property', 'phpstan-return', + 'phpstan-type', + 'phpstan-var', 'property', 'property-read', 'property-write', diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 7c9ae1e80737..2c31a15b8af9 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -29,7 +29,31 @@ __DIR__ . '/admin/starter/builds', ]); -$overrides = []; +$overrides = [ + 'phpdoc_align' => [ + 'align' => 'vertical', + 'spacing' => 1, + 'tags' => [ + 'method', + 'param', + 'phpstan-assert', + 'phpstan-assert-if-true', + 'phpstan-assert-if-false', + 'phpstan-param', + 'phpstan-property', + 'phpstan-return', + 'phpstan-type', + 'phpstan-var', + 'property', + 'property-read', + 'property-write', + 'return', + 'throws', + 'type', + 'var', + ], + ], +]; $options = [ 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index fe634f0a6f21..b93a56d0c043 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -39,6 +39,29 @@ 'import_symbols' => false, 'leading_backslash_in_global_namespace' => true, ], + 'phpdoc_align' => [ + 'align' => 'vertical', + 'spacing' => 1, + 'tags' => [ + 'method', + 'param', + 'phpstan-assert', + 'phpstan-assert-if-true', + 'phpstan-assert-if-false', + 'phpstan-param', + 'phpstan-property', + 'phpstan-return', + 'phpstan-type', + 'phpstan-var', + 'property', + 'property-read', + 'property-write', + 'return', + 'throws', + 'type', + 'var', + ], + ], ]; $options = [ diff --git a/app/Config/View.php b/app/Config/View.php index cf00863fb70b..9b237d8bc4e7 100644 --- a/app/Config/View.php +++ b/app/Config/View.php @@ -34,7 +34,7 @@ class View extends BaseView * { title|esc(js) } * { created_on|date(Y-m-d)|esc(attr) } * - * @var array + * @var array * @phpstan-var array */ public $filters = []; @@ -44,7 +44,7 @@ class View extends BaseView * by the core Parser by creating aliases that will be replaced with * any callable. Can be single or tag pair. * - * @var array|callable|string> + * @var array|callable|string> * @phpstan-var array|ParserCallableString|ParserCallable> */ public $plugins = []; diff --git a/system/BaseModel.php b/system/BaseModel.php index 9cb6f969a202..63e53515bbee 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -42,15 +42,15 @@ * - process various callbacks * - allow intermingling calls to the db connection * - * @phpstan-type row_array array + * @phpstan-type row_array array * @phpstan-type event_data_beforeinsert array{data: row_array} - * @phpstan-type event_data_afterinsert array{id: int|string, data: row_array, result: bool} - * @phpstan-type event_data_beforefind array{id?: int|string, method: string, singleton: bool, limit?: int, offset?: int} - * @phpstan-type event_data_afterfind array{id: int|string|null|list, data: row_array|list|object|null, method: string, singleton: bool} + * @phpstan-type event_data_afterinsert array{id: int|string, data: row_array, result: bool} + * @phpstan-type event_data_beforefind array{id?: int|string, method: string, singleton: bool, limit?: int, offset?: int} + * @phpstan-type event_data_afterfind array{id: int|string|null|list, data: row_array|list|object|null, method: string, singleton: bool} * @phpstan-type event_data_beforeupdate array{id: null|list, data: row_array} - * @phpstan-type event_data_afterupdate array{id: null|list, data: row_array|object, result: bool} + * @phpstan-type event_data_afterupdate array{id: null|list, data: row_array|object, result: bool} * @phpstan-type event_data_beforedelete array{id: null|list, purge: bool} - * @phpstan-type event_data_afterdelete array{id: null|list, data: null, purge: bool, result: bool} + * @phpstan-type event_data_afterdelete array{id: null|list, data: null, purge: bool, result: bool} */ abstract class BaseModel { diff --git a/system/Config/View.php b/system/Config/View.php index 101b67f580d0..05130e7c881c 100644 --- a/system/Config/View.php +++ b/system/Config/View.php @@ -39,7 +39,7 @@ class View extends BaseConfig * * @psalm-suppress UndefinedDocblockClass * - * @var array + * @var array * @phpstan-var array */ public $filters = []; @@ -51,7 +51,7 @@ class View extends BaseConfig * * @psalm-suppress UndefinedDocblockClass * - * @var array|callable|string> + * @var array|callable|string> * @phpstan-var array|parser_callable_string|parser_callable> */ public $plugins = []; @@ -59,7 +59,7 @@ class View extends BaseConfig /** * Built-in View filters. * - * @var array + * @var array * @phpstan-var array */ protected $coreFilters = [ @@ -89,7 +89,7 @@ class View extends BaseConfig /** * Built-in View plugins. * - * @var array|callable|string> + * @var array|callable|string> * @phpstan-var array|parser_callable_string|parser_callable> */ protected $corePlugins = [ diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 4e34e0fdb699..41408eb8514d 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -195,7 +195,7 @@ abstract class BaseConnection implements ConnectionInterface /** * Connection ID * - * @var false|object|resource + * @var false|object|resource * @phpstan-var false|TConnection */ public $connID = false; @@ -203,7 +203,7 @@ abstract class BaseConnection implements ConnectionInterface /** * Result ID * - * @var false|object|resource + * @var false|object|resource * @phpstan-var false|TResult */ public $resultID = false; diff --git a/system/Database/BasePreparedQuery.php b/system/Database/BasePreparedQuery.php index 4e9d816686f9..ea16de594c2b 100644 --- a/system/Database/BasePreparedQuery.php +++ b/system/Database/BasePreparedQuery.php @@ -29,7 +29,7 @@ abstract class BasePreparedQuery implements PreparedQueryInterface /** * The prepared statement itself. * - * @var object|resource|null + * @var object|resource|null * @phpstan-var TStatement|null */ protected $statement; @@ -59,7 +59,7 @@ abstract class BasePreparedQuery implements PreparedQueryInterface /** * A reference to the db connection to use. * - * @var BaseConnection + * @var BaseConnection * @phpstan-var BaseConnection */ protected $db; diff --git a/system/Database/BaseResult.php b/system/Database/BaseResult.php index d7b32218322b..e4f2345fdda1 100644 --- a/system/Database/BaseResult.php +++ b/system/Database/BaseResult.php @@ -25,7 +25,7 @@ abstract class BaseResult implements ResultInterface /** * Connection ID * - * @var object|resource + * @var object|resource * @phpstan-var TConnection */ public $connID; @@ -33,7 +33,7 @@ abstract class BaseResult implements ResultInterface /** * Result ID * - * @var false|object|resource + * @var false|object|resource * @phpstan-var false|TResult */ public $resultID; diff --git a/system/View/Parser.php b/system/View/Parser.php index ff5656a53863..4db85195addd 100644 --- a/system/View/Parser.php +++ b/system/View/Parser.php @@ -63,7 +63,7 @@ class Parser extends View /** * Stores any plugins registered at run-time. * - * @var array|callable|string> + * @var array|callable|string> * @phpstan-var array|parser_callable_string|parser_callable> */ protected $plugins = [];