Skip to content

Commit 2558c7e

Browse files
committed
A little docs improvements
1 parent 9fadfb4 commit 2558c7e

9 files changed

+28
-113
lines changed

Writerside/labels.list

+5-17
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,15 @@
3636
The implementation of the functionality available for installation
3737
of "type-lang/reader" component.
3838
</primary-label>
39-
<primary-label id="experimental" name="Special Feature" short-name="Extra" color="tangerine">
39+
<primary-label id="experimental" name="Experimental" short-name="Experimental" color="tangerine">
4040
This is a unique functionality that is not supported by other popular
4141
third-party tools (e.g. PHPStan or Psalm) and has no alternatives.
4242
</primary-label>
4343

44-
<secondary-label id="psalm" name="Psalm" color="blue">
45-
Also partially or fully supported by Psalm Linter.
46-
Check out Psalm documentation for more details.
47-
</secondary-label>
48-
<secondary-label id="phpstan" name="PHPStan" color="blue">
49-
Also partially or fully supported by PHPStan Linter.
50-
Check out PHPStan documentation for more details.
51-
</secondary-label>
52-
<secondary-label id="storm" name="PhpStorm" color="blue">
53-
Also partially or fully supported by PhpStorm IDE.
54-
Check out PhpStorm documentation for more details.
55-
</secondary-label>
56-
5744
<secondary-label id="wip" name="WIP" color="red">Work in progress</secondary-label>
5845
<secondary-label id="beta" name="β" color="tangerine">Beta</secondary-label>
59-
<secondary-label id="tl1.1" name="TypeLang Parser 1.1+" color="strawberry">Supported since type-lang/parser v1.1</secondary-label>
60-
<secondary-label id="tl1.2" name="TypeLang Parser 1.2+" color="strawberry">Supported since type-lang/parser v1.2</secondary-label>
61-
<secondary-label id="r1.1" name="Reader 1.1+" color="strawberry">Supported since type-lang/reader v1.1</secondary-label>
46+
<secondary-label id="tl1.1" name="Available in Parser v1.1" color="strawberry">Available in type-lang/parser 1.1+</secondary-label>
47+
<secondary-label id="tl1.2" name="Available in Parser v1.2" color="strawberry">Available in type-lang/parser 1.2+</secondary-label>
48+
<secondary-label id="tl1.4" name="Available in Parser v1.4" color="strawberry">Available in type-lang/parser 1.4+</secondary-label>
49+
<secondary-label id="r1.1" name="Available in Reader v1.1" color="strawberry">Available in type-lang/reader 1.1+</secondary-label>
6250
</labels>

Writerside/tl.tree

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
<toc-element topic="logical-types.md"
1212
toc-title="Logical types"/>
1313
<toc-element topic="generic-types.md"
14-
toc-title="Template types (Generics)"/>
14+
toc-title="Generics"/>
1515
<toc-element topic="literal-types.md"
16-
toc-title="Literal values"/>
16+
toc-title="Literals"/>
1717
<toc-element topic="const-types.md"
18-
toc-title="Constant references"/>
18+
toc-title="Constants"/>
1919
<toc-element topic="shape-types.md"
20-
toc-title="Shape types"/>
20+
toc-title="Shapes"/>
2121
<toc-element topic="callable-types.md"
22-
toc-title="Callable types (Delegates)"/>
22+
toc-title="Callables"/>
2323
<!-- TODO -->
2424
<toc-element topic="conditional-types.md" toc-title="Conditions" hidden="true"/>
2525
<toc-element topic="comparison.md" toc-title="Comparison of syntax between different tools">

Writerside/topics/language/basic-types.md

-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# Basic Types
2-
3-
<secondary-label ref="phpstan"/>
4-
<secondary-label ref="psalm"/>
5-
<secondary-label ref="storm"/>
62
<show-structure for="chapter" depth="2"/>
73

