Skip to content

Commit 2515ee0

Browse files
committed
bug #178 Fix type issues (Nyholm)
This PR was squashed before being merged into the master branch. Discussion ---------- Fix type issues I see this error in the logs: > Error thrown while running command "app:task:run". Message: "Argument 1 passed to App\Repository\TaskRepository::getTasksToVerify() must be of the type int, string given, called in /app/src/Command/RunTaskCommand.php on line 39" command="app:task:run" Commits ------- 22a4882 Fix type issues
2 parents aad63d4 + 22a4882 commit 2515ee0

File tree

6 files changed

+7
-8
lines changed

6 files changed

+7
-8
lines changed

src/Command/ListTaskCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ protected function configure()
3333

3434
protected function execute(InputInterface $input, OutputInterface $output)
3535
{
36-
/** @var int|null $number */
36+
/** @var mixed|null $number */
3737
$number = $input->getOption('number');
3838
if (null === $number) {
3939
$criteria = [];
4040
} else {
41-
$criteria = ['number' => $number];
41+
$criteria = ['number' => (int) $number];
4242
}
4343

4444
$limit = 100;

src/Command/PingStaleIssuesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8080
$this->labelApi->addIssueLabel($issue['number'], 'Stalled', $repository);
8181

8282
// add a scheduled task to process this issue again after 2 weeks
83-
$this->scheduler->runLater($repository, $issue['number'], Task::ACTION_INFORM_CLOSE_STALE, new \DateTimeImmutable(self::MESSAGE_TWO_AFTER));
83+
$this->scheduler->runLater($repository, (int) $issue['number'], Task::ACTION_INFORM_CLOSE_STALE, new \DateTimeImmutable(self::MESSAGE_TWO_AFTER));
8484
}
8585

8686
return 0;

src/Command/RunTaskCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ protected function configure()
3434

3535
protected function execute(InputInterface $input, OutputInterface $output)
3636
{
37-
/** @var int $limit */
38-
$limit = $input->getOption('limit');
37+
$limit = (int) $input->getOption('limit');
3938
foreach ($this->repository->getTasksToVerify($limit) as $task) {
4039
try {
4140
$this->taskRunner->run($task);

src/Service/TaskScheduler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(TaskRepository $taskRepo)
2222
$this->taskRepo = $taskRepo;
2323
}
2424

25-
public function runLater(Repository $repository, $number, int $action, \DateTimeImmutable $checkAt)
25+
public function runLater(Repository $repository, int $number, int $action, \DateTimeImmutable $checkAt)
2626
{
2727
$task = new Task($repository->getFullName(), $number, $action, $checkAt);
2828
$this->taskRepo->persist($task);

src/Subscriber/CloseDraftPRSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function onPullRequest(GitHubEvent $event)
3131
return;
3232
}
3333

34-
$number = $data['pull_request']['number'];
34+
$number = (int) $data['pull_request']['number'];
3535
$this->issueApi->commentOnIssue($repository, $number, <<<TXT
3636
Hey!
3737

src/Subscriber/FindReviewerSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function onPullRequest(GitHubEvent $event)
3636
$repository = $event->getRepository();
3737

3838
// set scheduled task to run in 20 hours
39-
$this->scheduler->runLater($repository, $data['number'], Task::ACTION_SUGGEST_REVIEWER, new \DateTimeImmutable('+20hours'));
39+
$this->scheduler->runLater($repository, (int) $data['number'], Task::ACTION_SUGGEST_REVIEWER, new \DateTimeImmutable('+20hours'));
4040
}
4141

4242
/**

0 commit comments

Comments
 (0)