Skip to content

Commit a3fedec

Browse files
authored
Adding PHP 8 to test matrix, upgrading dev deps, fixing errors (#123)
* Adding PHP 8 to test matrix, upgrading dev deps, fixing errors * disabling fast fail, adding merge-me job * testing different parameter names in phpstan ignores * more phpstan fixes * more phpstan fixes, not there yet * fixing what I can for php 8, rest seem harder to deal with * upgrading phpstan, fixing php8 deprecation * fixing case of DbTestCase file * fixing php8 phpstan errors in Cache/Db * fixing php8 phpstan errors in Connection.php * fixing psalm, more php 8 fixes for Connection.php * fixing php8 phpstan errors in Connection/Statement * fixing more php 8 phpstan errors * a few more php8 phpstan fixes * maybe the last phpstan errors fixed? * nope, one more fix * phpstan done, now php-cs-fixer * fixing two errors found in tests on php 8 * removing lowest version of php-code-coverage, bumping to php-setup v2 * removing other versions of php-code-coverage * dropping 7.1 from tests, removing php-code-coverage 6.0 that was needed for 7.1 * trying dropping php 7.2 and code-coverage 7.0 * upgrading to php-code-coverage 9.x * using driver selector for code coverage * minimum of php-code-coverage 9.1.10 is required for Selector * removing psr0 php-cs-fixer rule, updating php-cs-fixer * removing deprecated call to Config::create * adding back psr0 fixer, upgrading phpstan/php-cs-fixer the php-cs-fixer team released a fix for the renaming issue I saw with 2.17.2. It still renames tests though, but they're not defined in our autoloader, and the classnames don't match the filename like they should, so excluding those from php-cs-fixer for now. * allowing symfony yaml 5 * updating psalm/phpstan/php-cs-fixer and ignoring a couple of errors that came up * updating psalm baseline, new errors did not seem applicable, or easy to fix
1 parent bdc2053 commit a3fedec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+784
-1117
lines changed

.dependabot/config.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: '/'
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: github-actions
8+
directory: '/'
9+
schedule:
10+
interval: daily

.github/workflows/build.yml

Lines changed: 54 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,57 @@
11
name: Build
22
on:
3-
push:
4-
branches:
5-
- master
6-
pull_request:
7-
branches:
8-
- master
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
99
jobs:
10-
build:
11-
name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-args }}
12-
strategy:
13-
matrix:
14-
operating-system: [ubuntu-latest]
15-
php-versions: ['7.1', '7.2', '7.3', '7.4']
16-
composer-args: ['', '--prefer-lowest']
17-
runs-on: ${{ matrix.operating-system }}
18-
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v1
21-
- name: Setup PHP
22-
uses: shivammathur/setup-php@v1
23-
with:
24-
php-version: ${{ matrix.php-versions }}
25-
extensions: mbstring, apcu
26-
ini-values: apc.enable_cli=1
27-
coverage: xdebug
28-
- name: Install Dependencies
29-
run: |
30-
composer update --no-progress --no-suggest --prefer-stable --optimize-autoloader ${{ matrix.composer-args }}
31-
- name: Static Analysis
32-
run: composer static-analysis
33-
- name: Code Style Check
34-
run: composer style-check
35-
- name: Test
36-
run: composer test-with-coverage
37-
- name: Upload Coverage
38-
run: bash <(curl -s https://codecov.io/bash) -f tests/coverage/clover.xml
10+
build:
11+
name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-args }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
operating-system: [ubuntu-latest]
16+
php-versions: ['7.3', '7.4', '8.0']
17+
composer-args: ['', '--prefer-lowest']
18+
runs-on: ${{ matrix.operating-system }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v1
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ matrix.php-versions }}
26+
extensions: mbstring, apcu
27+
ini-values: apc.enable_cli=1
28+
coverage: xdebug
29+
- name: Install Dependencies
30+
run: |
31+
composer update --no-progress --no-suggest --prefer-stable --optimize-autoloader ${{ matrix.composer-args }}
32+
- name: Static Analysis
33+
run: |
34+
composer phpstan
35+
composer psalm
36+
- name: Code Style Check
37+
run: composer style-check
38+
# php-cs-fixer doesn't fully support PHP 8 yet
39+
env:
40+
PHP_CS_FIXER_IGNORE_ENV: true
41+
- name: Test
42+
run: composer test-with-coverage
43+
- name: Upload Coverage
44+
run: bash <(curl -s https://codecov.io/bash) -f tests/coverage/clover.xml
45+
merge-me:
46+
name: Merge me!
47+
needs:
48+
- build
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Merge me!
52+
uses: ridedott/merge-me-action@master
53+
with:
54+
# This must be used as GitHub Actions token does not support
55+
# pushing to protected branches.
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
GITHUB_LOGIN: 'dependabot[bot]'

.github/workflows/dependabot.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.php_cs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,29 @@
22

33
$finder = PhpCsFixer\Finder::create()
44
->exclude('vendor')
5+
->exclude('tests')
56
->exclude('tests/tmp/generated')
67
->files()
78
->in(__DIR__)
89
;
910

10-
return PhpCsFixer\Config::create()
11+
$config = new PhpCsFixer\Config();
12+
return $config
1113
->setRiskyAllowed(true)
12-
->setRules([
13-
'@PSR2' => true,
14-
'@PHP70Migration:risky' => true,
15-
'binary_operator_spaces' => [
16-
'default' => 'align_single_space_minimal',
17-
'operators' => ['||' => null, '&&' => null]
18-
],
19-
'declare_strict_types' => false,
20-
'single_quote' => true,
21-
'array_syntax' => ['syntax' => 'long'],
22-
'concat_space' => ['spacing' => 'one'],
23-
'psr0' => true,
14+
->setRules(array(
15+
'@PSR2' => true,
16+
'@PHP70Migration:risky' => true,
17+
'binary_operator_spaces' => array(
18+
'default' => 'align_single_space_minimal',
19+
'operators' => array('||' => null, '&&' => null)
20+
),
21+
'declare_strict_types' => false,
22+
'single_quote' => true,
23+
'array_syntax' => array('syntax' => 'long'),
24+
'concat_space' => array('spacing' => 'one'),
2425
'no_whitespace_in_blank_line' => true,
25-
])
26+
'psr0' => true,
27+
))
2628
->setUsingCache(true)
2729
->setFinder($finder);
2830
;

composer.json

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,21 @@
22
"name": "diablomedia/doctrine1",
33
"type": "library",
44
"description": "PHP5+ Database ORM",
5-
"keywords": ["orm", "database"],
5+
"keywords": [
6+
"orm",
7+
"database"
8+
],
69
"homepage": "http://www.doctrine-project.org",
710
"license": "LGPL-2.1-or-later",
811
"authors": [
9-
{"name": "Konsta Vesterinen", "email": "[email protected]"},
10-
{"name": "Jonathan Wage", "email": "[email protected]"}
12+
{
13+
"name": "Konsta Vesterinen",
14+
"email": "[email protected]"
15+
},
16+
{
17+
"name": "Jonathan Wage",
18+
"email": "[email protected]"
19+
}
1120
],
1221
"autoload": {
1322
"psr-0": {
@@ -30,13 +39,13 @@
3039
"require": {
3140
"php": ">=7.0",
3241
"ext-pdo": "*",
33-
"symfony/yaml": "^3.4 || ^4.1"
42+
"symfony/yaml": "^3.4 || ^4.1 || ^5.0"
3443
},
3544
"require-dev": {
36-
"phpunit/php-code-coverage": "^4.0 || ^5.0 || ^6.0 || ^7.0",
37-
"friendsofphp/php-cs-fixer": "2.16.4",
38-
"phpstan/phpstan": "0.12.19",
39-
"vimeo/psalm": "3.11.4"
45+
"phpunit/php-code-coverage": "^9.1.10",
46+
"friendsofphp/php-cs-fixer": "2.18.4",
47+
"phpstan/phpstan": "0.12.82",
48+
"vimeo/psalm": "4.6.4"
4049
},
4150
"scripts": {
4251
"test": "cd tests && php run.php",

lib/Doctrine/Adapter/Interface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface Doctrine_Adapter_Interface
3434
{
3535
/**
3636
* @param string $prepareString
37-
* @return Doctrine_Adapter_Statement_Interface
37+
* @return Doctrine_Adapter_Statement_Interface|false
3838
*/
3939
public function prepare($prepareString);
4040

lib/Doctrine/Adapter/Statement/Mock.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,14 @@ public function fetch(
218218
*
219219
* Returns an array containing all of the result set rows
220220
*
221-
* @param integer $fetchMode Controls how the next row will be returned to the caller.
221+
* @param integer $fetchStyle Controls how the next row will be returned to the caller.
222222
* This value must be one of the Doctrine_Core::FETCH_* constants,
223223
* defaulting to Doctrine_Core::FETCH_BOTH
224224
* @param int $colnum
225225
*
226226
* @return array
227227
*/
228-
public function fetchAll($fetchMode = Doctrine_Core::FETCH_BOTH, $colnum = 0)
228+
public function fetchAll($fetchStyle = Doctrine_Core::FETCH_BOTH, $colnum = 0)
229229
{
230230
return array();
231231
}

lib/Doctrine/Cache/Db.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ protected function _doFetch($id, $testCacheValidity = true)
8282

8383
$result = $this->getConnection()->execute($sql, array($id))->fetchAll(Doctrine_Core::FETCH_NUM);
8484

85-
if (! isset($result[0])) {
85+
// In PHP <= 7.4, PDOStatement::fetchAll may return `false`
86+
if (!$result || ! isset($result[0])) {
8687
return false;
8788
}
8889

@@ -222,8 +223,11 @@ protected function _getCacheKeys()
222223
$sql = 'SELECT id FROM ' . $this->_options['tableName'];
223224
$keys = array();
224225
$results = $this->getConnection()->execute($sql)->fetchAll(Doctrine_Core::FETCH_NUM);
225-
for ($i = 0, $count = count($results); $i < $count; $i++) {
226-
$keys[] = $results[$i][0];
226+
// In PHP <= 7.4, PDOStatement::fetchAll may return `false`
227+
if ($results) {
228+
for ($i = 0, $count = count($results); $i < $count; $i++) {
229+
$keys[] = $results[$i][0];
230+
}
227231
}
228232
return $keys;
229233
}

lib/Doctrine/Cli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ protected function _run(array $args)
506506
return;
507507
}
508508

509-
if ($requestedTaskName && isset($args[2]) && $args[2] === 'help') {
509+
if (isset($args[2]) && $args[2] === 'help') {
510510
$this->printTasks($requestedTaskName, true);
511511
return;
512512
}

0 commit comments

Comments
 (0)