Skip to content

Commit 58c7d2e

Browse files
authored
Merge pull request #18 from maltehuebner/add-ci-workflow
Add GitHub Actions CI with PHPUnit and PHPStan
2 parents 47f054b + 0379b2a commit 58c7d2e

4 files changed

Lines changed: 207 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
tests:
11+
name: Tests (PHP ${{ matrix.php }})
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
php: ['8.3', '8.4', '8.5']
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
coverage: none
25+
26+
- name: Install dependencies
27+
run: composer install --no-interaction --prefer-dist
28+
29+
- name: Run tests
30+
run: composer run tests
31+
32+
phpstan:
33+
name: PHPStan
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Setup PHP
40+
uses: shivammathur/setup-php@v2
41+
with:
42+
php-version: '8.3'
43+
coverage: none
44+
45+
- name: Install dependencies
46+
run: composer install --no-interaction --prefer-dist
47+
48+
- name: Run PHPStan
49+
run: composer run phpstan

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"phpunit/phpunit": "^9.5",
1818
"rector/rector": "^1.2",
1919
"doctrine/orm": "^3.6",
20-
"doctrine/persistence": "^4.1"
20+
"doctrine/persistence": "^4.1",
21+
"phpstan/phpstan": "^1.12"
2122
},
2223
"autoload": {
2324
"psr-4": {
@@ -37,6 +38,7 @@
3738
],
3839
"minimum-stability": "stable",
3940
"scripts": {
40-
"tests": "phpunit"
41+
"tests": "phpunit",
42+
"phpstan": "phpstan analyse"
4143
}
4244
}

