Skip to content

Commit cb4a3e4

Browse files
authored
Legacy formatter: directory now has default value (#24)
* Legacy formatter: directory now has default value * Better default * Fix neon schema * wording
1 parent 9907db8 commit cb4a3e4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

extension.neon

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ services:
77

88
parameters:
99
shipmonkBaselinePerIdentifier:
10+
directory: null
1011
indent: ' '
1112

1213
parametersSchema:
1314
shipmonkBaselinePerIdentifier: structure([
14-
directory: string()
15+
directory: schema(string(), nullable())
1516
indent: string()
1617
])

src/BaselinePerIdentifierFormatter.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ class BaselinePerIdentifierFormatter implements ErrorFormatter
2929

3030
private string $indent;
3131

32-
public function __construct(string $baselinesDir, string $indent)
32+
public function __construct(?string $baselinesDir, string $indent)
3333
{
34+
if ($baselinesDir === null) {
35+
throw new LogicException('Baselines directory must be set, please set up \'parameters.shipmonkBaselinePerIdentifier.directory\' in your phpstan configuration file');
36+
}
37+
3438
$baselinesRealDir = realpath($baselinesDir);
3539

3640
if ($baselinesRealDir === false) {

0 commit comments

Comments
 (0)