Skip to content

Commit 3617153

Browse files
committed
Fix minor, PHPStan warnings fixed
1 parent 01eeab0 commit 3617153

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/CalcGame.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function startCalcGame(): void
2828
$expressionResult = $number1 * $number2;
2929
break;
3030
}
31-
$expression = "{$number1} {$operation} {$number2}";
31+
$expression = "$number1 $operation $number2";
3232
$questions[$i] = $expression;
3333
$answers[$i] = $expressionResult;
3434
}

src/Cli.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function sayGreeting(string $gameDescription = ''): string
99
{
1010
line('Welcome to the Brain Games!');
1111
$name = prompt('May I have your name?');
12-
line("Hello, {$name}!");
12+
line("Hello, $name!");
1313
if (!empty($gameDescription)) {
1414
line($gameDescription);
1515
}
@@ -18,19 +18,19 @@ function sayGreeting(string $gameDescription = ''): string
1818

1919
function sayCongratulions(string $userName): void
2020
{
21-
line("Congratulations, {$userName}!");
21+
line("Congratulations, $userName!");
2222
}
2323

2424
function sayUserLose(string $userAnswer, string $correctAnswer, string $userName): void
2525
{
26-
line("'{$userAnswer}' is wrong answer ;(. Correct answer was '{$correctAnswer}'.");
27-
line("Let's try again, {$userName}!");
26+
line("'$userAnswer' is wrong answer ;(. Correct answer was '$correctAnswer'.");
27+
line("Let's try again, $userName!");
2828
}
2929

3030
function askQuestion(mixed $question): string
3131
{
32-
line("Question: {$question}");
33-
return prompt("Your answer",);
32+
line("Question: $question");
33+
return prompt("Your answer");
3434
}
3535

3636
function playGame(array $questions, array $correctAnswers, string $gameDescription): void

src/GcdGame.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function startGcdGame(): void
1212
$number1 = rand(1, 100);
1313
$number2 = rand(1, 100);
1414

15-
$questions[$i] = "{$number1} {$number2}";
15+
$questions[$i] = "$number1 $number2";
1616
$answers[$i] = findGcd($number1, $number2);
1717
}
1818
playGame($questions, $answers, 'Find the greatest common divisor of given numbers.');

src/ProgressionGame.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function startProgressionGame(): void
2424
playGame($questions, $answers, 'What number is missing in the progression?');
2525
}
2626

27-
function getProgressionElement(int $index, int $progressionStartNumber, int $progressionStep)
27+
function getProgressionElement(int $index, int $progressionStartNumber, int $progressionStep): int
2828
{
2929
return $progressionStartNumber + $index * $progressionStep;
3030
}

0 commit comments

Comments
 (0)