Skip to content

Commit bb09bdd

Browse files
authored
Merge pull request #3 from ddebin/dev
Adds compatibility with PHP 8.0. Drop compatibility with PHP 7.0.
2 parents cc80176 + 72ec8fd commit bb09bdd

26 files changed

+148
-170
lines changed

.gitattributes

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Ignore all test and documentation with “export-ignore”.
22
/.gitattributes export-ignore
33
/.gitignore export-ignore
4-
/.php_cs export-ignore
5-
/phpstan.neon export-ignore
6-
/phpunit.xml export-ignore
7-
/README.md export-ignore
4+
/.php-cs-fixer.php export-ignore
85
/.github export-ignore
6+
/README.md export-ignore
7+
/phpunit.xml export-ignore
8+
/phpstan.neon export-ignore
9+
/tests export-ignore
910
/examples export-ignore
10-
/tests export-ignore

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ on:
88

99
jobs:
1010
tests:
11-
runs-on: ubuntu-16.04
11+
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
php: ['7.0', '7.1', '7.2', '7.3', '7.4']
14+
php: ['7.1', '7.2', '7.3', '7.4', '8.0']
1515
name: PHP ${{ matrix.php }} tests
1616
steps:
1717
- uses: actions/checkout@v2
1818
# required for "git tag" presence for MonorepoBuilder split and ChangelogLinker git tags resolver; default is 1
1919
- run: git fetch --depth=100000 origin
2020
# see https://github.com/shivammathur/setup-php
21-
- uses: shivammathur/setup-php@v1
21+
- uses: shivammathur/setup-php@v2
2222
with:
2323
php-version: ${{ matrix.php }}
2424
coverage: none
@@ -27,14 +27,14 @@ jobs:
2727
- run: composer phpunit
2828

2929
tests_lowest_dependencies:
30-
runs-on: ubuntu-16.04
30+
runs-on: ubuntu-latest
3131
steps:
3232
- uses: actions/checkout@v2
3333
- run: git fetch --depth=100000 origin
3434
# see https://github.com/shivammathur/setup-php
35-
- uses: shivammathur/setup-php@v1
35+
- uses: shivammathur/setup-php@v2
3636
with:
37-
php-version: 7.0
37+
php-version: 7.1
3838
coverage: none
3939
- run: composer update --no-progress --prefer-lowest
4040
- run: composer phpstan

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/vendor/
2-
.php_cs.cache
2+
/.*.cache
33
/tests-report-html/
4-
/composer.lock
4+
/composer.lock
5+
/coverage.xml

.php-cs-fixer.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$finder = Finder::create()
7+
->exclude('vendor')
8+
->in(__DIR__)
9+
;
10+
11+
12+
$finder = PhpCsFixer\Finder::create()
13+
->exclude('vendor')
14+
->in(__DIR__);
15+
16+
$config = new PhpCsFixer\Config();
17+
return $config->setRules([
18+
'@PhpCsFixer' => true,
19+
'@PhpCsFixer:risky' => true,
20+
'array_syntax' => ['syntax' => 'short'],
21+
'php_unit_test_class_requires_covers' => false,
22+
'backtick_to_shell_exec' => true,
23+
'blank_line_before_statement' => [
24+
'statements' => ['declare', 'return', 'case'],
25+
],
26+
'comment_to_phpdoc' => false,
27+
'declare_equal_normalize' => ['space' => 'single'],
28+
'global_namespace_import' => true,
29+
'linebreak_after_opening_tag' => true,
30+
'native_function_invocation' => false,
31+
'no_unset_on_property' => false,
32+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
33+
'phpdoc_to_comment' => false,
34+
'self_static_accessor' => true,
35+
])
36+
->setFinder($finder);

.php_cs

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

composer.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@
2222
}
2323
],
2424
"require": {
25-
"php": "^7.0",
25+
"php": "^7.1 || 8.0.*",
2626
"ext-json": "*",
2727
"ext-pdo": "*"
2828
},
2929
"require-dev": {
30-
"phpstan/phpstan": "^0.9 || ^0.10 || ^0.11 || ^0.12",
31-
"phpstan/phpstan-phpunit": "^0.9 || ^0.10 || ^0.11 || ^0.12",
32-
"phpstan/phpstan-strict-rules": "^0.9 || ^0.10 || ^0.11 || ^0.12",
33-
"phpunit/phpunit": "^6.0 || ^7.0"
30+
"friendsofphp/php-cs-fixer": "^3.0",
31+
"phpstan/phpstan": "^1.0",
32+
"phpstan/phpstan-phpunit": "^1.0",
33+
"phpstan/phpstan-strict-rules": "^1.0",
34+
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
35+
},
36+
"config": {
37+
"sort-packages": true
3438
},
3539
"autoload": {
3640
"psr-4": {
@@ -44,6 +48,8 @@
4448
},
4549
"scripts": {
4650
"phpstan": "phpstan analyse -l max lib tests",
51+
"php-cs-fixer": "php-cs-fixer fix --allow-risky=yes",
52+
"php-cs-fixer-dry-run": "php-cs-fixer fix --dry-run --allow-risky=yes",
4753
"phpunit": "phpunit"
4854
}
4955
}

examples/callback_fields.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010

1111
/**
1212
* @param mixed $row
13-
*
14-
* @return null|string
1513
*/
16-
function most_common($row)
14+
function most_common($row): ?string
1715
{
1816
$forms = ['pill', 'iud', 'condom', 'sterile_total', 'other_modern', 'traditional'];
1917
$maxForm = -1;
@@ -53,7 +51,7 @@ function most_common($row)
5351
]);
5452

5553
$vis->handleRequest();
56-
die();
54+
exit();
5755
}
5856
?>
5957
<html lang="en">

examples/complete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
$vis->setDefaultEntity('timeline');
3535

3636
$vis->handleRequest();
37-
die();
37+
exit();
3838
}
3939
?>
4040
<html lang="en">

examples/joins.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
]);
3232

3333
$vis->handleRequest();
34-
die();
34+
exit();
3535
}
3636
?>
3737
<html lang="en">

examples/simple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
]);
2222

2323
$vis->handleRequest();
24-
die();
24+
exit();
2525
}
2626
?>
2727
<html>

0 commit comments

Comments
 (0)