Skip to content

Commit

Permalink
Remove dead PHP_VERSION_ID check (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored Nov 14, 2024
1 parent 24b567f commit df9c68f
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 61 deletions.
24 changes: 11 additions & 13 deletions tests/default/DbaInferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ class DbaInferenceTest extends TypeInferenceTestCase
{
public function dataFileAsserts(): iterable
{
if (\PHP_VERSION_ID >= 70300) {
if (! InstalledVersions::isInstalled('doctrine/dbal')) {
throw new \Exception('doctrine/dbal 3.x is required to run tests for php 7.3+. Please install it via composer.');
}

yield from $this->gatherAssertTypes(__DIR__ . '/data/doctrine-dbal-union-result.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/doctrine-dbal.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/inference-placeholder.php');

// for some reason does not work in pgsql
if ('pdo-pgsql' !== getenv('DBA_REFLECTOR')) {
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-680.php');
}
if (! InstalledVersions::isInstalled('doctrine/dbal')) {
throw new \Exception('doctrine/dbal 3.x is required to run tests for php 7.3+. Please install it via composer.');
}

yield from $this->gatherAssertTypes(__DIR__ . '/data/doctrine-dbal-union-result.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/doctrine-dbal.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/inference-placeholder.php');

// for some reason does not work in pgsql
if ('pdo-pgsql' !== getenv('DBA_REFLECTOR')) {
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-680.php');
}

// make sure class constants can be resolved
Expand Down
8 changes: 0 additions & 8 deletions tests/rules/QueryPlanAnalyzerRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ public function testNotUsingIndex(): void
self::markTestSkipped('query plan analyzer requires a active database connection');
}

if (\PHP_VERSION_ID < 70300) {
self::markTestSkipped('not yet supported on php < 7.3');
}

$this->numberOfAllowedUnindexedReads = true;
$this->numberOfRowsNotRequiringIndex = 2;

Expand Down Expand Up @@ -111,10 +107,6 @@ public function testNotUsingIndexInDebugMode(): void
self::markTestSkipped('query plan analyzer requires a active database connection');
}

if (\PHP_VERSION_ID < 70300) {
self::markTestSkipped('not yet supported on php < 7.3');
}

$this->debugMode = true;
$this->numberOfAllowedUnindexedReads = true;
$this->numberOfRowsNotRequiringIndex = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ public static function getAdditionalConfigFiles(): array

public function testSyntaxErrorInQueryRule(): void
{
if (\PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

if (MysqliQueryReflector::NAME === getenv('DBA_REFLECTOR')) {
$expectedErrors = [
[
Expand Down
12 changes: 0 additions & 12 deletions tests/rules/SyntaxErrorInPreparedStatementMethodRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ public static function getAdditionalConfigFiles(): array

public function testSyntaxErrorInQueryRule(): void
{
if (\PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

if (MysqliQueryReflector::NAME === getenv('DBA_REFLECTOR')) {
$expectedErrors = [
[
Expand Down Expand Up @@ -232,10 +228,6 @@ public function testSyntaxErrorInQueryRule(): void

public function testBug94()
{
if (\PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

if (MysqliQueryReflector::NAME === getenv('DBA_REFLECTOR')) {
self::markTestSkipped('Error message different depending on version of the database.');
} elseif (PdoPgSqlQueryReflector::NAME === getenv('DBA_REFLECTOR')) {
Expand Down Expand Up @@ -263,10 +255,6 @@ public function testBug94()

public function testSyntaxErrorWithInferencePlaceholder()
{
if (\PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

if (MysqliQueryReflector::NAME === getenv('DBA_REFLECTOR')) {
$expectedErrors = [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ public static function getAdditionalConfigFiles(): array

public function testSyntaxErrorInQueryRule(): void
{
if (\PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

$this->analyse([__DIR__ . '/data/syntax-error-in-method-subclassed.php'], $this->getExpectedErrors());
}

Expand Down
4 changes: 0 additions & 4 deletions tests/rules/SyntaxErrorInQueryFunctionRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ public static function getAdditionalConfigFiles(): array

public function testSyntaxErrorInQueryRule(): void
{
if (\PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

$this->analyse([__DIR__ . '/data/syntax-error-in-query-function.php'], $this->getExpectedErrors());
}

Expand Down
4 changes: 0 additions & 4 deletions tests/rules/SyntaxErrorInQueryMethodRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ public static function getAdditionalConfigFiles(): array

public function testSyntaxErrorInQueryRule(): void
{
if (\PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

if (MysqliQueryReflector::NAME === getenv('DBA_REFLECTOR')) {
$expected = [
[
Expand Down
4 changes: 0 additions & 4 deletions tests/rules/SyntaxErrorInQueryMethodSubclassedRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ public static function getAdditionalConfigFiles(): array

public function testSyntaxErrorInQueryRule(): void
{
if (\PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

$this->analyse([__DIR__ . '/data/syntax-error-in-method-subclassed.php'], $this->getExpectedErrors());
}

Expand Down
2 changes: 1 addition & 1 deletion tests/sqlAst/SqlAstInferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SqlAstInferenceTest extends TypeInferenceTestCase
{
public function dataFileAsserts(): iterable
{
if (\PHP_VERSION_ID >= 70400 && 'pdo-pgsql' !== getenv('DBA_REFLECTOR')) {
if ('pdo-pgsql' !== getenv('DBA_REFLECTOR')) {
yield from $this->gatherAssertTypes(__DIR__ . '/data/sql-ast-narrowing.php');
}
}
Expand Down
4 changes: 1 addition & 3 deletions tests/sqlAst/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
$config = RuntimeConfiguration::create();
$config->errorMode(RuntimeConfiguration::ERROR_MODE_EXCEPTION);
$config->analyzeWriteQueries(true);
if (\PHP_VERSION_ID >= 70400) {
$config->utilizeSqlAst(true);
}
$config->utilizeSqlAst(true);

// $config->debugMode(true);
$reflector = ReflectorFactory::create(__DIR__);
Expand Down
2 changes: 1 addition & 1 deletion tests/stringify/InferenceStringifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/stringify.php');

if (\PHP_VERSION_ID >= 70400 && 'pdo-pgsql' !== getenv('DBA_REFLECTOR')) {
if ('pdo-pgsql' !== getenv('DBA_REFLECTOR')) {
yield from $this->gatherAssertTypes(__DIR__ . '/data/ast-narrowed-stringify.php');
}
}
Expand Down
4 changes: 1 addition & 3 deletions tests/stringify/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
$config = RuntimeConfiguration::create();
$config->errorMode(RuntimeConfiguration::ERROR_MODE_EXCEPTION);
$config->stringifyTypes(true);
if (\PHP_VERSION_ID >= 70400) {
$config->utilizeSqlAst(true);
}
$config->utilizeSqlAst(true);

$reflector = ReflectorFactory::create(__DIR__);

Expand Down

0 comments on commit df9c68f

Please sign in to comment.