Skip to content

Commit

Permalink
Revert "Store schema versions for which the validation failed"
Browse files Browse the repository at this point in the history
This reverts commit 05ae98b.
  • Loading branch information
sebastianbergmann committed Jan 18, 2024
1 parent 05ae98b commit 0bf4d90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
6 changes: 1 addition & 5 deletions src/Util/Xml/SchemaDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,12 @@ public function detect(string $filename): SchemaDetectionResult

$schemaFinder = new SchemaFinder;

$tried = [];

foreach ($schemaFinder->available() as $candidate) {
$schema = (new SchemaFinder)->find($candidate);

if (!(new Validator)->validate($document, $schema)->hasValidationErrors()) {
return new SuccessfulSchemaDetectionResult($candidate, $tried);
return new SuccessfulSchemaDetectionResult($candidate);
}

$tried[] = $candidate;
}

return new FailedSchemaDetectionResult;
Expand Down
17 changes: 1 addition & 16 deletions src/Util/Xml/SuccessfulSchemaDetectionResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,12 @@ final class SuccessfulSchemaDetectionResult extends SchemaDetectionResult
*/
private $version;

/**
* @psalm-var list<non-empty-string>
*/
private $tried;

/**
* @psalm-param non-empty-string $version
* @psalm-param list<non-empty-string> $tried
*/
public function __construct(string $version, array $tried)
public function __construct(string $version)
{
$this->version = $version;
$this->tried = $tried;
}

/**
Expand All @@ -51,12 +44,4 @@ public function version(): string
{
return $this->version;
}

/**
* @psalm-return list<non-empty-string>
*/
public function tried(): array
{
return $this->tried;
}
}

0 comments on commit 0bf4d90

Please sign in to comment.