Skip to content

Commit

Permalink
Allow resources to document its type
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys committed Feb 24, 2023
1 parent e2ae8da commit 5644514
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Type/ResourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,25 @@ class ResourceType implements Type
use NonGenericTypeTrait;
use UndecidedComparisonTypeTrait;

/** @see https://www.php.net/manual/en/resource.php */
private ?string $resourceType;

public function __construct(?string $resourceType = null)
{
$this->resourceType = $resourceType;
}

public function getResourceType(): ?string
{
return $this->resourceType;
}

public function describe(VerbosityLevel $level): string
{
if (null !== $this->resourceType) {
return sprintf('resource<%s>', $this->resourceType);
}

return 'resource';
}

Expand Down

0 comments on commit 5644514

Please sign in to comment.