From e2a3c1f8894abae5ceb274be2230dfb114fba2be Mon Sep 17 00:00:00 2001 From: Sean Delaney Date: Thu, 30 Jun 2022 11:38:38 +0100 Subject: [PATCH] Added ECS --- .gitignore | 3 +- composer.json | 7 ++-- composer.lock | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++- ecs.php | 17 ++++++++++ 4 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 ecs.php diff --git a/.gitignore b/.gitignore index 4eb8b8b..b7a1097 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,4 @@ node_modules/ npm-debug.log -.php_cs.cache -.php-cs-fixer.cache +.ecs_cache diff --git a/composer.json b/composer.json index bd5831f..136e56f 100755 --- a/composer.json +++ b/composer.json @@ -49,7 +49,8 @@ "stop-on-failure": ["pre-commit"] }, "pre-commit": [ - "composer run-script phpstan" + "composer run-script phpstan", + "composer run-script ecs" ] } }, @@ -65,12 +66,14 @@ }, "require-dev": { "brainmaestro/composer-git-hooks": "^2.8", + "craftcms/ecs": "dev-main", "craftcms/phpstan": "dev-main", "phpstan/phpstan": "^1.8" }, "scripts": { "cghooks": "vendor/bin/cghooks", - "phpstan": "vendor/bin/phpstan --memory-limit=1G" + "phpstan": "vendor/bin/phpstan --memory-limit=1G", + "ecs": "vendor/bin/ecs check --fix" }, "minimum-stability": "dev", "prefer-stable": true diff --git a/composer.lock b/composer.lock index f8f539e..bf81129 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": "b6f90efa2f89b64aff999d0cc4a3699e", + "content-hash": "956718545c4e054a68c9b5c9588356fe", "packages": [ { "name": "cebe/markdown", @@ -5854,6 +5854,39 @@ }, "time": "2021-02-08T15:59:11+00:00" }, + { + "name": "craftcms/ecs", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/craftcms/ecs.git", + "reference": "6534ed578927b9e1da0acd44584c9341e0e87fbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/craftcms/ecs/zipball/6534ed578927b9e1da0acd44584c9341e0e87fbe", + "reference": "6534ed578927b9e1da0acd44584c9341e0e87fbe", + "shasum": "" + }, + "require": { + "php": "^7.2.5|^8.0.2", + "symplify/easy-coding-standard": "^10.0" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "craft\\ecs\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "description": "Easy Coding Standard configurations for Craft CMS projects", + "support": { + "issues": "https://github.com/craftcms/ecs/issues", + "source": "https://github.com/craftcms/ecs/tree/main" + }, + "time": "2022-04-12T20:55:14+00:00" + }, { "name": "craftcms/phpstan", "version": "dev-main", @@ -5939,11 +5972,67 @@ } ], "time": "2022-06-29T08:53:31+00:00" + }, + { + "name": "symplify/easy-coding-standard", + "version": "10.3.3", + "source": { + "type": "git", + "url": "https://github.com/symplify/easy-coding-standard.git", + "reference": "c93878b3c052321231519b6540e227380f90be17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symplify/easy-coding-standard/zipball/c93878b3c052321231519b6540e227380f90be17", + "reference": "c93878b3c052321231519b6540e227380f90be17", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "conflict": { + "friendsofphp/php-cs-fixer": "<3.0", + "squizlabs/php_codesniffer": "<3.6" + }, + "bin": [ + "bin/ecs" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.3-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Prefixed scoped version of ECS package", + "support": { + "source": "https://github.com/symplify/easy-coding-standard/tree/10.3.3" + }, + "funding": [ + { + "url": "https://www.paypal.me/rectorphp", + "type": "custom" + }, + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-06-13T14:03:37+00:00" } ], "aliases": [], "minimum-stability": "dev", "stability-flags": { + "craftcms/ecs": 20, "craftcms/phpstan": 20 }, "prefer-stable": true, diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..e7ce233 --- /dev/null +++ b/ecs.php @@ -0,0 +1,17 @@ +paths([__DIR__ . '/src', __FILE__]); + $ecsConfig->indentation('tab'); + $ecsConfig->parallel(); + $ecsConfig->sets([SetList::CRAFT_CMS_4]); + + $parameters = $ecsConfig->parameters(); + $parameters->set(Option::CACHE_DIRECTORY, '.ecs_cache'); +};