Skip to content

Commit

Permalink
Use different exception messages for PHP 7.* and 8.*
Browse files Browse the repository at this point in the history
  • Loading branch information
maks-rafalko committed Oct 30, 2020
1 parent 3649877 commit f6936c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Logger/ConsoleLogger.php
Expand Up @@ -86,7 +86,7 @@ final class ConsoleLogger extends AbstractLogger
LogLevel::NOTICE => 'note',
];

private \Infection\Console\IO $io;
private IO $io;

public function __construct(IO $io)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/MetricsCalculator.php
Expand Up @@ -69,7 +69,7 @@ class MetricsCalculator

private int $totalMutantsCount = 0;

private ?\Infection\Metrics\Calculator $calculator = null;
private ?Calculator $calculator = null;

public function __construct(int $roundingPrecision)
{
Expand Down
9 changes: 5 additions & 4 deletions tests/phpunit/Mutator/Removal/ArrayItemRemovalConfigTest.php
Expand Up @@ -78,10 +78,11 @@ public function test_the_limit_must_be_an_integer(): void

$this->fail();
} catch (TypeError $exception) {
$this->assertSame(
'Typed property Infection\Mutator\Removal\ArrayItemRemovalConfig::$limit must be int, string used',
$exception->getMessage()
);
$message = PHP_VERSION_ID < 80000
? 'Typed property Infection\Mutator\Removal\ArrayItemRemovalConfig::$limit must be int, string used'
: 'Cannot assign string to property Infection\Mutator\Removal\ArrayItemRemovalConfig::$limit of type int';

$this->assertSame($message, $exception->getMessage());
}
}

Expand Down

0 comments on commit f6936c8

Please sign in to comment.