Skip to content

Commit 2fd4594

Browse files
committed
docs: update the DisallowTypeLongNames sniff documentation
1 parent 4fc59ab commit 2fd4594

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

yCodeTech/Docs/Types/DisallowTypeLongNamesStandard.xml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
<documentation title="Disallow Type Long Names">
22
<standard>
33
<![CDATA[
4-
Long type names are disallowed. Short names must be used in all contexts.
4+
Long type names are disallowed. Short names must be used in docblocks, type declarations, and type casting.
55
66
This rule enforces:
77
88
1. Use `bool` instead of `boolean`.
99
2. Use `int` instead of `integer`.
1010
11-
Contexts:
12-
- Docblocks
13-
- Type declarations
14-
- Union types
15-
- Nullable types
16-
- Type casting
17-
- Generic types
11+
Notes:
1812
19-
Applies to:
13+
- Docblocks and type declarations include union and nullable types.
14+
15+
- Docblock types can also include generic types.
16+
17+
- Types will only be fixed in these regular docblocks tags: `@param`, `@return`, `@var`, `@property`, `@method`.
18+
Also any other tags that contain the regular tags; example: `@property-read`, `@phpstan-param`, `@psalm-return`.
19+
20+
- Any types in docblock descriptions will not get fixed.
21+
22+
---
2023
21-
1. Regular docblock tags that contain types (`@param`, `@return`, `@var`, `@property`, `@method`) and any others that contain these regular tags (`@property-read`, `@property-write`, `@phpstan-*`, `@psalm-*`, etc.)
22-
2. Docblock generic types: array<`integer`, `boolean`> → array<`int`, `bool`>, array<`boolean`> → array<`bool`>, Collection<`integer`> → Collection<`int`>, etc.
23-
3. Function/method/closure parameter and return type declarations
24-
4. Class property type declarations
25-
5. Nullable and union types: `?boolean` → `?bool`, `?integer` → `?int`, `boolean|string` → `bool|string`, `integer|string` → `int|string`
26-
6. Type casting: `(boolean)` → `(bool)`, `(integer)` → `(int)`
2724
]]>
2825
</standard>
2926
<code_comparison>

0 commit comments

Comments
 (0)