From 2c1572ddd7d85c56e4755d89eb522dd6a037204c Mon Sep 17 00:00:00 2001
From: Wilmer Arambula
Date: Mon, 2 Oct 2023 08:59:53 -0300
Subject: [PATCH 1/4] Fix minor corrections.
---
.github/workflows/mutation.yml | 31 -------------------------------
.github/workflows/static.yml | 2 +-
README.md | 18 ++++++++----------
composer.json | 13 +++++++++----
docs/testing.md | 12 ++----------
phpstan-yii-config.php | 5 +++++
6 files changed, 25 insertions(+), 56 deletions(-)
delete mode 100644 .github/workflows/mutation.yml
create mode 100644 phpstan-yii-config.php
diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml
deleted file mode 100644
index 1172d06..0000000
--- a/.github/workflows/mutation.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-on:
- pull_request:
- paths-ignore:
- - 'docs/**'
- - 'README.md'
- - 'CHANGELOG.md'
- - '.gitignore'
- - '.gitattributes'
- - 'psalm.xml'
-
- push:
- paths-ignore:
- - 'docs/**'
- - 'README.md'
- - 'CHANGELOG.md'
- - '.gitignore'
- - '.gitattributes'
- - 'psalm.xml'
-
-name: mutation test
-
-jobs:
- mutation:
- uses: yiisoft/actions/.github/workflows/roave-infection.yml@master
- secrets:
- STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
- with:
- os: >-
- ['ubuntu-latest']
- php: >-
- ['8.1']
diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml
index 58b5407..c8974c7 100644
--- a/.github/workflows/static.yml
+++ b/.github/workflows/static.yml
@@ -23,7 +23,7 @@ name: static analysis
jobs:
psalm:
- uses: yiisoft/actions/.github/workflows/psalm.yml@master
+ uses: php-forge/actions/.github/workflows/phpstan.yml@main
with:
os: >-
['ubuntu-latest']
diff --git a/README.md b/README.md
index e57a09b..306b746 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,17 @@
- Template.
+ Yii2-Template.
+![php-version](https://img.shields.io/badge/php-%3E%3D8.1-787CB5)
+![yii2-version](https://img.shields.io/badge/yii2%20version-2.2-blue)
+[![build](https://github.com/yii2-extensions/template/actions/workflows/build.yml/badge.svg)](https://github.com/yii2-extensions/template/actions/workflows/build.yml)
+[![codecov](https://codecov.io/gh/yii2-extensions/template/branch/main/graph/badge.svg?token=MF0XUGVLYC)](https://codecov.io/gh/yii2-extensions/template)
+[![static analysis](https://github.com/yii2-extensions/template/actions/workflows/static.yml/badge.svg)](https://github.com/yii2-extensions/template/actions/workflows/static.yml)
+[![StyleCI](https://github.styleci.io/repos/698621511/shield?branch=main)](https://github.styleci.io/repos/698621511?branch=main)
+
## Requirements
The minimun version of `PHP` required by this package is `PHP 8.1`.
@@ -20,15 +27,6 @@ For install this package, you need [composer](https://getcomposer.org/).
[Check the documentation testing](/docs/testing.md) to learn about testing.
-## CI status
-
-[![build](https://github.com/yii2-extensions/template/actions/workflows/build.yml/badge.svg)](https://github.com/yii2-extensions/template/actions/workflows/build.yml)
-[![codecov](https://codecov.io/gh/yii2-extensions/template/branch/main/graph/badge.svg?token=MF0XUGVLYC)](https://codecov.io/gh/yii2-extensions/template)
-[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyii2-extensions%2Ftemplate%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/yii2-extensions/template/main)
-[![static analysis](https://github.com/yii2-extensions/template/actions/workflows/static.yml/badge.svg)](https://github.com/yii2-extensions/template/actions/workflows/static.yml)
-[![type-coverage](https://shepherd.dev/github/yii2-extensions/template/coverage.svg)](https://shepherd.dev/github/yii2-extensions/template)
-[![StyleCI](https://github.styleci.io/repos/698621511/shield?branch=main)](https://github.styleci.io/repos/698621511?branch=main)
-
## Our social networks
[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555?style=flat)](https://twitter.com/Terabytesoftw)
diff --git a/composer.json b/composer.json
index 24aa0ed..fbca78c 100644
--- a/composer.json
+++ b/composer.json
@@ -14,8 +14,7 @@
"require-dev": {
"maglnet/composer-require-checker": "^4.6",
"phpunit/phpunit": "^10.2",
- "roave/infection-static-analysis-plugin": "^1.32",
- "vimeo/psalm": "^5.1"
+ "proget-hq/phpstan-yii2": "^0.8.0"
},
"autoload": {
"psr-4": {
@@ -41,7 +40,13 @@
"scripts": {
"check-dependencies": "composer-require-checker",
"mutation": "roave-infection-static-analysis-plugin",
- "psalm": "psalm",
+ "phpstan": "phpstan",
"test": "phpunit"
- }
+ },
+ "repositories": [
+ {
+ "type": "composer",
+ "url": "https://asset-packagist.org"
+ }
+ ]
}
diff --git a/docs/testing.md b/docs/testing.md
index 63478f7..46a4946 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -10,20 +10,12 @@ To run the checker, execute the following command:
composer run check-dependencies
```
-## Mutation testing
-
-Mutation testing is checked with [Infection](https://infection.github.io/). To run it:
-
-```shell
-composer run mutation
-```
-
## Static analysis
-The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:
+The code is statically analyzed with [Phpstan](https://phpstan.org/). To run static analysis:
```shell
-composer run psalm
+composer run phpstan
```
## Unit tests
diff --git a/phpstan-yii-config.php b/phpstan-yii-config.php
new file mode 100644
index 0000000..0dae23d
--- /dev/null
+++ b/phpstan-yii-config.php
@@ -0,0 +1,5 @@
+
Date: Mon, 2 Oct 2023 09:01:44 -0300
Subject: [PATCH 2/4] Add config phpstan.
---
phpstan.neon | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 phpstan.neon
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..3d3ce29
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,21 @@
+includes:
+ - vendor/proget-hq/phpstan-yii2/extension.neon
+parameters:
+ dynamicConstantNames:
+ - YII_DEBUG
+ - YII_ENV
+ - YII_ENV_DEV
+ - YII_ENV_PROD
+ - YII_ENV_TEST
+
+ level: 2
+
+ paths:
+ - src
+
+ scanFiles:
+ - vendor/yiisoft/yii2/Yii.php
+
+ yii2:
+ config_path: %currentWorkingDirectory%/phpstan-yii-config.php
+
From 22e085453dee42f9b7d7ce5157cb313d92ba807a Mon Sep 17 00:00:00 2001
From: Wilmer Arambula
Date: Mon, 2 Oct 2023 09:03:33 -0300
Subject: [PATCH 3/4] Update composer.json.
---
composer.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index fbca78c..ed76cc5 100644
--- a/composer.json
+++ b/composer.json
@@ -9,7 +9,8 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
- "php": "^8.1"
+ "php": ">=8.1",
+ "yiisoft/yii2": "^2.2"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.6",
From 0249bc2bcc942d0ed41e68822d4571ebbf03caee Mon Sep 17 00:00:00 2001
From: Wilmer Arambula
Date: Mon, 2 Oct 2023 09:08:34 -0300
Subject: [PATCH 4/4] Fix composer.json.
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index ed76cc5..9f4beaf 100644
--- a/composer.json
+++ b/composer.json
@@ -35,7 +35,7 @@
"config": {
"sort-packages": true,
"allow-plugins": {
- "infection/extension-installer": true
+ "yiisoft/yii2-composer": true
}
},
"scripts": {