add php-cs-fixer as dev dependency

This commit is contained in:
Pig Fang 2021-05-04 18:17:01 +08:00
parent bb0a1dbc40
commit 5550b877df
No known key found for this signature in database
GPG Key ID: A8198F548DADA9E2
5 changed files with 476 additions and 12 deletions

View File

@ -24,13 +24,12 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.0
coverage: none
extensions: mbstring, dom, fileinfo, gd
- name: Install dependencies
run: |
composer install --prefer-dist --no-progress
composer global require friendsofphp/php-cs-fixer
- name: Prepare
run: |
cp .env.example .env
@ -39,7 +38,7 @@ jobs:
- name: Validate Twig templates
run: php artisan twig:lint -v
- name: Check coding style
run: php-cs-fixer fix --dry-run --stop-on-violation --diff-format=udiff
run: ./vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --diff --format=txt
php:
name: PHP ${{ matrix.php }} Tests
runs-on: ubuntu-latest

2
.gitignore vendored
View File

@ -24,7 +24,7 @@ storage/oauth-private.key
storage/install.lock
storage/options.php
.phpunit.result.cache
.php_cs.cache
.php-cs-fixer.cache
resources/views/overrides
public/sw.js
public/meta.js

View File

@ -4,18 +4,15 @@ $finder = PhpCsFixer\Finder::create()
->in('app')
->in('database')
->in('routes')
->in('tests')
;
->in('tests');
return PhpCsFixer\Config::create()
->setRules([
$config = new PhpCsFixer\Config();
return $config->setRules([
'@Symfony' => true,
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
'increment_style' => ['style' => 'post'],
'list_syntax' => ['syntax' => 'short'],
'yoda_style' => false,
])
->setFinder($finder)
;
->setFinder($finder);

View File

@ -39,6 +39,7 @@
"require-dev": {
"barryvdh/laravel-debugbar": "^3.5",
"fakerphp/faker": "^1.13",
"friendsofphp/php-cs-fixer": "^3.0",
"laravel/browser-kit-testing": "^6.1",
"laravel/tinker": "^2.4",
"mockery/mockery": "^1.4",

469
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "8d9cbb0a2d49bd33f8b179f4fbdf8924",
"content-hash": "8ef251a28b6c6c5c2f83aecaa015462a",
"packages": [
{
"name": "blessing/filter",
@ -7929,6 +7929,140 @@
],
"time": "2021-04-07T11:19:20+00:00"
},
{
"name": "composer/xdebug-handler",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/composer/xdebug-handler.git",
"reference": "31d57697eb1971712a08031cfaff5a846d10bdf5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/xdebug-handler/zipball/31d57697eb1971712a08031cfaff5a846d10bdf5",
"reference": "31d57697eb1971712a08031cfaff5a846d10bdf5",
"shasum": ""
},
"require": {
"php": "^5.3.2 || ^7.0 || ^8.0",
"psr/log": "^1.0"
},
"require-dev": {
"phpstan/phpstan": "^0.12.55",
"symfony/phpunit-bridge": "^4.2 || ^5"
},
"type": "library",
"autoload": {
"psr-4": {
"Composer\\XdebugHandler\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "John Stevenson",
"email": "john-stevenson@blueyonder.co.uk"
}
],
"description": "Restarts a process without Xdebug.",
"keywords": [
"Xdebug",
"performance"
],
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/xdebug-handler/issues",
"source": "https://github.com/composer/xdebug-handler/tree/2.0.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2021-04-09T19:40:06+00:00"
},
{
"name": "doctrine/annotations",
"version": "1.12.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "b17c5014ef81d212ac539f07a1001832df1b6d3b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/b17c5014ef81d212ac539f07a1001832df1b6d3b",
"reference": "b17c5014ef81d212ac539f07a1001832df1b6d3b",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
"ext-tokenizer": "*",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/cache": "1.*",
"doctrine/coding-standard": "^6.0 || ^8.1",
"phpstan/phpstan": "^0.12.20",
"phpunit/phpunit": "^7.5 || ^9.1.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Docblock Annotations Parser",
"homepage": "https://www.doctrine-project.org/projects/annotations.html",
"keywords": [
"annotations",
"docblock",
"parser"
],
"support": {
"issues": "https://github.com/doctrine/annotations/issues",
"source": "https://github.com/doctrine/annotations/tree/1.12.1"
},
"time": "2021-02-21T21:00:45+00:00"
},
{
"name": "doctrine/instantiator",
"version": "1.4.0",
@ -8063,6 +8197,94 @@
},
"time": "2021-03-30T06:27:33+00:00"
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
"reference": "c15377bdfa8d1ecf186f1deadec39c89984e1167"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c15377bdfa8d1ecf186f1deadec39c89984e1167",
"reference": "c15377bdfa8d1ecf186f1deadec39c89984e1167",
"shasum": ""
},
"require": {
"composer/semver": "^3.2",
"composer/xdebug-handler": "^2.0",
"doctrine/annotations": "^1.12",
"ext-json": "*",
"ext-tokenizer": "*",
"php": "^7.1.3 || ^8.0",
"php-cs-fixer/diff": "^2.0",
"symfony/console": "^4.4.20 || ^5.1.3",
"symfony/event-dispatcher": "^4.4.20 || ^5.0",
"symfony/filesystem": "^4.4.20 || ^5.0",
"symfony/finder": "^4.4.20 || ^5.0",
"symfony/options-resolver": "^4.4.20 || ^5.0",
"symfony/polyfill-php72": "^1.22",
"symfony/process": "^4.4.20 || ^5.0",
"symfony/stopwatch": "^4.4.20 || ^5.0"
},
"require-dev": {
"justinrainbow/json-schema": "^5.2",
"keradus/cli-executor": "^1.4",
"mikey179/vfsstream": "^1.6.8",
"php-coveralls/php-coveralls": "^2.4.3",
"php-cs-fixer/accessible-object": "^1.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1",
"phpspec/prophecy": "^1.10.3",
"phpspec/prophecy-phpunit": "^1.1 || ^2.0",
"phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5",
"phpunitgoodpractices/polyfill": "^1.5",
"phpunitgoodpractices/traits": "^1.9.1",
"symfony/phpunit-bridge": "^5.2.4",
"symfony/yaml": "^4.4.20 || ^5.0"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
"ext-mbstring": "For handling non-UTF8 characters.",
"symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible."
},
"bin": [
"php-cs-fixer"
],
"type": "application",
"autoload": {
"psr-4": {
"PhpCsFixer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Dariusz Rumiński",
"email": "dariusz.ruminski@gmail.com"
}
],
"description": "A tool to automatically fix PHP code style",
"support": {
"issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues",
"source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.0.0"
},
"funding": [
{
"url": "https://github.com/keradus",
"type": "github"
}
],
"time": "2021-05-03T21:51:58+00:00"
},
{
"name": "hamcrest/hamcrest-php",
"version": "v2.0.1",
@ -8610,6 +8832,58 @@
},
"time": "2021-02-23T14:00:09+00:00"
},
{
"name": "php-cs-fixer/diff",
"version": "v2.0.2",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/diff.git",
"reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/29dc0d507e838c4580d018bd8b5cb412474f7ec3",
"reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0",
"symfony/process": "^3.3"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
}
],
"description": "sebastian/diff v3 backport support for PHP 5.6+",
"homepage": "https://github.com/PHP-CS-Fixer",
"keywords": [
"diff"
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/diff/issues",
"source": "https://github.com/PHP-CS-Fixer/diff/tree/v2.0.2"
},
"time": "2020-10-14T08:32:19+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",
@ -10438,6 +10712,199 @@
],
"time": "2021-02-15T18:55:04+00:00"
},
{
"name": "symfony/filesystem",
"version": "v5.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "056e92acc21d977c37e6ea8e97374b2a6c8551b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/056e92acc21d977c37e6ea8e97374b2a6c8551b0",
"reference": "056e92acc21d977c37e6ea8e97374b2a6c8551b0",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-ctype": "~1.8"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v5.2.7"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-04-01T10:42:13+00:00"
},
{
"name": "symfony/options-resolver",
"version": "v5.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce",
"reference": "5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/polyfill-php73": "~1.0",
"symfony/polyfill-php80": "^1.15"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\OptionsResolver\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides an improved replacement for the array_replace PHP function",
"homepage": "https://symfony.com",
"keywords": [
"config",
"configuration",
"options"
],
"support": {
"source": "https://github.com/symfony/options-resolver/tree/v5.2.4"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-01-27T12:56:27+00:00"
},
{
"name": "symfony/stopwatch",
"version": "v5.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
"reference": "d99310c33e833def36419c284f60e8027d359678"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/d99310c33e833def36419c284f60e8027d359678",
"reference": "d99310c33e833def36419c284f60e8027d359678",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/service-contracts": "^1.0|^2"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Stopwatch\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides a way to profile code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/stopwatch/tree/v5.3.0-BETA1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-03-29T15:28:41+00:00"
},
{
"name": "theseer/tokenizer",
"version": "1.2.0",