Skip to content

Commit 293c45d

Browse files
committed
feature #101 Prepare support for doctrine/rst-parser: 0.5 (Nyholm)
This PR was merged into the main branch. Discussion ---------- Prepare support for doctrine/rst-parser: 0.5 This will allow us to print errors on Github actions. We are blocked by a release of doctrine/rst-parser:0.5 Commits ------- 0e68e35 Prepare support for doctrine/rst-parser: 0.5
2 parents 5493a49 + 0e68e35 commit 293c45d

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
}
1515
},
1616
"require": {
17-
"php": "^7.2 || ^8.0",
17+
"php": ">=7.4",
1818
"ext-json": "*",
1919
"ext-curl": "*",
20-
"doctrine/rst-parser": "^0.4",
20+
"doctrine/rst-parser": "^0.5",
2121
"scrivo/highlight.php": "^9.12.0",
2222
"symfony/filesystem": "^5.2",
2323
"symfony/finder": "^5.2",

src/BuildResult.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ class BuildResult
2525
public function __construct(Builder $builder)
2626
{
2727
$this->builder = $builder;
28-
$this->errors = $builder->getErrorManager()->getErrors();
28+
$this->errors = [];
29+
foreach ($builder->getErrorManager()->getErrors() as $error) {
30+
$this->errors[] = $error->asString();
31+
}
2932
}
3033

3134
public function appendError(string $errorMessage): void

src/Command/BuildDocsCommand.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ protected function configure()
7979
InputOption::VALUE_REQUIRED,
8080
'Path where any errors should be saved'
8181
)
82+
->addOption(
83+
'error-output-format',
84+
null,
85+
InputOption::VALUE_REQUIRED,
86+
'The output format for errors on std out',
87+
Configuration::OUTPUT_FORMAT_CONSOLE
88+
)
8289
->addOption(
8390
'no-theme',
8491
null,
@@ -137,7 +144,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
137144
KernelFactory::createKernel($this->buildConfig, $this->urlChecker ?? null)
138145
);
139146

140-
$this->addProgressListener($builder->getConfiguration()->getEventManager());
147+
$configuration = $builder->getConfiguration();
148+
$configuration->setOutputFormat($input->getOption('error-output-format'));
149+
$this->addProgressListener($configuration->getEventManager());
141150

142151
$builder->build(
143152
$this->buildConfig->getContentDir(),
@@ -159,7 +168,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
159168
}
160169

161170
$filesystem = new Filesystem();
162-
$filesystem->dumpFile($logPath, implode("\n", $buildErrors));
171+
$filesystem->dumpFile($logPath, implode("\n", array_map(fn($error) => is_string($error) ? $error : $error->asString(), $buildErrors)));
163172
}
164173

165174
$metas = $builder->getMetas();

0 commit comments

Comments
 (0)