Skip to content

Commit 69396bf

Browse files
authored
Test PHP 7.2 in github action (#523)
1 parent a7bc22b commit 69396bf

File tree

6 files changed

+50
-13
lines changed

6 files changed

+50
-13
lines changed

.github/workflows/phpstan.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,13 @@ jobs:
7676
with:
7777
composer-options: "--prefer-dist --no-progress"
7878

79-
- name: Install sqlftw/sqlftw
79+
- name: Install sqlftw/sqlftw (optional dependency)
8080
run: composer require sqlftw/sqlftw --ignore-platform-req=php+
81-
if: "${{matrix.php-version != '7.3'}}"
81+
if: "${{matrix.php-version != '7.2' && matrix.php-version != '7.3'}}"
82+
83+
- name: Install doctrine/dbal (optional dependency)
84+
run: composer require doctrine/dbal --ignore-platform-req=php+
85+
if: "${{matrix.php-version != '7.2'}}"
8286

8387
- name: Enable phpstan@dev
8488
if: "${{matrix.phpstan-version != ''}}"
@@ -127,8 +131,12 @@ jobs:
127131
with:
128132
composer-options: "--prefer-dist --no-progress"
129133

130-
- name: Install sqlftw/sqlftw
134+
- name: Install sqlftw/sqlftw (optional dependency)
131135
run: composer require sqlftw/sqlftw --ignore-platform-req=php+
132-
if: "${{matrix.php-version != '7.3'}}"
136+
if: "${{matrix.php-version != '7.2' && matrix.php-version != '7.3'}}"
137+
138+
- name: Install doctrine/dbal (optional dependency)
139+
run: composer require doctrine/dbal --ignore-platform-req=php+
140+
if: "${{matrix.php-version != '7.2'}}"
133141

134142
- run: composer phpstan

.github/workflows/tests-postgres.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@ jobs:
5353
with:
5454
composer-options: "--prefer-dist --no-progress"
5555

56-
- name: Install sqlftw/sqlftw
56+
- name: Install sqlftw/sqlftw (optional dependency)
5757
run: composer require sqlftw/sqlftw --ignore-platform-req=php+
58-
if: "${{matrix.php-version != '7.3'}}"
58+
if: "${{matrix.php-version != '7.2' && matrix.php-version != '7.3'}}"
59+
60+
- name: Install doctrine/dbal (optional dependency)
61+
run: composer require doctrine/dbal --ignore-platform-req=php+
62+
if: "${{matrix.php-version != '7.2'}}"
5963

6064
- name: Setup Problem Matchers for PHPUnit
6165
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

.github/workflows/tests.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
include:
19+
- php-version: "7.2"
20+
db-image: 'mysql:5.7'
21+
reflector: "pdo-mysql"
22+
mode: "recording"
1923
- php-version: "7.3"
2024
db-image: 'mysql:5.7'
2125
reflector: "pdo-mysql"
@@ -96,9 +100,13 @@ jobs:
96100
# ignore php8.2 requirement error https://github.com/sebastianbergmann/phpunit/issues/5033
97101
composer-options: "--prefer-dist --no-progress --ignore-platform-req=php+"
98102

99-
- name: Install sqlftw/sqlftw
103+
- name: Install sqlftw/sqlftw (optional dependency)
100104
run: composer require sqlftw/sqlftw --ignore-platform-req=php+
101-
if: "${{matrix.php-version != '7.3'}}"
105+
if: "${{matrix.php-version != '7.2' && matrix.php-version != '7.3'}}"
106+
107+
- name: Install doctrine/dbal (optional dependency)
108+
run: composer require doctrine/dbal --ignore-platform-req=php+
109+
if: "${{matrix.php-version != '7.2'}}"
102110

103111
- name: Setup Problem Matchers for PHPUnit
104112
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
@@ -148,9 +156,13 @@ jobs:
148156
# ignore php8.2 requirement error https://github.com/sebastianbergmann/phpunit/issues/5033
149157
composer-options: "--prefer-dist --no-progress --ignore-platform-req=php+"
150158

151-
- name: Install sqlftw/sqlftw
159+
- name: Install sqlftw/sqlftw (optional dependency)
152160
run: composer require sqlftw/sqlftw --ignore-platform-req=php+
153-
if: "${{matrix.php-version != '7.3'}}"
161+
if: "${{matrix.php-version != '7.2' && matrix.php-version != '7.3'}}"
162+
163+
- name: Install doctrine/dbal (optional dependency)
164+
run: composer require doctrine/dbal --ignore-platform-req=php+
165+
if: "${{matrix.php-version != '7.2'}}"
154166

155167
- name: Setup Problem Matchers for PHPUnit
156168
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"ext-mysqli": "*",
1414
"ext-pdo": "*",
1515
"dibi/dibi": "^4.2",
16-
"doctrine/dbal": "^2.13|^3.0",
1716
"php-parallel-lint/php-parallel-lint": "^1.3",
1817
"phpstan/extension-installer": "^1.2",
1918
"phpstan/phpstan-php-parser": "^1.1",

tests/default/DbaInferenceTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ class DbaInferenceTest extends TypeInferenceTestCase
1313
{
1414
public function dataFileAsserts(): iterable
1515
{
16-
yield from $this->gatherAssertTypes(__DIR__ . '/data/doctrine-dbal.php');
16+
if (\PHP_VERSION_ID >= 70300) {
17+
if (! InstalledVersions::isInstalled('doctrine/dbal')) {
18+
throw new \Exception('doctrine/dbal 3.x is required to run tests for php 7.3+. Please install it via composer.');
19+
}
20+
21+
yield from $this->gatherAssertTypes(__DIR__ . '/data/doctrine-dbal.php');
22+
yield from $this->gatherAssertTypes(__DIR__ . '/data/inference-placeholder.php');
23+
}
1724

1825
// make sure class constants can be resolved
1926
require_once __DIR__ . '/data/pdo.php';
@@ -67,7 +74,6 @@ public function dataFileAsserts(): iterable
6774
yield from $this->gatherAssertTypes(__DIR__ . '/data/mysqli-union-result.php');
6875
yield from $this->gatherAssertTypes(__DIR__ . '/data/pdo-default-fetch-types.php');
6976
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug372.php');
70-
yield from $this->gatherAssertTypes(__DIR__ . '/data/inference-placeholder.php');
7177

7278
if (\PHP_VERSION_ID >= 70400 && 'pdo-pgsql' !== getenv('DBA_REFLECTOR')) {
7379
yield from $this->gatherAssertTypes(__DIR__ . '/data/sql-ast-narrowing.php');

tests/rules/QueryPlanAnalyzerRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public function testNotUsingIndex(): void
6060
self::markTestSkipped('query plan analyzer requires a active database connection');
6161
}
6262

63+
if (\PHP_VERSION_ID < 70300) {
64+
self::markTestSkipped('not yet supported on php < 7.3');
65+
}
66+
6367
$this->numberOfAllowedUnindexedReads = true;
6468
$this->numberOfRowsNotRequiringIndex = 2;
6569

@@ -105,6 +109,10 @@ public function testNotUsingIndexInDebugMode(): void
105109
self::markTestSkipped('query plan analyzer requires a active database connection');
106110
}
107111

112+
if (\PHP_VERSION_ID < 70300) {
113+
self::markTestSkipped('not yet supported on php < 7.3');
114+
}
115+
108116
$this->debugMode = true;
109117
$this->numberOfAllowedUnindexedReads = true;
110118
$this->numberOfRowsNotRequiringIndex = 2;

0 commit comments

Comments
 (0)