Skip to content

Commit

Permalink
Adds compatibility with PHP 8.0. Drop compatibility with PHP 7.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddebin committed Jan 7, 2022
1 parent cc80176 commit 72ec8fd
Show file tree
Hide file tree
Showing 26 changed files with 148 additions and 170 deletions.
10 changes: 5 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Ignore all test and documentation with “export-ignore”.
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/README.md export-ignore
/.php-cs-fixer.php export-ignore
/.github export-ignore
/README.md export-ignore
/phpunit.xml export-ignore
/phpstan.neon export-ignore
/tests export-ignore
/examples export-ignore
/tests export-ignore
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ on:

jobs:
tests:
runs-on: ubuntu-16.04
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.0', '7.1', '7.2', '7.3', '7.4']
php: ['7.1', '7.2', '7.3', '7.4', '8.0']
name: PHP ${{ matrix.php }} tests
steps:
- uses: actions/checkout@v2
# required for "git tag" presence for MonorepoBuilder split and ChangelogLinker git tags resolver; default is 1
- run: git fetch --depth=100000 origin
# see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v1
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
Expand All @@ -27,14 +27,14 @@ jobs:
- run: composer phpunit

tests_lowest_dependencies:
runs-on: ubuntu-16.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --depth=100000 origin
# see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v1
- uses: shivammathur/setup-php@v2
with:
php-version: 7.0
php-version: 7.1
coverage: none
- run: composer update --no-progress --prefer-lowest
- run: composer phpstan
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/vendor/
.php_cs.cache
/.*.cache
/tests-report-html/
/composer.lock
/composer.lock
/coverage.xml
36 changes: 36 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->exclude('vendor')
->in(__DIR__)
;


$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__);

$config = new PhpCsFixer\Config();
return $config->setRules([
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'php_unit_test_class_requires_covers' => false,
'backtick_to_shell_exec' => true,
'blank_line_before_statement' => [
'statements' => ['declare', 'return', 'case'],
],
'comment_to_phpdoc' => false,
'declare_equal_normalize' => ['space' => 'single'],
'global_namespace_import' => true,
'linebreak_after_opening_tag' => true,
'native_function_invocation' => false,
'no_unset_on_property' => false,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'phpdoc_to_comment' => false,
'self_static_accessor' => true,
])
->setFinder($finder);
34 changes: 0 additions & 34 deletions .php_cs

This file was deleted.

16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@
}
],
"require": {
"php": "^7.0",
"php": "^7.1 || 8.0.*",
"ext-json": "*",
"ext-pdo": "*"
},
"require-dev": {
"phpstan/phpstan": "^0.9 || ^0.10 || ^0.11 || ^0.12",
"phpstan/phpstan-phpunit": "^0.9 || ^0.10 || ^0.11 || ^0.12",
"phpstan/phpstan-strict-rules": "^0.9 || ^0.10 || ^0.11 || ^0.12",
"phpunit/phpunit": "^6.0 || ^7.0"
"friendsofphp/php-cs-fixer": "^3.0",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
},
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
Expand All @@ -44,6 +48,8 @@
},
"scripts": {
"phpstan": "phpstan analyse -l max lib tests",
"php-cs-fixer": "php-cs-fixer fix --allow-risky=yes",
"php-cs-fixer-dry-run": "php-cs-fixer fix --dry-run --allow-risky=yes",
"phpunit": "phpunit"
}
}
6 changes: 2 additions & 4 deletions examples/callback_fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@

/**
* @param mixed $row
*
* @return null|string
*/
function most_common($row)
function most_common($row): ?string
{
$forms = ['pill', 'iud', 'condom', 'sterile_total', 'other_modern', 'traditional'];
$maxForm = -1;
Expand Down Expand Up @@ -53,7 +51,7 @@ function most_common($row)
]);

$vis->handleRequest();
die();
exit();
}
?>
<html lang="en">
Expand Down
2 changes: 1 addition & 1 deletion examples/complete.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
$vis->setDefaultEntity('timeline');

$vis->handleRequest();
die();
exit();
}
?>
<html lang="en">
Expand Down
2 changes: 1 addition & 1 deletion examples/joins.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
]);

$vis->handleRequest();
die();
exit();
}
?>
<html lang="en">
Expand Down
2 changes: 1 addition & 1 deletion examples/simple.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]);

$vis->handleRequest();
die();
exit();
}
?>
<html>
Expand Down
Loading

0 comments on commit 72ec8fd

Please sign in to comment.