Skip to content

Commit 2d74656

Browse files
committed
Refactor several components
1 parent 7d50abb commit 2d74656

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1994
-764
lines changed

.github/workflows/ci.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: CI
2+
on:
3+
pull_request: null
4+
push: null
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
dependency-validation:
10+
name: Dependency Validation
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 5
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: 8.4
18+
tools: composer-normalize, composer-require-checker
19+
- uses: ramsey/composer-install@v3
20+
- run: composer validate --no-ansi --strict composer.json
21+
- run: composer-normalize --dry-run
22+
- run: composer-require-checker check
23+
coding-guidelines:
24+
name: Coding Guidelines
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 5
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: 8.3 # php-cs-fixer is not yet compatible with 8.4
32+
tools: php-cs-fixer
33+
- run: php-cs-fixer fix --dry-run --show-progress=dots --using-cache=no --verbose
34+
static-analysis:
35+
name: Static Analysis
36+
needs:
37+
- dependency-validation
38+
runs-on: ubuntu-latest
39+
timeout-minutes: 5
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: shivammathur/setup-php@v2
43+
with:
44+
php-version: 8.4
45+
tools: phpstan
46+
- uses: "ramsey/composer-install@v3"
47+
- run: phpstan --memory-limit=512M --ansi --no-progress --error-format=github
48+
unit-tests:
49+
name: Unit Tests
50+
needs:
51+
- dependency-validation
52+
runs-on: ${{ matrix.os }}
53+
timeout-minutes: 5
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
os:
58+
- ubuntu-latest
59+
php-version:
60+
- "8.4"
61+
- "8.5"
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: shivammathur/setup-php@v2
65+
with:
66+
php-version: ${{ matrix.php-version }}
67+
- uses: ramsey/composer-install@v3
68+
- run: vendor/bin/phpunit --log-junit junit.xml
69+
- if: ${{ !cancelled() }}
70+
uses: codecov/test-results-action@v1
71+
with:
72+
token: ${{ secrets.CODECOV_TOKEN }}
73+
coverage:
74+
name: Coverage
75+
needs:
76+
- dependency-validation
77+
runs-on: ubuntu-latest
78+
timeout-minutes: 5
79+
steps:
80+
- uses: actions/checkout@v4
81+
- uses: shivammathur/setup-php@v2
82+
with:
83+
php-version: 8.4
84+
- uses: ramsey/composer-install@v3
85+
- run: vendor/bin/phpunit --coverage-clover=coverage.xml
86+
- uses: codecov/codecov-action@v5
87+
env:
88+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
89+
mutation-tests:
90+
name: Mutation Tests
91+
needs:
92+
- dependency-validation
93+
runs-on: ubuntu-latest
94+
timeout-minutes: 5
95+
steps:
96+
- uses: actions/checkout@v4
97+
- uses: shivammathur/setup-php@v2
98+
with:
99+
php-version: 8.4
100+
tools: infection
101+
- uses: ramsey/composer-install@v3
102+
- run: infection --min-msi=65 --min-covered-msi=70 --threads=4
103+
env:
104+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
# dependencies
1+
# dependencies & tools
22
vendor/
3+
tools/
34

45
# caches, logs etc.
56
composer.lock
67
.phpunit.cache
78
.php-cs-fixer.cache
89
.phpbench/
10+
coverage/
911

1012
# script-templates
1113
## Ignore all subdirectories under scripts (script-template folders)

Time.plantuml

Lines changed: 0 additions & 135 deletions
This file was deleted.

composer.json

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "sourecode/unit-bundle",
3+
"description": "Provides a set of classes to work with different units of measure.",
34
"license": "MIT",
45
"type": "symfony-bundle",
56
"authors": [
@@ -12,28 +13,29 @@
1213
"php": ">=8.4",
1314
"ext-bcmath": "*",
1415
"ext-intl": "*",
16+
"ext-mbstring": "*",
17+
"doctrine/dbal": "^4.2.3",
18+
"jetbrains/phpstorm-attributes": "^1.2",
1519
"symfony/config": "^7.1",
1620
"symfony/dependency-injection": "^7.1",
21+
"symfony/form": "^7.1",
1722
"symfony/http-kernel": "^7.1",
18-
"symfony/intl": "^7.1"
23+
"symfony/intl": "^7.1",
24+
"symfony/options-resolver": "^7.1"
1925
},
2026
"require-dev": {
21-
"brainmaestro/composer-git-hooks": "^3.0",
22-
"doctrine/dbal": "^3.9.4",
2327
"doctrine/doctrine-bundle": "^2.13.2",
2428
"doctrine/orm": "^3.3.2",
2529
"ergebnis/composer-normalize": "^2.45",
26-
"jetbrains/phpstorm-attributes": "^1.2",
2730
"nyholm/symfony-bundle-test": "^3.0",
28-
"php-cs-fixer/shim": "^3.75",
31+
"phpstan/extension-installer": "^1.4",
32+
"phpstan/phpstan-doctrine": "^2.0",
33+
"phpstan/phpstan-symfony": "^2.0",
2934
"phpunit/phpunit": "^12.1",
30-
"psalm/plugin-symfony": "^5.2",
3135
"symfony/browser-kit": "^7.1",
3236
"symfony/clock": "^7.1",
33-
"symfony/form": "^7.1",
3437
"symfony/runtime": "^7.1",
35-
"twig/twig": "^3.2",
36-
"vimeo/psalm": "^6.10"
38+
"twig/twig": "^3.2"
3739
},
3840
"autoload": {
3941
"psr-4": {
@@ -49,31 +51,8 @@
4951
"config": {
5052
"allow-plugins": {
5153
"ergebnis/composer-normalize": true,
54+
"phpstan/extension-installer": true,
5255
"symfony/runtime": true
5356
}
54-
},
55-
"extra": {
56-
"hooks": {
57-
"config": {
58-
"stop-on-failure": [
59-
"pre-commit",
60-
"pre-push"
61-
]
62-
},
63-
"pre-commit": [
64-
"composer normalize",
65-
"PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix"
66-
],
67-
"pre-push": [
68-
"composer normalize --dry-run",
69-
"PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run",
70-
"vendor/bin/phpunit",
71-
"vendor/bin/psalm --no-cache"
72-
]
73-
}
74-
},
75-
"scripts": {
76-
"post-install-cmd": "vendor/bin/cghooks add",
77-
"post-update-cmd": "vendor/bin/cghooks update"
7857
}
7958
}

infection.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"source": {
3+
"directories": [
4+
"src"
5+
],
6+
"excludes": [
7+
"SoureCodeDoctrineExtensionBundle.php",
8+
"/Interface\\.php/"
9+
]
10+
},
11+
"timeout": 10,
12+
"logs": {
13+
"text": "coverage/infections.log",
14+
"html": "coverage/mutants.html",
15+
"stryker": {
16+
"badge": "master"
17+
}
18+
},
19+
"mutators": {
20+
"@default": true
21+
}
22+
}

0 commit comments

Comments
 (0)