Skip to content

Commit d4fe94b

Browse files
authored
Merge pull request #31 from tiny-blocks/release/3.5.0
2 parents fe371b6 + 923d1ee commit d4fe94b

22 files changed

+195
-78
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,49 @@
11
name: CI
22

33
on:
4-
push:
54
pull_request:
65

76
permissions:
87
contents: read
98

9+
env:
10+
PHP_VERSION: '8.3'
11+
1012
jobs:
1113
auto-review:
1214
name: Auto review
1315
runs-on: ubuntu-latest
1416

1517
steps:
1618
- name: Checkout
17-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
1820

19-
- name: Use PHP 8.2
21+
- name: Configure PHP
2022
uses: shivammathur/setup-php@v2
2123
with:
22-
php-version: '8.2'
24+
php-version: ${{ env.PHP_VERSION }}
2325

2426
- name: Install dependencies
2527
run: composer update --no-progress --optimize-autoloader
2628

27-
- name: Run phpcs
28-
run: composer phpcs
29-
30-
- name: Run phpmd
31-
run: composer phpmd
29+
- name: Run review
30+
run: composer review
3231

3332
tests:
3433
name: Tests
3534
runs-on: ubuntu-latest
3635

3736
steps:
3837
- name: Checkout
39-
uses: actions/checkout@v3
38+
uses: actions/checkout@v4
4039

41-
- name: Use PHP 8.2
40+
- name: Use PHP ${{ env.PHP_VERSION }}
4241
uses: shivammathur/setup-php@v2
4342
with:
44-
php-version: '8.2'
43+
php-version: ${{ env.PHP_VERSION }}
4544

4645
- name: Install dependencies
4746
run: composer update --no-progress --optimize-autoloader
4847

49-
- name: Run unit tests
50-
env:
51-
XDEBUG_MODE: coverage
52-
run: composer test
53-
54-
- name: Run mutation tests
55-
run: composer test-mutation
48+
- name: Run tests
49+
run: composer tests

Makefile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
DOCKER_RUN = docker run --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.2
1+
DOCKER_RUN = docker run --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.3
22

3-
.PHONY: configure test test-file test-no-coverage review show-reports clean
3+
.PHONY: configure test test-no-coverage review show-reports clean
44

55
configure:
66
@${DOCKER_RUN} composer update --optimize-autoloader
77

88
test:
99
@${DOCKER_RUN} composer tests
1010

11-
test-file:
12-
@${DOCKER_RUN} composer tests-file-no-coverage ${FILE}
13-
1411
test-no-coverage:
1512
@${DOCKER_RUN} composer tests-no-coverage
1613

@@ -22,4 +19,4 @@ show-reports:
2219

2320
clean:
2421
@sudo chown -R ${USER}:${USER} ${PWD}
25-
@rm -rf report vendor .phpunit.cache
22+
@rm -rf report vendor .phpunit.cache .lock

composer.json

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,41 +43,36 @@
4343
}
4444
},
4545
"require": {
46-
"php": "^8.2",
46+
"php": "^8.3",
4747
"ext-bcmath": "*"
4848
},
4949
"require-dev": {
5050
"phpmd/phpmd": "^2.15",
5151
"phpunit/phpunit": "^11",
5252
"phpstan/phpstan": "^1",
53-
"infection/infection": "^0.29",
54-
"squizlabs/php_codesniffer": "^3.10"
53+
"infection/infection": "^0",
54+
"squizlabs/php_codesniffer": "^3.11"
5555
},
5656
"suggest": {
5757
"ext-bcmath": "Enables the extension which is an interface to the GNU implementation as a Basic Calculator utility library."
5858
},
5959
"scripts": {
60+
"test": "phpunit --configuration phpunit.xml tests",
6061
"phpcs": "phpcs --standard=PSR12 --extensions=php ./src",
61-
"phpmd": "phpmd ./src text phpmd.xml --suffixes php --exclude /src/RoundingMode.php --ignore-violations-on-exit",
62+
"phpmd": "phpmd ./src text phpmd.xml --suffixes php --ignore-violations-on-exit",
6263
"phpstan": "phpstan analyse -c phpstan.neon.dist --quiet --no-progress",
63-
"test": "phpunit --log-junit=report/coverage/junit.xml --coverage-xml=report/coverage/coverage-xml --coverage-html=report/coverage/coverage-html tests",
64-
"test-mutation": "infection --only-covered --logger-html=report/coverage/mutation-report.html --coverage=report/coverage --min-msi=100 --min-covered-msi=100 --threads=4",
65-
"test-no-coverage": "phpunit --no-coverage",
66-
"test-mutation-no-coverage": "infection --only-covered --min-msi=100 --threads=4",
64+
"mutation-test": "infection --only-covered --threads=max --logger-html=report/coverage/mutation-report.html --coverage=report/coverage",
65+
"test-no-coverage": "phpunit --configuration phpunit.xml --no-coverage tests",
6766
"review": [
6867
"@phpcs",
6968
"@phpmd",
7069
"@phpstan"
7170
],
7271
"tests": [
7372
"@test",
74-
"@test-mutation"
73+
"@mutation-test"
7574
],
7675
"tests-no-coverage": [
77-
"@test-no-coverage",
78-
"@test-mutation-no-coverage"
79-
],
80-
"tests-file-no-coverage": [
8176
"@test-no-coverage"
8277
]
8378
}

