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 @@ <br> </p> -## Requirements +<p align="center"> + <a href="https://www.php.net/releases/8.1/en.php" target="_blank"> + <img src="https://img.shields.io/badge/PHP-%3E%3D8.1-787CB5" alt="php-version"> + </a> + <a href="https://github.com/yii-tools/template/actions/workflows/build.yml" target="_blank"> + <img src="https://github.com/yii-tools/template/actions/workflows/build.yml/badge.svg" alt="PHPUnit"> + </a> + <a href="https://codecov.io/gh/yii-tools/template" target="_blank"> + <img src="https://codecov.io/gh/yii-tools/template/branch/main/graph/badge.svg?token=MF0XUGVLYC" alt="Codecov"> + </a> + <a href="https://dashboard.stryker-mutator.io/reports/github.com/yii-tools/template/main" target="_blank"> + <img src="https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyii2-extensions%2Fasset-bootstrap5%2Fmain" alt="Infection"> + </a> + <a href="(https://github.com/yii-tools/template/actions/workflows/static.yml" target="_blank"> + <img src="https://github.com/yii-tools/template/actions/workflows/static.yml/badge.svg" alt="Psalm"> + </a> + <a href="(https://shepherd.dev/github/yii-tools/template" target="_blank"> + <img src="https://shepherd.dev/github/yii-tools/template/coverage.svg" alt="Psalm Coverage"> + </a> + <a href="(https://github.styleci.io/repos/494495136?branch=main" target="_blank"> + <img src="https://github.styleci.io/repos/494495136/shield?branch=main" alt="Style ci"> + </a> +</p> + +## 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. +[](https://yiiframework.com) -## CI status +## Testing -[](https://github.com/yii-tools/template/actions/workflows/build.yml) -[](https://codecov.io/gh/yii-tools/template) -[](https://dashboard.stryker-mutator.io/reports/github.com/yii-tools/template/main) -[](https://github.com/yii-tools/template/actions/workflows/static.yml) -[](https://shepherd.dev/github/yii-tools/template) -[](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 @@ +<?php + +declare(strict_types=1); + +use PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer; +use PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer; +use PhpCsFixer\Fixer\ClassNotation\OrderedTraitsFixer; +use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer; +use Symplify\EasyCodingStandard\Config\ECSConfig; +use Symplify\EasyCodingStandard\ValueObject\Set\SetList; + +return function (ECSConfig $ecsConfig): void { + $ecsConfig->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, + ], + ); +};