Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove now-unnecessary PHP <8.2 code #554

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
Loading