Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow string|\Stringable for $help param #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class Metric {
/**
* The help message for the metric.
*
* @var string
* @var string|\Stringable
*/
protected $help;

Expand All @@ -40,10 +40,10 @@ abstract class Metric {
* The metric namespace.
* @param string $name
* The metric name.
* @param string $help
* @param string|\Stringable $help
* The help message for the metric.
*/
public function __construct(string $namespace, string $name, string $help) {
public function __construct(string $namespace, string $name, string|\Stringable $help) {
$fullName = $namespace . '_' . $name;
$this->validateName($fullName);
$this->name = $fullName;
Expand Down Expand Up @@ -71,10 +71,10 @@ public function getName(): string {
/**
* Gets the Help.
*
* @return string
* @return string|\Stringable
* The Help.
*/
public function getHelp(): string {
public function getHelp(): string|\Stringable {
return $this->help;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Summary extends Metric {
/**
* Summary constructor.
*/
public function __construct(string $namespace, string $name, string $help, $label) {
public function __construct(string $namespace, string $name, string|\Stringable $help, $label) {
parent::__construct($namespace, $name, $help);
$this->sum = 0;
$this->count = 0;
Expand Down