Skip to content

Commit

Permalink
Narrow types
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jan 18, 2024
1 parent 5dbc551 commit 3d0024b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Util/Xml/SchemaDetectionResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/
abstract class SchemaDetectionResult
{
/**
* @psalm-assert-if-true SuccessfulSchemaDetectionResult $this
*/
public function detected(): bool
{
return false;
Expand Down
11 changes: 10 additions & 1 deletion src/Util/Xml/SuccessfulSchemaDetectionResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,29 @@
final class SuccessfulSchemaDetectionResult extends SchemaDetectionResult
{
/**
* @var string
* @psalm-var non-empty-string
*/
private $version;

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

/**
* @psalm-assert-if-true SuccessfulSchemaDetectionResult $this
*/
public function detected(): bool
{
return true;
}

/**
* @psalm-return non-empty-string
*/
public function version(): string
{
return $this->version;
Expand Down

0 comments on commit 3d0024b

Please sign in to comment.