Skip to content

Commit 9439307

Browse files
committed
Add attributes documentation and a little more improvements
1 parent 5dc9257 commit 9439307

25 files changed

+855
-256
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
# Replace HI with the ID of the instance in capital letters
1818
ARTIFACT: webHelpTL2-all.zip
1919
# Writerside docker image version
20-
DOCKER_VERSION: 233.14938
20+
DOCKER_VERSION: 242.21870
2121
# Add the variable below to upload Algolia indexes
2222
# Replace HI with the ID of the instance in capital letters
2323
ALGOLIA_ARTIFACT: algolia-indexes-TL.zip

Writerside/cfg/buildprofiles.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
<sitemap priority="0.35" change-frequency="monthly"/>
55

66
<variables>
7-
<primary-color>blueberry</primary-color>
8-
<color-preset>vivid</color-preset>
7+
<primary-color>#2e44b2</primary-color>
8+
<link-color>#1f55be</link-color>
9+
<color-preset>contrast</color-preset>
910
<custom-favicons>logo.svg</custom-favicons>
1011
<header-logo>logo.svg</header-logo>
1112
<product-web-url>https://typelang.dev</product-web-url>
1213
<noindex-content>false</noindex-content>
13-
<offline-docs>true</offline-docs>
14+
<offline-docs>false</offline-docs>
1415

1516
<feedback-url>https://github.com/php-type-language/docs/issues</feedback-url>
1617
<web-root>/</web-root>
@@ -21,8 +22,9 @@
2122
<download-page>https://github.com/php-type-language</download-page>
2223
<showDownloadButton>true</showDownloadButton>
2324

24-
<enable-browser-edits>true</enable-browser-edits>
25-
<browser-edits-url>https://github.com/php-type-language/docs/blob/master/Writerside/</browser-edits-url>
25+
<enable-contribution>true</enable-contribution>
26+
<contribute-url>https://github.com/php-type-language/docs/blob/master/Writerside/</contribute-url>
27+
<custom-css>custom.css</custom-css>
2628
</variables>
2729

2830
<icons>
@@ -31,6 +33,7 @@
3133

3234
<footer>
3335
<social href="https://github.com/php-type-language" type="blog">GitHub</social>
36+
<link href="https://packagist.org/packages/type-lang/parser">Packagist</link>
3437
<link href="https://github.com/php-type-language/parser/issues">Issue tracker</link>
3538
<link href="https://github.com/php-type-language/parser/pulls">Submit request</link>
3639
<copyright>PHP TypeLang</copyright>

Writerside/cfg/static/custom.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.article > .prompt {
2+
max-width: auto !important;
3+
}
4+
5+
.prompt__wrapper {
6+
display: flex;
7+
}
8+
9+
.prompt__content {
10+
overflow: visible;
11+
}
12+
13+
.prompt__wrapper > .prompt__content {
14+
flex: 1;
15+
}
16+
17+
.article__list + .code-block__wrapper,
18+
.article__list + .code-collapse__wrapper,
19+
p + .code-block__wrapper,
20+
p + .code-collapse__wrapper,
21+
.code-block__wrapper + .code-collapse__wrapper,
22+
.code-block__wrapper + .code-block__wrapper {
23+
margin-top: 12px !important;
24+
}

Writerside/labels.list

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE labels SYSTEM "https://resources.jetbrains.com/writerside/1.0/labels-list.dtd">
3+
<labels xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/labels.xsd">
5+
<primary-label id="component" name="Component" short-name="C" color="purple">
6+
The implementation of the functionality available for installation
7+
</primary-label>
8+
9+
<secondary-label id="psalm" name="Psalm" color="blue">
10+
Also partially or fully supported by Psalm Linter.
11+
Check out Psalm documentation for more details.
12+
</secondary-label>
13+
<secondary-label id="phpstan" name="PHPStan" color="blue">
14+
Also partially or fully supported by PHPStan Linter.
15+
Check out PHPStan documentation for more details.
16+
</secondary-label>
17+
<secondary-label id="storm" name="PhpStorm" color="blue">
18+
Also partially or fully supported by PhpStorm IDE.
19+
Check out PhpStorm documentation for more details.
20+
</secondary-label>
21+
22+
<secondary-label id="wip" name="WIP" color="red">Work in progress</secondary-label>
23+
<secondary-label id="beta" name="β" color="tangerine">Beta</secondary-label>
24+
<secondary-label id="1.1" name="TypeLang 1.1" color="strawberry">Since type-lang/parser v1.1</secondary-label>
25+
</labels>

Writerside/tl.tree

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
<!DOCTYPE instance-profile
33
SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">
44

