Skip to content

Commit 99f377a

Browse files
committed
add static analysis via GitHub CI
1 parent 9bbd7bc commit 99f377a

5 files changed

Lines changed: 41 additions & 1 deletion

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Static Analysis
2+
3+
on: [ push, pull_request, workflow_dispatch ]
4+
5+
jobs:
6+
static-analysis:
7+
runs-on: ubuntu-22.04
8+
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: 8.2
17+
tools: composer:v2
18+
coverage: none
19+
20+
- name: Install PHPStan
21+
uses: nick-invision/retry@v2
22+
with:
23+
timeout_minutes: 5
24+
max_attempts: 5
25+
command: composer require phpstan/phpstan=^1.11.x-dev -n -q --no-progress
26+
27+
- name: Run Static Analysis
28+
run: ./vendor/bin/phpstan analyse --no-progress --memory-limit 2G

phpstan.neon.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parameters:
2+
level: 9
3+
paths:
4+
- ./src
5+
- ./tests

src/BackgroundProcessing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public static function reset()
9090

9191
/**
9292
* @param Closure $op
93-
* @param array ...$params
93+
* @param array<mixed> ...$params
9494
* @return void
9595
*/
9696
public static function add(Closure $op, ...$params)

tests/unit/BasicTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public function setUp(): void
5555
BackgroundProcessing::reset();
5656
}
5757

58+
/**
59+
* @return array<array<mixed>>
60+
*/
5861
public static function dataRun(): array
5962
{
6063
$closure = function (int ...$params) {
@@ -97,6 +100,7 @@ public static function dataRun(): array
97100
}
98101

99102
/**
103+
* @param array<array{0: \Closure, ?mixed}> $closures
100104
* @dataProvider dataRun
101105
* @covers BackgroundProcessing::run()
102106
* @throws AlreadyInvokedException|InvalidEnvironmentException

tests/unit/DockerizedTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
*/
3131
class DockerizedTest extends TestCase
3232
{
33+
/**
34+
* @return array<array<string, string>>
35+
*/
3336
public static function dataRun(): array
3437
{
3538
return [

0 commit comments

Comments
 (0)