1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-15 02:47:02 +01:00
psalm/bin/generate_issues_list_doc.php

26 lines
848 B
PHP
Raw Normal View History

2022-01-12 22:22:21 +01:00
#!/usr/bin/env php
<?php
2022-01-12 22:33:26 +01:00
$docs_dir = dirname(__DIR__) . DIRECTORY_SEPARATOR . "docs"
. DIRECTORY_SEPARATOR . "running_psalm" . DIRECTORY_SEPARATOR;
2022-01-12 22:22:21 +01:00
$issues_index = "{$docs_dir}issues.md";
$issues_dir = "{$docs_dir}issues";
if (!file_exists($issues_dir)) {
throw new UnexpectedValueException("Issues documentation not found");
}
$issues_list = array_filter(array_map(function (string $issue_file) {
if ($issue_file === "." || $issue_file === ".." || substr($issue_file, -3) !== ".md") {
return false;
}
$issue = substr($issue_file, 0, strlen($issue_file) - 3);
return " - [$issue](issues/$issue.md)";
}, scandir($issues_dir)));
usort($issues_list, "strcasecmp");
$issues_md_contents = array_merge(["# Issue types", ""], $issues_list, [""]);
file_put_contents($issues_index, implode("\n", $issues_md_contents));