Skip to content

Commit

Permalink
Legacy formatter: directory now has default value (#24)
Browse files Browse the repository at this point in the history
* Legacy formatter: directory now has default value

* Better default

* Fix neon schema

* wording
  • Loading branch information
janedbal authored Dec 13, 2024
1 parent 9907db8 commit cb4a3e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion extension.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ services:

parameters:
shipmonkBaselinePerIdentifier:
directory: null
indent: ' '

parametersSchema:
shipmonkBaselinePerIdentifier: structure([
directory: string()
directory: schema(string(), nullable())
indent: string()
])
6 changes: 5 additions & 1 deletion src/BaselinePerIdentifierFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ class BaselinePerIdentifierFormatter implements ErrorFormatter

private string $indent;

public function __construct(string $baselinesDir, string $indent)
public function __construct(?string $baselinesDir, string $indent)
{
if ($baselinesDir === null) {
throw new LogicException('Baselines directory must be set, please set up \'parameters.shipmonkBaselinePerIdentifier.directory\' in your phpstan configuration file');
}

$baselinesRealDir = realpath($baselinesDir);

if ($baselinesRealDir === false) {
Expand Down

0 comments on commit cb4a3e4

Please sign in to comment.