84
The parser does not impose restrictions on type naming. The type name must begin
@@ -76,10 +72,6 @@ is **unacceptable**.
7672
7773
## Namespace
7874
79-
<secondary-label ref="phpstan"/>
80-
<secondary-label ref="psalm"/>
81-
<secondary-label ref="storm"/>
82-
8375
Each name can contain a namespace symbol (`\` — backslash), which is
8476
[similar to that in PHP](https://www.php.net/manual/en/language.namespaces.rationale.php). The separator can be located either in the middle
8577
or at the beginning of any <tooltip term="Identifier">Identifier</tooltip>. End

Writerside/topics/language/callable-types.md

-20
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# Callable Types
2-
3-
<secondary-label ref="phpstan"/>
4-
<secondary-label ref="psalm"/>
5-
<secondary-label ref="storm"/>
62
<show-structure for="chapter" depth="2"/>
73

84
Callable types describe an arbitrary type that describes a function.
@@ -27,10 +23,6 @@ Each callable MAY have a list of parameters and/or a return type definition.
2723
2824
### Named Parameters
2925
30-
<secondary-label ref="phpstan"/>
31-
<secondary-label ref="psalm"/>
32-
<secondary-label ref="storm"/>
33-
3426
The name after the type of the parameter defines the parameter that
3527
[allows passing by name](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments).
3628
@@ -68,10 +60,6 @@ Just like in the PHP language.
6860
6961
### Output Parameters
7062
71-
<secondary-label ref="phpstan"/>
72-
<secondary-label ref="psalm"/>
73-
<secondary-label ref="storm"/>
74-
7563
Passing a parameter by reference means that the function can change the passed
7664
variable while it is running.
7765
@@ -109,10 +97,6 @@ the type and before the name.
10997
11098
### Optional Parameters
11199
112-
<secondary-label ref="phpstan"/>
113-
<secondary-label ref="psalm"/>
114-
<secondary-label ref="storm"/>
115-
116100
An optional parameter means that the argument may not be passed when such a
117101
function is called.
118102
@@ -160,10 +144,6 @@ parameter description.
160144
161145
### Variadic Parameters
162146
163-
<secondary-label ref="phpstan"/>
164-
<secondary-label ref="psalm"/>
165-
<secondary-label ref="storm"/>
166-
167147
Variadic parameters are indicated by the "`...`" and can be placed either
168148
_before the type_ or _before the parameter name._
169149

Writerside/topics/language/const-types.md

-8
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ Given the complete identity of the grammar of constants with
5757
5858
## Class Constants
5959
60-
<secondary-label ref="phpstan"/>
61-
<secondary-label ref="psalm"/>
62-
<secondary-label ref="storm"/>
63-
6460
Class constants begin with any [type name](basic-types.md), then contain
6561
a double colon (`::`) character, and then the constant name.
6662
@@ -96,10 +92,6 @@ a double colon (`::`) character, and then the constant name.
9692
9793
## Constant Masks
9894
99-
<secondary-label ref="phpstan"/>
100-
<secondary-label ref="psalm"/>
101-
<secondary-label ref="storm"/>
102-
10395
A reference to a certain set of constants can be defined using a mask. The
10496
use of masks is identical to regular constants, but must be terminated with
10597
an asterisk (`*`).

Writerside/topics/language/generic-types.md

-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# Generic Types
2-
3-
<secondary-label ref="phpstan"/>
4-
<secondary-label ref="psalm"/>
5-
<secondary-label ref="storm"/>
62
<show-structure for="chapter" depth="2"/>
73

84
Each type can take arguments containing other type declarations. Validation of
@@ -77,7 +73,6 @@ and the reference to the type:
7773
7874
## Call-Site Hints
7975
80-
<secondary-label ref="phpstan"/>
8176
8277
Each template argument allows you to define an additional hint, which can be
8378
used, for example, in static analyzers to indicate the
@@ -124,10 +119,6 @@ used, for example, in static analyzers to indicate the
124119
125120
## List Syntax
126121
127-
<secondary-label ref="phpstan"/>
128-
<secondary-label ref="psalm"/>
129-
<secondary-label ref="storm"/>
130-
131122
In addition to modern list declarations such as `list<int>` or
132123
`array<array-key, int>`, the legacy `int[]` syntax is allowed.
133124

Writerside/topics/language/literal-types.md

-17
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ allowed:
1313

1414
## Boolean And Null
1515

16-
<secondary-label ref="phpstan"/>
17-
<secondary-label ref="psalm"/>
18-
<secondary-label ref="storm"/>
19-
2016
The literals `true` and `false` are used as the value of the PHP `bool` type.
2117

2218
> Note: `true` and `false` values are not case sensitive.
@@ -35,10 +31,6 @@ For other types the logic is more complicated.
3531
3632
## Strings
3733
38-
<secondary-label ref="phpstan"/>
39-
<secondary-label ref="psalm"/>
40-
<secondary-label ref="storm"/>
41-
4234
The syntax of string types is similar to that in PHP: The string allows single
4335
(`'`) and double (`"`) quotes, which can be escaped using a backslash (`\`).
4436
@@ -130,10 +122,6 @@ representation. The braces are required in the sequence. E.g. `"\u{41}" === "A"`
130122
131123
## Integer
132124
133-
<secondary-label ref="phpstan"/>
134-
<secondary-label ref="psalm"/>
135-
<secondary-label ref="storm"/>
136-
137125
The syntax of integer numbers is similar to the PHP language. Binary, octal,
138126
decimal and hexadecimal number systems are supported.
139127
@@ -279,10 +267,6 @@ the numbers between `0` and `F` and must match the regular expression
279267
280268
## Float
281269
282-
<secondary-label ref="phpstan"/>
283-
<secondary-label ref="psalm"/>
284-
<secondary-label ref="storm"/>
285-
286270
The syntax of float numbers is similar to the PHP language. Basic floating point
287271
syntax and scientific notation are supported.
288272
@@ -340,7 +324,6 @@ trailing number may be omitted. Negative values are prefixed with a minus (`-`.
340324
341325
### Scientific Notation
342326
343-
<secondary-label ref="phpstan"/>
344327
345328
Scientific notation is a way of expressing numbers that are too large or too
346329
small to be conveniently written in decimal form, since to do so would require

Writerside/topics/language/logical-types.md

+18-17
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,27 @@ The TypeLang, [like PHP](https://www.php.net/manual/en/language.types.type-syste
66
Union and Intersection. The ability to specify a _nullable_ type using a
77
separate expression is also supported.
88

9-
### Union Type
10-
11-
<secondary-label ref="phpstan"/>
12-
<secondary-label ref="psalm"/>
13-
<secondary-label ref="storm"/>
9+
### Union Types
1410

1511
Each union type is separated by a pipe character (`|`) and may contain any other
1612
type definition.
1713

18-
> One of `A` **OR** `B` **OR** `C`.
14+
> `A` **OR** `B` **OR** `C`.
1915
> ```typescript
2016
> A | B | C
2117
> ```
2218
23-
### Intersection Type
24-
25-
<secondary-label ref="phpstan"/>
26-
<secondary-label ref="psalm"/>
27-
<secondary-label ref="storm"/>
19+
### Intersection Types
2820
2921
Each intersection type is separated by an ampersand character (`&`) and may
3022
contain any other type definition.
3123
32-
> All of `A` **AND** `B` **AND** `C`.
24+
> `A` **AND** `B` **AND** `C`.
3325
> ```typescript
3426
> A & B & C
3527
> ```
3628
37-
### Nullable Type
38-
39-
<secondary-label ref="phpstan"/>
40-
<secondary-label ref="psalm"/>
41-
<secondary-label ref="storm"/>
29+
### Nullable Types
4230
4331
Nullable type is a shortened alias for union type `T | null`
4432
and is written as `?T.`
@@ -66,3 +54,16 @@ and is written as `?T.`
6654
</tab>
6755
</tabs>
6856
57+
### Parentheses
58+
59+
Parentheses can be used to disambiguate types.
60+
61+
> `A` **AND** `B` _or_ `C`
62+
> ```typescript
63+
> (A & B) | C
64+
> ```
65+
>
66+
> `A` **AND** `C` _or_ `B` **AND** `C`
67+
> ```typescript
68+
> (A | B) & C
69+
> ```

Writerside/topics/language/shape-types.md

-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# Shape Types
2-
3-
<secondary-label ref="phpstan"/>
4-
<secondary-label ref="psalm"/>
5-
<secondary-label ref="storm"/>
62
<show-structure for="chapter" depth="2"/>
73

84
Each **composite** type can be rigidly described by a structural type called a
@@ -69,10 +65,6 @@ array{
6965
7066
### Unsealed Shapes
7167
72-
<secondary-label ref="phpstan"/>
73-
<secondary-label ref="psalm"/>
74-
<secondary-label ref="storm"/>
75-
7668
Unsealed (unclosed) shapes mean that the composite type can contain additional
7769
fields beyond those described in the shape. Such types must be terminated with
7870
the "`...`".
@@ -96,10 +88,6 @@ array{
9688

9789
### Typed Shapes
9890

99-
<secondary-label ref="phpstan"/>
100-
<secondary-label ref="psalm"/>
101-
<secondary-label ref="storm"/>
102-
10391
In addition, such shapes can describe template arguments (types) for values
10492
or for keys and values, which are described after the ellipsis (`...`) char
10593
and contain syntax [similar to generics](generic-types.md).

0 commit comments

Comments
 (0)