classFormatter
final class Formatter
Rewrites configuration and definition documents in their canonical form.
Methods§
public function format(
list<string> $files,
bool $check,
array<string, mixed> $markdown = [],
): list<string>Formats documents, or only reports which would change.
Parameters
$files | list<string> | The configuration file followed by the definition files |
$check | bool | Whether to leave the files unchanged |
$markdown | array<string, mixed> | The markdown options |
Returns
list<string> The files whose text differs from the canonical formThrows
InvalidInputException When a document is invalidJsonException When a document cannot be convertedRuntimeException When a file cannot be writtenTest cases 13
MarkdownDocumentTest::testReadAcceptsTheProposedSelectorCommentAndReasonSpellingcallsMarkdownDocumentTest::testReadMatchesTheYamlModelAndRenderShowsOnlyReaderFacingInformationcallsMarkdownDocumentTest::testReadResolvesCitationsFromTheMarkdownFileAndKeepsQuotationsSeparatecallsMarkdownDocumentTest::testReadSharesTheYamlModelAndRenderPreservesLinksAndBadgescallsMarkdownDocumentTest::testRenderAddsTextFragmentNavigationForAComplexCssSelectorcallsFormatterTest::testFormatKeepsBundledSchemaDeclarationsAndEmptyMapscallsFormatterTest::testFormatLeavesCanonicalDocumentsUnchangedcallsFormatterTest::testFormatOnlyReportsChangesWhenCheckingcallsFormatterTest::testFormatReadsTheFirstFileAsTheConfigurationcallsFormatterTest::testFormatRejectsAnInvalidDefinitioncallsFormatterTest::testFormatRendersMarkdownDefinitionsAsMarkdowncallsFormatterTest::testFormatRequiresTheMarkdownOptIncallsFormatterTest::testFormatRewritesDocumentsInTheirCanonicalFormcalls
Called from 1
Calls 8
- new DocumentReader line 34
- method-call DocumentReader::read() line 35
- function-call
dirnameline 35 - static-call DocumentReader::isMarkdown() line 36
- static-call DocumentReader::yaml() line 36
- function-call
file_get_contentsline 37 - function-call
file_put_contentsline 39 - new
RuntimeExceptionline 40
Test cases 15§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 8
FormatterTest::testFormatKeepsBundledSchemaDeclarationsAndEmptyMapscallsFormatterTest::testFormatLeavesCanonicalDocumentsUnchangedcallsFormatterTest::testFormatOnlyReportsChangesWhenCheckingcallsFormatterTest::testFormatReadsTheFirstFileAsTheConfigurationcallsFormatterTest::testFormatRejectsAnInvalidDefinitioncallsFormatterTest::testFormatRendersMarkdownDefinitionsAsMarkdowncallsFormatterTest::testFormatRequiresTheMarkdownOptIncallsFormatterTest::testFormatRewritesDocumentsInTheirCanonicalFormcalls
Other tests reaching this symbol 7
MarkdownCommandTestcallsMarkdownDocumentTest::testReadAcceptsTheProposedSelectorCommentAndReasonSpellingcallsMarkdownDocumentTest::testReadMatchesTheYamlModelAndRenderShowsOnlyReaderFacingInformationcallsMarkdownDocumentTest::testReadResolvesCitationsFromTheMarkdownFileAndKeepsQuotationsSeparatecallsMarkdownDocumentTest::testReadSharesTheYamlModelAndRenderPreservesLinksAndBadgescallsMarkdownDocumentTest::testRenderAddsTextFragmentNavigationForAComplexCssSelectorcallsExecutorTestcalls