5-
<instance-profile id="tl"
6-
name="PHP TypeLang"
7-
status="eap"
8-
is-library="true"
9-
start-page="overview.topic">
10-
5+
<instance-profile id="tl" name="PHP TypeLang" is-library="true" start-page="overview.topic">
116
<toc-element topic="overview.topic" />
127

138
<toc-element topic="language.md" toc-title="Syntax">
@@ -18,10 +13,12 @@
1813
<toc-element topic="const-types.md" toc-title="Constants"/>
1914
<toc-element topic="shape-types.md" toc-title="Shapes"/>
2015
<toc-element topic="callable-types.md" toc-title="Callables"/>
21-
<toc-element topic="conditional-types.md" toc-title="Conditions" hidden="true"/>
16+
<toc-element topic="conditional-types.md" toc-title="Conditions"/>
2217
</toc-element>
2318

2419
<toc-element topic="parser.md" toc-title="Parser">
20+
<toc-element topic="features.md"/>
21+
<toc-element topic="tolerant-mode.md"/>
2522
<toc-element topic="visitors.md">
2623
<toc-element topic="class-name-matcher-visitor.md"/>
2724
<toc-element topic="stream-dumper-visitor.md"/>

Writerside/topics/language.md

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ General table across all type parsing capabilities
4444
<tr>
4545
<td>
4646
<note>
47-
<format style="bold" color="DarkSeaGreen">60/60</format>
47+
<format style="bold" color="DarkSeaGreen">62/62</format>
4848
</note>
4949
</td>
5050
<td>
5151
<warning>
52-
<format style="bold" color="RosyBrown">42/60</format>
52+
<format style="bold" color="RosyBrown">42/62</format>
5353
</warning>
5454
</td>
5555
<td>
5656
<warning>
57-
<format style="bold" color="RosyBrown">46/60</format>
57+
<format style="bold" color="RosyBrown">46/62</format>
5858
</warning>
5959
</td>
6060
</tr>
@@ -217,6 +217,28 @@ Below is a list of simple, logical and other common types.
217217
</a>
218218
</td>
219219
</tr>
220+
<tr>
221+
<td colspan="4">
222+
<a href="generic-types.md" anchor="attributes">
223+
Template argument attributes
224+
</a>
225+
<code-block lang="typescript">
226+
ExampleCollection&lt;#[assert(not&lt;"0">)] array-key>
227+
</code-block>
228+
</td>
229+
</tr>
230+
<tr>
231+
<td></td>
232+
<td><icon src="ok.svg"/></td>
233+
<td>
234+
<icon src="ko.svg"/>
235+
Not Supported
236+
</td>
237+
<td>
238+
<icon src="ko.svg"/>
239+
Not Supported
240+
</td>
241+
</tr>
220242
<tr>
221243
<td></td>
222244
<td colspan="3">
@@ -308,17 +330,17 @@ Below is a list of simple, logical and other common types.
308330
<td></td>
309331
<td>
310332
<note>
311-
<format style="bold" color="DarkSeaGreen">11/11</format>
333+
<format style="bold" color="DarkSeaGreen">11/12</format>
312334
</note>
313335
</td>
314336
<td>
315337
<warning>
316-
<format style="bold" color="RosyBrown">9/11</format>
338+
<format style="bold" color="RosyBrown">9/12</format>
317339
</warning>
318340
</td>
319341
<td>
320342
<warning>
321-
<format style="bold" color="RosyBrown">10/11</format>
343+
<format style="bold" color="RosyBrown">10/12</format>
322344
</warning>
323345
</td>
324346
</tr>
@@ -1410,22 +1432,41 @@ Below is a list of grammar of shaped types.
14101432
</deflist>
14111433
</td>
14121434
</tr>
1435+
<tr>
1436+
<td colspan="4">
1437+
<a href="shape-types.md" anchor="attributes">
1438+
Shape field attributes
1439+
</a>
1440+
<code-block lang="typescript">
1441+
object {
1442+
#[inline, assert(not&lt;"">)]
1443+
name: string
1444+
}
1445+
</code-block>
1446+
</td>
1447+
</tr>
1448+
<tr>
1449+
<td></td>
1450+
<td><icon src="ok.svg"/></td>
1451+
<td><icon src="ko.svg"/></td>
1452+
<td><icon src="ko.svg"/></td>
1453+
</tr>
14131454
<tr>
14141455
<td></td>
14151456
<td>
14161457
<note>
1417-
<format style="bold" color="DarkSeaGreen">10/10</format>
1458+
<format style="bold" color="DarkSeaGreen">11/11</format>
14181459
</note>
14191460
</td>
14201461
<td>
14211462
<warning>
1422-
<format style="bold" color="RosyBrown">9/10</format>
1463+
<format style="bold" color="RosyBrown">9/11</format>
14231464
</warning>
14241465
</td>
14251466
<td>
1426-
<note>
1427-
<format style="bold" color="DarkSeaGreen">10/10</format>
1428-
</note>
1467+
<warning>
1468+
<format style="bold" color="RosyBrown">10/11</format>
1469+
</warning>
14291470
</td>
14301471
</tr>
14311472
</table>