phpstan-baseline.neon

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Call to method load\\(\\) on an unknown class Symfony\\\\Component\\\\DependencyInjection\\\\Loader\\\\XmlFileLoader\\.$#"
5+
count: 1
6+
path: src/DependencyInjection/MalteHuebnerDataQueryExtension.php
7+
8+
-
9+
message: "#^Instantiated class Symfony\\\\Component\\\\DependencyInjection\\\\Loader\\\\XmlFileLoader not found\\.$#"
10+
count: 1
11+
path: src/DependencyInjection/MalteHuebnerDataQueryExtension.php
12+
13+
-
14+
message: "#^Deprecated in PHP 8\\.4\\: Parameter \\#3 \\$parameterName \\(string\\) is implicitly nullable via default value null\\.$#"
15+
count: 1
16+
path: src/Exception/ParameterConverterException.php
17+
18+
-
19+
message: "#^Call to static method getShortnameFromFqcn\\(\\) on an unknown class App\\\\Criticalmass\\\\Util\\\\ClassUtil\\.$#"
20+
count: 1
21+
path: src/Factory/ConflictResolver/ConflictResolver.php
22+
23+
-
24+
message: "#^Variable \\$parameter in PHPDoc tag @var does not match any variable in the foreach loop\\: \\$parameterCandidate$#"
25+
count: 1
26+
path: src/Factory/ParameterFactory/ParameterFactory.php
27+
28+
-
29+
message: "#^Variable \\$parameterField in PHPDoc tag @var does not match any variable in the foreach loop\\: \\$fieldName, \\$parameterFields$#"
30+
count: 1
31+
path: src/Factory/ParameterFactory/ParameterFactory.php
32+
33+
-
34+
message: "#^Call to static method getShortname\\(\\) on an unknown class App\\\\Criticalmass\\\\Util\\\\ClassUtil\\.$#"
35+
count: 1
36+
path: src/Factory/QueryFactory/QueryFactory.php
37+
38+
-
39+
message: "#^Variable \\$entityField in PHPDoc tag @var does not match any variable in the foreach loop\\: \\$entityFields$#"
40+
count: 1
41+
path: src/Factory/QueryFactory/QueryFactory.php
42+
43+
-
44+
message: "#^Negated boolean expression is always false\\.$#"
45+
count: 1
46+
path: src/Factory/ValueAssigner/ValueAssigner.php
47+
48+
-
49+
message: "#^Call to an undefined method ReflectionType\\:\\:getName\\(\\)\\.$#"
50+
count: 1
51+
path: src/FieldList/EntityFieldList/EntityFieldListFactory.php
52+
53+
-
54+
message: "#^Call to an undefined method ReflectionType\\:\\:getName\\(\\)\\.$#"
55+
count: 1
56+
path: src/FieldList/ParameterFieldList/ParameterFieldListFactory.php
57+
58+
-
59+
message: "#^Call to an undefined method MalteHuebner\\\\DataQueryBundle\\\\FieldList\\\\AbstractField\\:\\:setParameterName\\(\\)\\.$#"
60+
count: 2
61+
path: src/FieldList/QueryFieldList/QueryFieldListFactory.php
62+
63+
-
64+
message: "#^Call to an undefined method ReflectionType\\:\\:getName\\(\\)\\.$#"
65+
count: 2
66+
path: src/FieldList/QueryFieldList/QueryFieldListFactory.php
67+
68+
-
69+
message: "#^Call to method find\\(\\) on an unknown class FOS\\\\ElasticaBundle\\\\Repository\\.$#"
70+
count: 1
71+
path: src/Finder/Finder.php
72+
73+
-
74+
message: "#^Class MalteHuebner\\\\DataQueryBundle\\\\Finder\\\\AbstractOrmQuery not found\\.$#"
75+
count: 1
76+
path: src/Finder/Finder.php
77+
78+
-
79+
message: "#^Parameter \\$repository of method MalteHuebner\\\\DataQueryBundle\\\\Finder\\\\Finder\\:\\:__construct\\(\\) has invalid type FOS\\\\ElasticaBundle\\\\Repository\\.$#"
80+
count: 1
81+
path: src/Finder/Finder.php
82+
83+
-
84+
message: "#^Property MalteHuebner\\\\DataQueryBundle\\\\Finder\\\\Finder\\:\\:\\$repository has unknown class FOS\\\\ElasticaBundle\\\\Repository as its type\\.$#"
85+
count: 1
86+
path: src/Finder/Finder.php
87+
88+
-
89+
message: "#^Class FOS\\\\ElasticaBundle\\\\Manager\\\\RepositoryManagerInterface not found\\.$#"
90+
count: 2
91+
path: src/FinderFactory/FinderFactory.php
92+
93+
-
94+
message: "#^Cannot call method addMust\\(\\) on array\\<string, array\\<string, mixed\\>\\>\\|Elastica\\\\Query\\\\AbstractQuery\\.$#"
95+
count: 1
96+
path: src/Parameter/StartValueParameter.php
97+
98+
-
99+
message: "#^Call to static method getDayEndDateTime\\(\\) on an unknown class App\\\\Criticalmass\\\\Util\\\\DateTimeUtil\\.$#"
100+
count: 2
101+
path: src/Query/DateQuery.php
102+
103+
-
104+
message: "#^Call to static method getDayStartDateTime\\(\\) on an unknown class App\\\\Criticalmass\\\\Util\\\\DateTimeUtil\\.$#"
105+
count: 2
106+
path: src/Query/DateQuery.php
107+
108+
-
109+
message: "#^Call to static method getMonthEndDateTime\\(\\) on an unknown class App\\\\Criticalmass\\\\Util\\\\DateTimeUtil\\.$#"
110+
count: 2
111+
path: src/Query/MonthQuery.php
112+
113+
-
114+
message: "#^Call to static method getMonthStartDateTime\\(\\) on an unknown class App\\\\Criticalmass\\\\Util\\\\DateTimeUtil\\.$#"
115+
count: 2
116+
path: src/Query/MonthQuery.php
117+
118+
-
119+
message: "#^Call to static method getYearEndDateTime\\(\\) on an unknown class App\\\\Criticalmass\\\\Util\\\\DateTimeUtil\\.$#"
120+
count: 2
121+
path: src/Query/YearQuery.php
122+
123+
-
124+
message: "#^Call to static method getYearStartDateTime\\(\\) on an unknown class App\\\\Criticalmass\\\\Util\\\\DateTimeUtil\\.$#"
125+
count: 2
126+
path: src/Query/YearQuery.php
127+
128+
-
129+
message: "#^Access to an undefined property Symfony\\\\Component\\\\Validator\\\\Constraint\\:\\:\\$message\\.$#"
130+
count: 2
131+
path: src/Validator/BoundingBoxValidator.php
132+
133+
-
134+
message: "#^PHPDoc tag @var above a method has no effect\\.$#"
135+
count: 1
136+
path: src/Validator/BoundingBoxValidator.php
137+
138+
-
139+
message: "#^Access to an undefined property Symfony\\\\Component\\\\Validator\\\\Constraint\\:\\:\\$message\\.$#"
140+
count: 1
141+
path: src/Validator/SortableValidator.php
142+
143+
-
144+
message: "#^Variable \\$fieldList in PHPDoc tag @var does not match assigned variable \\$entityFieldList\\.$#"
145+
count: 1
146+
path: src/Validator/SortableValidator.php

phpstan.neon.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: 5
6+
paths:
7+
- src
8+
reportUnmatchedIgnoredErrors: false

0 commit comments

Comments
 (0)