infection.json.dist

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
{
2-
"timeout": 10,
3-
"testFramework": "phpunit",
2+
"logs": {
3+
"text": "report/infection/logs/infection-text.log",
4+
"summary": "report/infection/logs/infection-summary.log"
5+
},
46
"tmpDir": "report/infection/",
7+
"minMsi": 100,
8+
"timeout": 30,
59
"source": {
610
"directories": [
711
"src"
812
]
913
},
10-
"logs": {
11-
"text": "report/infection/logs/infection-text.log",
12-
"summary": "report/infection/logs/infection-summary.log"
14+
"phpUnit": {
15+
"configDir": "",
16+
"customPath": "./vendor/bin/phpunit"
1317
},
1418
"mutators": {
1519
"@default": true,
1620
"Minus": false,
1721
"BCMath": false,
18-
"CastInt": false,
1922
"Ternary": false,
2023
"RoundingFamily": false,
21-
"DecrementInteger": false,
22-
"IncrementInteger": false,
24+
"PublicVisibility": false,
2325
"ProtectedVisibility": false
2426
},
25-
"phpUnit": {
26-
"configDir": "",
27-
"customPath": "./vendor/bin/phpunit"
28-
}
27+
"minCoveredMsi": 100,
28+
"testFramework": "phpunit"
2929
}

phpstan.neon.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ parameters:
44
level: 9
55
tmpDir: report/phpstan
66
ignoreErrors:
7+
- '#does not accept#'
78
- '#Binary operation#'
8-
- '#of function sprintf expects#'
99
- '#Access to an undefined property#'
10+
- '#function number_format expects int#'
1011
- '#expects TinyBlocks\\Math\\BigNumber#'
1112
- '#type specified in iterable type array#'
1213
reportUnmatchedIgnoredErrors: false

phpunit.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
failOnRisky="true"
77
failOnWarning="true"
88
cacheDirectory=".phpunit.cache"
9+
executionOrder="random"
910
beStrictAboutOutputDuringTests="true">
1011

1112
<source>
@@ -22,14 +23,15 @@
2223

2324
<coverage>
2425
<report>
26+
<xml outputDirectory="report/coverage/coverage-xml"/>
27+
<html outputDirectory="report/coverage/coverage-html"/>
2528
<text outputFile="report/coverage.txt"/>
26-
<html outputDirectory="report/html/"/>
2729
<clover outputFile="report/coverage-clover.xml"/>
2830
</report>
2931
</coverage>
3032

3133
<logging>
32-
<junit outputFile="report/execution-result.xml"/>
34+
<junit outputFile="report/coverage/junit.xml"/>
3335
</logging>
3436

3537
</phpunit>

src/BigNumber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
interface BigNumber
1414
{
15-
public const AUTOMATIC_SCALE = null;
15+
public const null AUTOMATIC_SCALE = null;
1616

1717
/**
1818
* Converts the current BigNumber to its absolute value.

src/Internal/Exceptions/DivisionByZero.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ final class DivisionByZero extends RuntimeException
1111
public function __construct(string $dividend, string $divisor)
1212
{
1313
$template = 'Cannot divide <%.2f> by <%.2f>.';
14+
1415
parent::__construct(message: sprintf($template, $dividend, $divisor));
1516
}
1617
}

src/Internal/Exceptions/InvalidNumber.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ final class InvalidNumber extends RuntimeException
1111
public function __construct(string $value)
1212
{
1313
$template = 'The value <%s> is not a valid number.';
14+
1415
parent::__construct(message: sprintf($template, $value));
1516
}
1617
}

src/Internal/Exceptions/InvalidScale.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ final class InvalidScale extends RuntimeException
1111
public function __construct(int $value, int $minimum, int $maximum)
1212
{
1313
$template = 'Scale value <%s> is invalid. The value must be between <%s> and <%s>.';
14+
1415
parent::__construct(message: sprintf($template, $value, $minimum, $maximum));
1516
}
1617
}

0 commit comments

Comments
 (0)