Writerside/topics/language/basic-types.md

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Basic Types
22

3+
<secondary-label ref="phpstan"/>
4+
<secondary-label ref="psalm"/>
5+
<secondary-label ref="storm"/>
36
<show-structure for="chapter" depth="2"/>
47

58
The parser does not impose restrictions on type naming. The type name must begin
@@ -24,21 +27,18 @@ is **unacceptable**.
2427
> ```typescript
2528
> ExampleTypeName
2629
> ```
27-
> {style="note"}
2830
2931
> Dashes (`-`) in <tooltip term="Identifier">Identifier</tooltip> are also
3032
> acceptable.
3133
> ```typescript
3234
> example-type
3335
> ```
34-
> {style="note"}
3536
3637
> The reserved keyword (`true`) is allowed as part of the <tooltip
3738
> term="Identifier">Identifier</tooltip>.
3839
> ```typescript
3940
> true-type
4041
> ```
41-
> {style="note"}
4242
4343
</tab>
4444
<tab title="Counterexamples">
@@ -48,29 +48,38 @@ is **unacceptable**.
4848
> literal value rather than an <tooltip term="Identifier">Identifier</tooltip>.
4949
> ```typescript
5050
> TrUe
51-
>
52-
> // TypeLang\Parser\Node\Literal\BoolLiteralNode {
53-
> // +offset: 0
54-
> // +raw: "TrUe"
55-
> // +value: true
56-
> // }
5751
> ```
52+
> ```php
53+
> TypeLang\Parser\Node\Literal\BoolLiteralNode {
54+
> +offset: 0
55+
> +raw: "TrUe"
56+
> +value: true
57+
> }
58+
> ```
59+
> {collapsible="true" collapsed-title="TypeLang\Parser\Node\Literal\BoolLiteralNode"}
60+
>
5861
> {style="warning"}
5962
6063
> <tooltip term="Identifier">Identifiers</tooltip> cannot begin with digits
6164
> (`0-9`) or a dash (`-`) symbol.
6265
> ```typescript
6366
> 42type
64-
>
65-
> // Syntax error, unexpected "type"
6667
> ```
68+
> ```
69+
> Syntax error, unexpected "type"
70+
> ```
71+
> {collapsible="true" collapsed-title="TypeLang\Parser\Exception\ParseException"}
6772
> {style="warning"}
6873
6974
</tab>
7075
</tabs>
7176
7277
## Namespace
7378
79+
<secondary-label ref="phpstan"/>
80+
<secondary-label ref="psalm"/>
81+
<secondary-label ref="storm"/>
82+
7483
Each name can contain a namespace symbol (`\` — backslash), which is
7584
[similar to that in PHP](https://www.php.net/manual/en/language.namespaces.rationale.php). The separator can be located either in the middle
7685
or at the beginning of any <tooltip term="Identifier">Identifier</tooltip>. End
@@ -86,13 +95,11 @@ The namespace delimiter can be used in conjunction with keywords such as `true`,
8695
> ```typescript
8796
> Example\Name
8897
> ```
89-
> {style="note"}
9098
9199
> Absolute class <tooltip term="FQN">FQN</tooltip> reference.
92100
> ```typescript
93101
> \Absolute\Type\Name
94102
> ```
95-
> {style="note"}
96103
97104
</tab>
98105
<tab title="Counterexamples">
@@ -101,17 +108,21 @@ The namespace delimiter can be used in conjunction with keywords such as `true`,
101108
> reserved for literal values.
102109
> ```typescript
103110
> true\null
104-
>
105-
> // Syntax error, unexpected "\"
106111
> ```
112+
> ```
113+
> Syntax error, unexpected "\"
114+
> ```
115+
> {collapsible="true" collapsed-title="TypeLang\Parser\Exception\ParseException"}
107116
> {style="warning"}
108117
109118
> <tooltip term="FQN">FQN</tooltip> type names cannot end in `\` delimiter.
110119
> ```typescript
111120
> example\name\
112-
>
113-
> // Syntax error, unexpected end of input
114121
> ```
122+
> ```
123+
> Syntax error, unexpected end of input
124+
> ```
125+
> {collapsible="true" collapsed-title="TypeLang\Parser\Exception\ParseException"}
115126
> {style="warning"}
116127
117128
</tab>

0 commit comments

Comments
 (0)