diff --git a/.php_cs b/.php_cs new file mode 100644 index 000000000000..9dfc128f7605 --- /dev/null +++ b/.php_cs @@ -0,0 +1,18 @@ +notPath('vendor') + ->notPath('bootstrap') + ->notPath('storage') + ->in(__DIR__) + ->name('*.php') + ->notName('*.blade.php'); + +return PhpCsFixer\Config::create() + ->setRules([ + '@PSR2' => true, + 'array_syntax' => ['syntax' => 'short'], + 'ordered_imports' => ['sortAlgorithm' => 'alpha'], + 'no_unused_imports' => true, + ]) + ->setFinder($finder); \ No newline at end of file diff --git a/composer.json b/composer.json index 21f49728cad5..16a018ea4d0a 100644 --- a/composer.json +++ b/composer.json @@ -70,6 +70,7 @@ "darkaonline/l5-swagger": "^8.0", "facade/ignition": "^2.3.6", "filp/whoops": "^2.7", + "friendsofphp/php-cs-fixer": "^2.16", "fzaninotto/faker": "^1.9.1", "mockery/mockery": "^1.3.1", "nunomaduro/collision": "^5.0", @@ -109,6 +110,9 @@ "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" + ], + "format": [ + "vendor/bin/php-cs-fixer fix" ] }, "config": { diff --git a/composer.lock b/composer.lock index 4cf2157996e1..6662b547a688 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "a178576541f03dbaf5e757fb4c89b474", + "content-hash": "d52dc9a6166a9ecfb0e5e92041c112e2", "packages": [ { "name": "asgrim/ofxparser", @@ -2293,54 +2293,6 @@ }, "time": "2020-09-30T07:37:11+00:00" }, - { - "name": "halaxa/json-machine", - "version": "0.4.0", - "source": { - "type": "git", - "url": "https://github.com/halaxa/json-machine.git", - "reference": "b99d7a9a1efc8ba633da4581cf079b3a6f1ed219" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/halaxa/json-machine/zipball/b99d7a9a1efc8ba633da4581cf079b3a6f1ed219", - "reference": "b99d7a9a1efc8ba633da4581cf079b3a6f1ed219", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "ext-json": "*", - "guzzlehttp/guzzle": "^6", - "phpunit/phpunit": "^5.7.27" - }, - "type": "library", - "autoload": { - "psr-4": { - "JsonMachine\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Filip Halaxa", - "email": "filip@halaxa.cz" - } - ], - "description": "Efficient, easy-to-use and fast JSON pull parser", - "support": { - "issues": "https://github.com/halaxa/json-machine/issues", - "source": "https://github.com/halaxa/json-machine/tree/0.4.0" - }, - "time": "2020-11-09T13:28:55+00:00" - }, { "name": "hashids/hashids", "version": "3.0.0", @@ -6805,58 +6757,6 @@ }, "time": "2020-11-09T15:54:21+00:00" }, - { - "name": "staudenmeir/eloquent-has-many-deep", - "version": "v1.13.1", - "source": { - "type": "git", - "url": "https://github.com/staudenmeir/eloquent-has-many-deep.git", - "reference": "c0c9b6bd5c39d08e8adddc7eb8625962bd67a3da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/staudenmeir/eloquent-has-many-deep/zipball/c0c9b6bd5c39d08e8adddc7eb8625962bd67a3da", - "reference": "c0c9b6bd5c39d08e8adddc7eb8625962bd67a3da", - "shasum": "" - }, - "require": { - "illuminate/database": "^8.0", - "php": "^7.3|^8.0" - }, - "require-dev": { - "illuminate/pagination": "^8.0", - "phpunit/phpunit": "^9.3", - "staudenmeir/eloquent-eager-limit": "^1.6" - }, - "type": "library", - "autoload": { - "psr-4": { - "Staudenmeir\\EloquentHasManyDeep\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jonas Staudenmeir", - "email": "mail@jonas-staudenmeir.de" - } - ], - "description": "Laravel Eloquent HasManyThrough relationships with unlimited levels", - "support": { - "issues": "https://github.com/staudenmeir/eloquent-has-many-deep/issues", - "source": "https://github.com/staudenmeir/eloquent-has-many-deep/tree/v1.13.1" - }, - "funding": [ - { - "url": "https://paypal.me/JonasStaudenmeir", - "type": "custom" - } - ], - "time": "2020-11-22T18:51:29+00:00" - }, { "name": "stripe/stripe-php", "version": "v7.65.0", @@ -10862,6 +10762,107 @@ }, "time": "2020-11-01T12:00:00+00:00" }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v2.16.7", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "4e35806a6d7d8510d6842ae932e8832363d22c87" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/4e35806a6d7d8510d6842ae932e8832363d22c87", + "reference": "4e35806a6d7d8510d6842ae932e8832363d22c87", + "shasum": "" + }, + "require": { + "composer/semver": "^1.4 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^1.2", + "doctrine/annotations": "^1.2", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.1", + "php-cs-fixer/diff": "^1.3", + "symfony/console": "^3.4.43 || ^4.1.6 || ^5.0", + "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", + "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", + "symfony/finder": "^3.0 || ^4.0 || ^5.0", + "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", + "symfony/polyfill-php70": "^1.0", + "symfony/polyfill-php72": "^1.4", + "symfony/process": "^3.0 || ^4.0 || ^5.0", + "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" + }, + "require-dev": { + "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", + "justinrainbow/json-schema": "^5.0", + "keradus/cli-executor": "^1.4", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.4.1", + "php-cs-fixer/accessible-object": "^1.0", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", + "phpunitgoodpractices/traits": "^1.9.1", + "symfony/phpunit-bridge": "^5.1", + "symfony/yaml": "^3.0 || ^4.0 || ^5.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters.", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", + "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "classmap": [ + "tests/Test/AbstractFixerTestCase.php", + "tests/Test/AbstractIntegrationCaseFactory.php", + "tests/Test/AbstractIntegrationTestCase.php", + "tests/Test/Assert/AssertTokensTrait.php", + "tests/Test/IntegrationCase.php", + "tests/Test/IntegrationCaseFactory.php", + "tests/Test/IntegrationCaseFactoryInterface.php", + "tests/Test/InternalIntegrationCaseFactory.php", + "tests/Test/IsIdenticalConstraint.php", + "tests/TestCase.php" + ] + }, + "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/v2.16.7" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2020-10-27T22:44:27+00:00" + }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.1", @@ -11411,6 +11412,61 @@ }, "time": "2020-06-27T14:39:04+00:00" }, + { + "name": "php-cs-fixer/diff", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/diff.git", + "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/dbd31aeb251639ac0b9e7e29405c1441907f5759", + "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759", + "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" + }, + { + "name": "SpacePossum" + } + ], + "description": "sebastian/diff v2 backport support for PHP5.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/v1.3.1" + }, + "time": "2020-10-14T08:39:05+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -13151,6 +13207,136 @@ ], "time": "2020-10-24T11:50:19+00:00" }, + { + "name": "symfony/polyfill-php70", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", + "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "metapackage", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0" + }, + "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": "2020-10-23T14:02:19+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v5.1.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "3d9f57c89011f0266e6b1d469e5c0110513859d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/3d9f57c89011f0266e6b1d469e5c0110513859d5", + "reference": "3d9f57c89011f0266e6b1d469e5c0110513859d5", + "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": "Symfony Stopwatch Component", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v5.1.8" + }, + "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": "2020-10-24T12:01:57+00:00" + }, { "name": "symfony/yaml", "version": "v5.1.8",