File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -28,12 +28,16 @@ public function detect(string $filename): SchemaDetectionResult
28
28
29
29
$ schemaFinder = new SchemaFinder ;
30
30
31
+ $ tried = [];
32
+
31
33
foreach ($ schemaFinder ->available () as $ candidate ) {
32
34
$ schema = (new SchemaFinder )->find ($ candidate );
33
35
34
36
if (!(new Validator )->validate ($ document , $ schema )->hasValidationErrors ()) {
35
- return new SuccessfulSchemaDetectionResult ($ candidate );
37
+ return new SuccessfulSchemaDetectionResult ($ candidate, $ tried );
36
38
}
39
+
40
+ $ tried [] = $ candidate ;
37
41
}
38
42
39
43
return new FailedSchemaDetectionResult ;
Original file line number Diff line number Diff line change @@ -21,12 +21,19 @@ final class SuccessfulSchemaDetectionResult extends SchemaDetectionResult
21
21
*/
22
22
private $ version ;
23
23
24
+ /**
25
+ * @psalm-var list<non-empty-string>
26
+ */
27
+ private $ tried ;
28
+
24
29
/**
25
30
* @psalm-param non-empty-string $version
31
+ * @psalm-param list<non-empty-string> $tried
26
32
*/
27
- public function __construct (string $ version )
33
+ public function __construct (string $ version, array $ tried )
28
34
{
29
35
$ this ->version = $ version ;
36
+ $ this ->tried = $ tried ;
30
37
}
31
38
32
39
/**
@@ -44,4 +51,12 @@ public function version(): string
44
51
{
45
52
return $ this ->version ;
46
53
}
54
+
55
+ /**
56
+ * @psalm-return list<non-empty-string>
57
+ */
58
+ public function tried (): array
59
+ {
60
+ return $ this ->tried ;
61
+ }
47
62
}
You can’t perform that action at this time.
0 commit comments