From 3d2d6e1fe427715dd10543f6544c7cbeb080265c Mon Sep 17 00:00:00 2001
From: Wilmer Arambula
Date: Thu, 18 Jan 2024 08:34:51 -0300
Subject: [PATCH] Update PHP versions and add ECS workflow.
---
.github/workflows/build.yml | 2 +-
.github/workflows/dependency-check.yml | 2 +-
.github/workflows/ecs.yml | 34 +++++++++++++++
.github/workflows/static.yml | 2 +-
README.md | 57 ++++++++++++++++++++------
composer.json | 19 +++++----
ecs.php | 47 +++++++++++++++++++++
7 files changed, 140 insertions(+), 23 deletions(-)
create mode 100644 .github/workflows/ecs.yml
create mode 100644 ecs.php
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 812f3db..d286d28 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -30,4 +30,4 @@ jobs:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
- ['8.1', '8.2']
+ ['8.1', '8.2', '8.3']
diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml
index 5b57355..dde6447 100644
--- a/.github/workflows/dependency-check.yml
+++ b/.github/workflows/dependency-check.yml
@@ -30,4 +30,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
- ['8.1', '8.2']
+ ['8.1']
diff --git a/.github/workflows/ecs.yml b/.github/workflows/ecs.yml
new file mode 100644
index 0000000..dff0db6
--- /dev/null
+++ b/.github/workflows/ecs.yml
@@ -0,0 +1,34 @@
+on:
+ pull_request:
+ paths-ignore:
+ - 'docs/**'
+ - 'README.md'
+ - 'CHANGELOG.md'
+ - '.gitignore'
+ - '.gitattributes'
+ - 'infection.json.dist'
+ - 'phpunit.xml.dist'
+
+ push:
+ branches: ['main']
+ paths-ignore:
+ - 'docs/**'
+ - 'README.md'
+ - 'CHANGELOG.md'
+ - '.gitignore'
+ - '.gitattributes'
+ - 'infection.json.dist'
+ - 'phpunit.xml.dist'
+
+name: ecs
+
+jobs:
+ easy-coding-standard:
+ uses: php-forge/actions/.github/workflows/ecs.yml@main
+ secrets:
+ AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
+ with:
+ os: >-
+ ['ubuntu-latest']
+ php: >-
+ ['8.1']
diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml
index 2dbe430..3654420 100644
--- a/.github/workflows/static.yml
+++ b/.github/workflows/static.yml
@@ -28,4 +28,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
- ['8.1', '8.2']
+ ['8.1']
diff --git a/README.md b/README.md
index 4a0e65d..c91a572 100644
--- a/README.md
+++ b/README.md
@@ -6,28 +6,59 @@
-## Requirements
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Installation
-The minimun version of `PHP` required by this package is `PHP 8.1`.
+The preferred way to install this extension is through [composer](https://getcomposer.org/download/).
-For install this package, you need [composer](https://getcomposer.org/).
+Either run
+
+```shell
+composer require --prefer-dist package
+```
+
+or add
+
+```json
+"package": "version"
+```
+
+to the require-dev section of your `composer.json` file.
## Usage
[Check the documentation docs](/docs/README.md) to learn about usage.
-## Testing
+## Support versions
-[Check the documentation testing](/docs/testing.md) to learn about testing.
+[![Yii30](https://img.shields.io/badge/Yii%20version-3.0-blue)](https://yiiframework.com)
-## CI status
+## Testing
-[![build](https://github.com/yii-tools/template/actions/workflows/build.yml/badge.svg)](https://github.com/yii-tools/template/actions/workflows/build.yml)
-[![codecov](https://codecov.io/gh/yii-tools/template/branch/main/graph/badge.svg?token=MF0XUGVLYC)](https://codecov.io/gh/yii-tools/template)
-[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyii-tools%2Ftemplate%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/yii-tools/template/main)
-[![static analysis](https://github.com/yii-tools/template/actions/workflows/static.yml/badge.svg)](https://github.com/yii-tools/template/actions/workflows/static.yml)
-[![type-coverage](https://shepherd.dev/github/yii-tools/template/coverage.svg)](https://shepherd.dev/github/yii-tools/template)
-[![StyleCI](https://github.styleci.io/repos/494495136/shield?branch=main)](https://github.styleci.io/repos/494495136?branch=main)
+[Check the documentation testing](/docs/testing.md) to learn about testing.
## Our social networks
@@ -35,4 +66,4 @@ For install this package, you need [composer](https://getcomposer.org/).
## License
-The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
+The MIT License. Please see [License File](LICENSE.md) for more information.
diff --git a/composer.json b/composer.json
index 57e194a..a79c6f6 100644
--- a/composer.json
+++ b/composer.json
@@ -1,9 +1,9 @@
{
"name": "yii-tools/template",
"type": "library",
- "description": "_____",
+ "description": "template",
"keywords": [
- "_____"
+ "template"
],
"license": "mit",
"minimum-stability": "dev",
@@ -12,10 +12,11 @@
"php": "^8.1"
},
"require-dev": {
- "maglnet/composer-require-checker": "^4.6",
- "phpunit/phpunit": "^10.2",
- "roave/infection-static-analysis-plugin": "^1.32",
- "vimeo/psalm": "^5.1"
+ "maglnet/composer-require-checker": "^4.7",
+ "phpunit/phpunit": "^10.5",
+ "roave/infection-static-analysis-plugin": "^1.34",
+ "symplify/easy-coding-standard": "^12.1",
+ "vimeo/psalm": "^5.19"
},
"autoload": {
"psr-4": {
@@ -40,7 +41,11 @@
},
"scripts": {
"check-dependencies": "composer-require-checker",
- "mutation": "roave-infection-static-analysis-plugin",
+ "easy-coding-standard": "ecs check",
+ "mutation": [
+ "Composer\\Config::disableProcessTimeout",
+ "roave-infection-static-analysis-plugin"
+ ],
"psalm": "psalm",
"test": "phpunit"
}
diff --git a/ecs.php b/ecs.php
new file mode 100644
index 0000000..78342b8
--- /dev/null
+++ b/ecs.php
@@ -0,0 +1,47 @@
+paths(
+ [
+ __DIR__ . '/src',
+ __DIR__ . '/tests',
+ ]
+ );
+
+ // this way you add a single rule
+ $ecsConfig->rules(
+ [
+ OrderedClassElementsFixer::class,
+ OrderedTraitsFixer::class,
+ NoUnusedImportsFixer::class,
+ ]
+ );
+
+ // this way you can add sets - group of rules
+ $ecsConfig->sets(
+ [
+ // run and fix, one by one
+ SetList::DOCBLOCK,
+ SetList::NAMESPACES,
+ SetList::COMMENTS,
+ SetList::PSR_12,
+ ]
+ );
+
+ // this way configures a rule
+ $ecsConfig->ruleWithConfiguration(
+ ClassDefinitionFixer::class,
+ [
+ 'space_before_parenthesis' => true,
+ ],
+ );
+};