classFormatOptions
final class FormatOptions
Public API: explicitly declared with
@visibility public.Immutable layout choices shared by all dialects.
$options = new \SqlFormatter\Core\FormatOptions(\SqlFormatter\Core\Style::River, 2);
$options->style->value // => 'river'
$options->indentWidth // => 2Properties§
public Style $style = Style::Expandedpublic int $indentWidth = 4Methods§
public function __construct(public Style $style = Style::Expanded, public int $indentWidth = 4)Parameters
$style | Style | Layout preset |
$indentWidth | int | Spaces per nested block, from 1 to 16 |
Throws
InvalidArgumentException When the indentation is outside the supported rangeCalls 2
- class-const Style::Expanded() line 27
- new
InvalidArgumentExceptionline 31
Test cases 29§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 27
FormatterBench::setUpCompactcallsFormatTarget::optionscallsSettingsTestcallsDialectTest::testCompactRulesCanProvideAnIndependentGrammarcallsFormatterTestcallsBlockTest::testRenderFormatsNestedBlockscallsElementsTest::testWriteFormatsCaseBranchescallsHeadersTest::testWriteAlignsRiverHeadercallsPolicyTest::testAfterHeaderBreaksExpandedBodycallsPolicyTest::testBeforeHeaderAndBodyPlacementcallsPolicyTest::testBodyIndentUsesAlignedContentColumncallsPolicyTest::testLineUsesRequestedColumncallsRendererTest::testRenderExpandedPreservesSpellingcallsFormatterTest::testFormatEveryGrammarReleasecallsFormatterTest::testFormatFourLayoutscallsFormatterTest::testFormatGeneratedStatementscallsFormatterTest::testFormatKeepsHostnamesAdjacentToAtSignscallsFormatterTest::testFormatNestedCteWithConfiguredIndentcallsFormatterTest::testFormatPreservesMysqlSqlModecallsFormatterTest::testFormatPreservesTokensAndIsIdempotentcallsFormatterTest::testFormatRemainsCanonicalAcrossLayoutscallsDialectTestcallsDialectTestcallsDialectTestcallsPlatformTest::testAnalyzeFakerRegressionscallsPlatformTest::testAnalyzePreservesKeywordNamesBeforeDotscallsPlatformTest::testAnalyzeRoundTripsCompleteStatementscalls
Relations§
Instantiated in 5
- new SqlCatalog\Platform\MySql\SqlFormatter::format() packages/sql-catalog/src/Platform/MySql/SqlFormatter.php:30
- new SqlCatalog\Platform\PostgreSql\SqlFormatter::format() packages/sql-catalog/src/Platform/PostgreSql/SqlFormatter.php:30
- new SqlCatalog\Platform\Sqlite\SqlFormatter::format() packages/sql-catalog/src/Platform/Sqlite/SqlFormatter.php:30
- new SqlFormatter\Core\Formatter::__construct() packages/sql-formatter/src/Core/Formatter.php:26
- new SqlFormatter\Facade\Formatter::__construct() packages/sql-formatter/src/Facade/Formatter.php:30
Type declarations 5
- type SqlFormatter\Core\Formatter packages/sql-formatter/src/Core/Formatter.php:26
- type SqlFormatter\Core\Layout\Block packages/sql-formatter/src/Core/Layout/Block.php:20
- type SqlFormatter\Core\Layout\Policy packages/sql-formatter/src/Core/Layout/Policy.php:20
- type SqlFormatter\Core\Layout\Renderer packages/sql-formatter/src/Core/Layout/Renderer.php:22
- type SqlFormatter\Facade\Formatter packages/sql-formatter/src/Facade/Formatter.php:30