Add PHP 8.1 to shims and build (#1365)

* Add PHP 8.1 to shims and build

* Lock psr/container version

* Lock psr version

* Restrict symfony component versions

* Downgrade event-dispatcher-contracts

* Update more package versions

* php-cs fixes

* style fix

* cs-fixer file fix

* Exclude resources dir from cs fixer

* Ignore cs fixer env check

* Update league/csv
This commit is contained in:
Nabeel S 2021-12-03 09:23:59 -05:00 committed by GitHub
parent c45d52dffa
commit a3f110c0c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 668 additions and 688 deletions

View File

@ -23,6 +23,7 @@ declare -a remove_files=(
.eslintrc .eslintrc
.php_cs .php_cs
.php_cs.cache .php_cs.cache
.php-cs-fixer.php
.phpstorm.meta.php .phpstorm.meta.php
.styleci.yml .styleci.yml
.phpunit.result.cache .phpunit.result.cache

View File

@ -2,12 +2,12 @@ name: 'Build'
on: ['push', 'pull_request', 'workflow_dispatch', 'release'] on: ['push', 'pull_request', 'workflow_dispatch', 'release']
jobs: jobs:
build: build:
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
if: github.repository == 'nabeelio/phpvms' if: github.repository == 'nabeelio/phpvms'
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
php-versions: ['7.3', '7.4', '8.0'] php-versions: ['7.3', '7.4', '8.0', '8.1']
name: PHP ${{ matrix.php-versions }} name: PHP ${{ matrix.php-versions }}
env: env:
extensions: intl, pcov, mbstring extensions: intl, pcov, mbstring
@ -78,7 +78,8 @@ jobs:
- name: Run Tests - name: Run Tests
run: | run: |
vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --diff --using-cache=no export PHP_CS_FIXER_IGNORE_ENV=1
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --dry-run --diff --using-cache=no
vendor/bin/phpunit --debug --verbose vendor/bin/phpunit --debug --verbose
# This runs after all of the tests, run have run. Creates a cleaned up version of the # This runs after all of the tests, run have run. Creates a cleaned up version of the

69
.php-cs-fixer.php Normal file
View File

@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
$header = <<<'EOF'
This file is part of PHP CS Fixer.
(c) Fabien Potencier <fabien@symfony.com>
Dariusz Rumiński <dariusz.ruminski@gmail.com>
This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;
$finder = PhpCsFixer\Finder::create()
->ignoreVCSIgnored(true)
->exclude('tests/data')
->exclude('storage')
->exclude('resources')
->in(__DIR__)
->append([
__DIR__.'/dev-tools/doc.php',
// __DIR__.'/php-cs-fixer', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message
__FILE__,
])
;
$config = new PhpCsFixer\Config();
$config
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'strict_param' => true,
'no_php4_constructor' => true,
'no_extra_blank_lines' => true,
'no_superfluous_elseif' => true,
'single_line_comment_style' => false,
'simple_to_complex_string_variable' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'operators' => [
'=>' => 'align_single_space_minimal'
]
],
/*
'blank_line_before_statement' => [
'statements' => [
'declare',
'for',
'return',
'throw',
'try',
],
],
*/
])
->setFinder($finder);
return $config;

37
.php_cs
View File

@ -1,37 +0,0 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in('app')
->in('config');
return PhpCsFixer\Config::create()
->setHideProgress(true)
->setUsingCache(false)
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'strict_param' => true,
'no_php4_constructor' => true,
'no_extra_blank_lines' => true,
'no_superfluous_elseif' => true,
'single_line_comment_style' => false,
'simple_to_complex_string_variable' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'align_double_arrow' => true,
],
/*
'blank_line_before_statement' => [
'statements' => [
'declare',
'for',
'return',
'throw',
'try',
],
],
*/
])
->setFinder($finder);

View File

@ -39,7 +39,7 @@ class application extends Illuminate\Foundation\Application
$bootstrappers = array_replace( $bootstrappers = array_replace(
$bootstrappers, $bootstrappers,
array_fill_keys( array_fill_keys(
array_keys($bootstrappers, $find), array_keys($bootstrappers, $find, true),
$replace $replace
) )
); );

View File

@ -20,7 +20,12 @@
"symfony/polyfill-mbstring": "*", "symfony/polyfill-mbstring": "*",
"symfony/polyfill-php74": "*", "symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*", "symfony/polyfill-php80": "*",
"composer/composer": "~1.0", "symfony/polyfill-php81": "*",
"symfony/event-dispatcher-contracts": "^2",
"symfony/property-info": "^5.4",
"symfony/string": "^5.4",
"psr/container": "1.1.1",
"composer/composer": "~2.0",
"composer/installers": "~1.0", "composer/installers": "~1.0",
"laravel/framework": "~8.0", "laravel/framework": "~8.0",
"anhskohbo/no-captcha": "^3.0", "anhskohbo/no-captcha": "^3.0",
@ -42,7 +47,7 @@
"laravelcollective/html": "~6.2.0", "laravelcollective/html": "~6.2.0",
"jeremykendall/php-domain-parser": "~5.7.2", "jeremykendall/php-domain-parser": "~5.7.2",
"league/commonmark": "~1.6", "league/commonmark": "~1.6",
"league/csv": "9.2.*", "league/csv": "9.7.*",
"league/geotools": "0.8.*", "league/geotools": "0.8.*",
"league/iso3166": "^3.0.0", "league/iso3166": "^3.0.0",
"markrogoyski/math-php": "^1.10", "markrogoyski/math-php": "^1.10",
@ -75,10 +80,10 @@
}, },
"require-dev": { "require-dev": {
"barryvdh/laravel-debugbar": "^3.5", "barryvdh/laravel-debugbar": "^3.5",
"barryvdh/laravel-ide-helper": "^2.9", "barryvdh/laravel-ide-helper": "^2.10",
"bpocallaghan/generators": "~7.0", "bpocallaghan/generators": "~7.0",
"filp/whoops": "~2.0", "filp/whoops": "~2.0",
"friendsofphp/php-cs-fixer": "^2.16", "friendsofphp/php-cs-fixer": "^3.3",
"mockery/mockery": "^1.4.0", "mockery/mockery": "^1.4.0",
"nunomaduro/collision": "^5.3.0", "nunomaduro/collision": "^5.3.0",
"phpunit/phpunit": "~9.0", "phpunit/phpunit": "~9.0",
@ -106,7 +111,10 @@
"installer-paths": { "installer-paths": {
"modules/{$name}/": ["type:phpvms-module"] "modules/{$name}/": ["type:phpvms-module"]
}, },
"module-dir": "modules" "module-dir": "modules",
"symfony": {
"require": "^5.4"
}
}, },
"scripts": { "scripts": {
"pre-package-uninstall": [ "pre-package-uninstall": [

1220
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,7 @@ class VersionTest extends TestCase
$this->assertTrue( $this->assertTrue(
$versionSvc->isGreaterThan($newVersion, $currentVersion), $versionSvc->isGreaterThan($newVersion, $currentVersion),
"{$newVersion} not greater than ${currentVersion}" "$newVersion not greater than $currentVersion"
); );
} }
} }