Skip to content

Commit cebf778

Browse files
Add mutation tests, raise phpstan 7. (#6)
1 parent b226ef3 commit cebf778

9 files changed

+76
-3
lines changed

.github/workflows/mutation.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on:
2+
pull_request:
3+
paths-ignore:
4+
- 'docs/**'
5+
- 'README.md'
6+
- 'CHANGELOG.md'
7+
- '.gitignore'
8+
- '.gitattributes'
9+
- 'psalm.xml'
10+
11+
push:
12+
paths-ignore:
13+
- 'docs/**'
14+
- 'README.md'
15+
- 'CHANGELOG.md'
16+
- '.gitignore'
17+
- '.gitattributes'
18+
- 'psalm.xml'
19+
20+
name: mutation test
21+
22+
jobs:
23+
mutation:
24+
uses: php-forge/actions/.github/workflows/roave-infection.yml@main
25+
secrets:
26+
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
27+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
28+
with:
29+
os: >-
30+
['ubuntu-latest']
31+
php: >-
32+
['8.1']

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@
1919
<a href="https://codecov.io/gh/yii2-extensions/asset-bootstrap5" target="_blank">
2020
<img src="https://codecov.io/gh/yii2-extensions/asset-bootstrap5/branch/main/graph/badge.svg?token=MF0XUGVLYC" alt="Codecov">
2121
</a>
22+
<a href="https://dashboard.stryker-mutator.io/reports/github.com/yii2-extensions/asset-bootstrap5/main" target="_blank">
23+
<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">
24+
</a>
2225
<a href="https://github.com/yii2-extensions/asset-bootstrap5/actions/workflows/static.yml" target="_blank">
2326
<img src="https://github.com/yii2-extensions/gii/actions/workflows/static.yml/badge.svg" alt="PHPStan">
2427
</a>
2528
<a href="https://github.com/yii2-extensions/asset-bootstrap5/actions/workflows/static.yml" target="_blank">
26-
<img src="https://img.shields.io/badge/PHPStan%20level-5-blue" alt="PHPStan level">
29+
<img src="https://img.shields.io/badge/PHPStan%20level-7-blue" alt="PHPStan level">
2730
</a>
2831
<a href="https://github.styleci.io/repos/719651888?branch=main" target="_blank">
2932
<img src="https://github.styleci.io/repos/719651888/shield?branch=main" alt="Code style">

composer.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"maglnet/composer-require-checker": "^4.6",
2222
"php-forge/support": "dev-main",
2323
"phpunit/phpunit": "^10.2",
24+
"roave/infection-static-analysis-plugin": "^1.32",
2425
"yii2-extensions/phpstan": "dev-main"
2526
},
2627
"autoload": {
@@ -53,7 +54,8 @@
5354
"allow-plugins": {
5455
"yiisoft/yii2-composer": true,
5556
"composer/installers": true,
56-
"oomphinc/composer-installers-extender": true
57+
"oomphinc/composer-installers-extender": true,
58+
"infection/extension-installer": true
5759
}
5860
},
5961
"scripts": {

phpstan.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77
dynamicConstantNames:
88
- YII_ENV
99

10-
level: 5
10+
level: 7
1111

1212
paths:
1313
- src

psalm.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="1"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
findUnusedBaselineEntry="true"
9+
findUnusedCode="false"
10+
>
11+
<projectFiles>
12+
<directory name="src" />
13+
<ignoreFiles>
14+
<directory name="vendor" />
15+
</ignoreFiles>
16+
</projectFiles>
17+
<issueHandlers>
18+
<MixedAssignment errorLevel="suppress" />
19+
</issueHandlers>
20+
</psalm>

src/BootstrapCdnAsset.php

+4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ final class BootstrapCdnAsset extends AssetBundle
1313
{
1414
/**
1515
* @inheritDoc
16+
*
17+
* @phpstan-var array<array-key, mixed>
1618
*/
1719
public $css = [
1820
'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css',
1921
];
2022

2123
/**
2224
* @inheritDoc
25+
*
26+
* @phpstan-var array<array-key, mixed>
2327
*/
2428
public $cssOptions = [
2529
'crossorigin' => 'anonymous',

src/BootstrapPluginAsset.php

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ final class BootstrapPluginAsset extends AssetBundle
1818

1919
/**
2020
* @inheritDoc
21+
*
22+
* @phpstan-var array<array-key, mixed>
2123
*/
2224
public $depends = [
2325
BootstrapAsset::class,

src/BootstrapPluginCdnAsset.php

+6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ final class BootstrapPluginCdnAsset extends AssetBundle
1313
{
1414
/**
1515
* @inheritDoc
16+
*
17+
* @phpstan-var array<array-key, mixed>
1618
*/
1719
public $js = [
1820
'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js',
1921
];
2022

2123
/**
2224
* @inheritDoc
25+
*
26+
* @phpstan-var array<array-key, mixed>
2327
*/
2428
public $jsOptions = [
2529
'crossorigin' => 'anonymous',
@@ -28,6 +32,8 @@ final class BootstrapPluginCdnAsset extends AssetBundle
2832

2933
/**
3034
* @inheritDoc
35+
*
36+
* @phpstan-var array<array-key, mixed>
3137
*/
3238
public $depends = [
3339
BootstrapCdnAsset::class,

src/PopperCdnAsset.php

+4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ final class PopperCdnAsset extends AssetBundle
1313
{
1414
/**
1515
* @inheritDoc
16+
*
17+
* @phpstan-var array<array-key, mixed>
1618
*/
1719
public $js = [
1820
'https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js',
1921
];
2022

2123
/**
2224
* @inheritDoc
25+
*
26+
* @phpstan-var array<array-key, mixed>
2327
*/
2428
public $jsOptions = [
2529
'crossorigin' => 'anonymous',

0 commit comments

Comments
 (0)