Skip to content

Commit e929b63

Browse files
committed
add superseded-by name next to deprecated functions in API
1 parent c0c5612 commit e929b63

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

build/src/ApiGenerator/Application/ApiMarkdownGenerator.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,18 @@ public function generate(): array
4040
foreach ($fns as $fn) {
4141
$result[] = "### `{$fn->nameWithNamespace()}`";
4242
if (isset($fn->meta['deprecated'])) {
43-
$result[] = sprintf(
44-
'<small><span style="color: red; font-weight: bold;">Deprecated</span>: %s</small>',
43+
$deprecatedMessage = sprintf(
44+
'<small><span style="color: red; font-weight: bold;">Deprecated</span>: %s',
4545
$fn->meta['deprecated']
4646
);
47+
if (isset($fn->meta['superseded-by'])) {
48+
$deprecatedMessage .= sprintf(
49+
' &mdash; Use `%s` instead',
50+
$fn->meta['superseded-by']
51+
);
52+
}
53+
$deprecatedMessage .= '</small>';
54+
$result[] = $deprecatedMessage;
4755
}
4856
$result[] = $fn->doc;
4957
if ($fn->githubUrl !== '') {

0 commit comments

Comments
 (0)