Skip to content

Commit 1f8e3fc

Browse files
committed
update coverage
1 parent d13ff77 commit 1f8e3fc

File tree

7 files changed

+37
-4
lines changed

7 files changed

+37
-4
lines changed

Diff for: .github/workflows/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
uses: shivammathur/setup-php@v2
1818
with:
1919
php-version: ${{ matrix.version }}
20+
coverage: xdebug
2021

2122
- name: Install
2223
run: make install

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/vendor/
22
composer.lock
33
*.cache
4+
build
5+
html-coverage

Diff for: Makefile

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@ lint-fix:
1414
composer exec -v phpcbf
1515

1616
test-coverage:
17-
composer exec --verbose phpunit tests -- --coverage-clover build/logs/clover.xml
17+
XDEBUG_MODE=coverage composer exec --verbose phpunit tests -- --coverage-clover=build/logs/clover.xml
18+
19+
test-coverage-text:
20+
XDEBUG_MODE=coverage composer exec --verbose phpunit tests -- --coverage-text
21+
22+
test-coverage-html:
23+
XDEBUG_MODE=coverage composer exec --verbose phpunit tests -- --coverage-html=html-coverage

Diff for: phpunit.xml

+6
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@
1919
<directory>./tests/</directory>
2020
</testsuite>
2121
</testsuites>
22+
23+
<source>
24+
<include>
25+
<directory suffix=".php">src</directory>
26+
</include>
27+
</source>
2228
</phpunit>

Diff for: tests/Rules/Functions/data/functions.php

+15-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,20 @@
3232

3333
sort($ar2);
3434

35-
uasort($ar2);
35+
uasort($ar2, fn($a, $b) => $a <=> $b);
3636

37-
uksort($ar2);
37+
uksort($ar2, fn($a, $b) => $a <=> $b);
3838

39-
usort($ar2);
39+
usort($ar2, fn($a, $b) => $a <=> $b);
40+
41+
// no error
42+
array_filter($ar1, fn($a) => $a);
43+
44+
// no error
45+
// but maybe should
46+
$fn = 'print_r';
47+
$fn('hello');
48+
49+
// no error but should
50+
$fn2 = 'array_push';
51+
$fn2($ar2, 6);

Diff for: tests/Rules/Variables/AssignRuleTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public function testWithEnabledRule(): void
7575
'Should not use of mutating operators',
7676
52,
7777
],
78+
[
79+
'Should not use of mutating operators',
80+
54,
81+
],
7882
]);
7983
}
8084

Diff for: tests/Rules/Variables/data/assign.php

+2
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ function ds($arg1, &$arg2) {
5050
[$a] = $arr;
5151

5252
[$newVar, $a] = [5, 6, 7];
53+
54+
fn($a) => $a = 3;

0 commit comments

Comments
 (0)