Skip to content

Commit d2ad107

Browse files
committed
Add additional platforms support for DocBlockParser::createDefault() method in docs
1 parent 0431d37 commit d2ad107

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

docs/Writerside/topics/phpdoc/custom-tags.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,16 @@ The built-in <code>StandardPlatform</code> is always loaded first, so every
147147
standard tag stays available; a platform passed in only adds to it, or overrides
148148
an entry when it reuses a name. The other built-in families (phpDocumentor,
149149
Psalm, PHPStan, Phan, PhpStorm, PHP CodeSniffer) are <b>not</b> loaded by the
150-
constructor — list them alongside your own platform when you need them, or see
151-
<a href="platforms.md"><code>DocBlockParser::createDefault()</code></a> for the
152-
full built-in set.
150+
constructor. To get the full built-in set together with your own platform, pass
151+
it to
152+
<a href="platforms.md"><code>DocBlockParser::createDefault()</code></a> via its
153+
<code>$additionalPlatforms</code> argument:
154+
155+
<code-block lang="php">
156+
$parser = DocBlockParser::createDefault(additionalPlatforms: [
157+
new MoneyPlatform(),
158+
]);
159+
</code-block>
153160
</note>
154161

155162
## Where to Go Next

docs/Writerside/topics/phpdoc/platforms.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,16 @@ factory:
6969
$parser = DocBlockParser::createDefault();
7070
</code-block>
7171

72-
To register your own platform on top of the built-in tool families, list them
73-
together in the constructor rather than passing yours alone.
72+
To register your own platform on top of the built-in tool families, pass it to
73+
<code>createDefault()</code> via the <code>$additionalPlatforms</code> argument —
74+
it is appended after the built-in platforms, so it extends them and overrides an
75+
entry only when it reuses the same name:
76+
77+
<code-block lang="php">
78+
$parser = DocBlockParser::createDefault(additionalPlatforms: [
79+
new MoneyPlatform(),
80+
]);
81+
</code-block>
7482
</note>
7583

7684
The definitions that end up registered are exposed as `$parser->tags` (a

0 commit comments

Comments
 (0)