Skip to content

Commit e9d9339

Browse files
committed
Use constant instead of private array
1 parent bc7d48c commit e9d9339

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Api/Status/GitHubStatusApi.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class GitHubStatusApi implements StatusApi
1111
/**
1212
* @var array<string, string>
1313
*/
14-
private static array $statusToLabel = [
14+
private const array STATUS_TO_LABEL = [
1515
Status::NEEDS_REVIEW => 'Status: Needs Review',
1616
Status::NEEDS_WORK => 'Status: Needs Work',
1717
Status::WORKS_FOR_ME => 'Status: Works for me',
@@ -27,7 +27,7 @@ public function __construct(
2727
private readonly LabelApi $labelsApi,
2828
private readonly LoggerInterface $logger,
2929
) {
30-
$this->labelToStatus = array_flip(self::$statusToLabel);
30+
$this->labelToStatus = array_flip(self::STATUS_TO_LABEL);
3131
}
3232

3333
/**
@@ -36,11 +36,11 @@ public function __construct(
3636
*/
3737
public function setIssueStatus(int $issueNumber, ?string $newStatus, Repository $repository): void
3838
{
39-
if (null !== $newStatus && !isset(self::$statusToLabel[$newStatus])) {
39+
if (null !== $newStatus && !isset(self::STATUS_TO_LABEL[$newStatus])) {
4040
throw new \InvalidArgumentException(sprintf('Invalid status "%s"', $newStatus));
4141
}
4242

43-
$newLabel = null === $newStatus ? null : self::$statusToLabel[$newStatus];
43+
$newLabel = null === $newStatus ? null : self::STATUS_TO_LABEL[$newStatus];
4444
$this->logger->info(sprintf('Fetching issue labels for issue %s, repository %s', $issueNumber, $repository->getFullName()));
4545
$currentLabels = $this->labelsApi->getIssueLabels($issueNumber, $repository);
4646

@@ -91,6 +91,6 @@ public function getIssueStatus(int $issueNumber, Repository $repository): ?strin
9191

9292
public static function getNeedsReviewLabel(): string
9393
{
94-
return self::$statusToLabel[Status::NEEDS_REVIEW];
94+
return self::STATUS_TO_LABEL[Status::NEEDS_REVIEW];
9595
}
9696
}

0 commit comments

Comments
 (0)