Skip to content

Commit

Permalink
Merge pull request #554 from fredden/chore/drop-php-81-special-cases
Browse files Browse the repository at this point in the history
Remove now-unnecessary PHP <8.2 code
  • Loading branch information
Ocramius authored Nov 13, 2024
2 parents abb36cb + 63a3170 commit b6d5acd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
use function array_keys;
use function array_merge;

use const PHP_VERSION_ID;

class LocateDefinedSymbolsFromExtensions
{
/**
Expand All @@ -38,11 +36,6 @@ public function __invoke(array $extensionNames): array
foreach ($extensionNames as $extensionName) {
$extensionName = self::ALTERNATIVES[$extensionName] ?? $extensionName;

// @infection-ignore-all LessThan No point in testing this on 8.2.0 specifically
if ($extensionName === 'random' && PHP_VERSION_ID < 80200) {
continue;
}

try {
$extensionReflection = new ReflectionExtension($extensionName);
$definedSymbols = array_merge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
use function count;
use function in_array;

use const PHP_VERSION_ID;

final class LocateDefinedSymbolsFromExtensionsTest extends TestCase
{
private LocateDefinedSymbolsFromExtensions $locator;
Expand Down Expand Up @@ -72,36 +70,10 @@ public function testCanHandleMultipleExtensions(): void
$this->assertSame(array_merge($coreSymbols, $standardSymbols), $combinedSymbols);
}

public function testDoesNotCollectAnySymbolsForTheRandomExtensionOnPhpVersionsLowerThan82(): void
{
if (PHP_VERSION_ID >= 80200) {
$this->markTestSkipped('This test is only relevant for PHP versions lower than 8.2');
}

$symbols = $this->locator->__invoke(['random']);

$this->assertEmpty($symbols);
}

public function testCollectsSymbolsForTheRandomExtensionOnPhpVersions82AndHigher(): void
{
if (PHP_VERSION_ID < 80200) {
$this->markTestSkipped('This test is only relevant for PHP versions 8.2 and higher');
}

$symbols = $this->locator->__invoke(['random']);

$this->assertNotEmpty($symbols);
}

public function testDoesNotStopCollectingSymbolsWhenSkippingTheRandomExtension(): void
{
if (PHP_VERSION_ID >= 80200) {
$this->markTestSkipped('This test is only relevant for PHP versions lower than 8.2');
}

$symbols = $this->locator->__invoke(['random', 'Core']);

$this->assertNotEmpty($symbols);
}
}

0 comments on commit b6d5acd

Please sign in to comment.