File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 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
2828
2929 $ schemaFinder = new SchemaFinder ;
3030
31+ $ tried = [];
32+
3133 foreach ($ schemaFinder ->available () as $ candidate ) {
3234 $ schema = (new SchemaFinder )->find ($ candidate );
3335
3436 if (!(new Validator )->validate ($ document , $ schema )->hasValidationErrors ()) {
35- return new SuccessfulSchemaDetectionResult ($ candidate );
37+ return new SuccessfulSchemaDetectionResult ($ candidate, $ tried );
3638 }
39+
40+ $ tried [] = $ candidate ;
3741 }
3842
3943 return new FailedSchemaDetectionResult ;
Original file line number Diff line number Diff line change @@ -21,12 +21,19 @@ final class SuccessfulSchemaDetectionResult extends SchemaDetectionResult
2121 */
2222 private $ version ;
2323
24+ /**
25+ * @psalm-var list<non-empty-string>
26+ */
27+ private $ tried ;
28+
2429 /**
2530 * @psalm-param non-empty-string $version
31+ * @psalm-param list<non-empty-string> $tried
2632 */
27- public function __construct (string $ version )
33+ public function __construct (string $ version, array $ tried )
2834 {
2935 $ this ->version = $ version ;
36+ $ this ->tried = $ tried ;
3037 }
3138
3239 /**
@@ -44,4 +51,12 @@ public function version(): string
4451 {
4552 return $ this ->version ;
4653 }
54+
55+ /**
56+ * @psalm-return list<non-empty-string>
57+ */
58+ public function tried (): array
59+ {
60+ return $ this ->tried ;
61+ }
4762}
You can’t perform that action at this time.
0 commit comments