Skip to content

Commit 80dd8e7

Browse files
author
Olivier Dolbeau
authored
Merge pull request #38 from php-translation/githubaction-phpstan
Add PHPStan Github Action
2 parents 1708120 + a4dee5f commit 80dd8e7

File tree

5 files changed

+60
-0
lines changed

5 files changed

+60
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Static code analysis
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
static-code-analysis:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@master
10+
- name: Run PHPStan
11+
uses: docker://jakzal/phpqa:php7.3-alpine
12+
with:
13+
args: phpstan analyze

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DIR := ${CURDIR}
2+
QA_IMAGE := jakzal/phpqa:php7.3-alpine
3+
4+
static:
5+
docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) phpstan analyze

Readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ and loader.
1515
composer require php-translation/symfony-storage
1616
```
1717

18+
### Tests
19+
20+
Static code analysis (uses PHPStan) by running:
21+
22+
```
23+
make static
24+
```
25+
1826
### Documentation
1927

2028
Read our documentation at [http://php-translation.readthedocs.io](http://php-translation.readthedocs.io/en/latest/).

phpstan-baseline.neon

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Method Translation\\\\SymfonyStorage\\\\FileStorage\\:\\:writeCatalogue\\(\\) has no return typehint specified\\.$#"
5+
count: 1
6+
path: src/FileStorage.php
7+
8+
-
9+
message: "#^Method Translation\\\\SymfonyStorage\\\\FileStorage\\:\\:writeCatalogue\\(\\) has parameter \\$locale with no typehint specified\\.$#"
10+
count: 1
11+
path: src/FileStorage.php
12+
13+
-
14+
message: "#^Parameter \\#1 \\$catalogue of method Symfony\\\\Component\\\\Translation\\\\Writer\\\\TranslationWriterInterface\\:\\:write\\(\\) expects Symfony\\\\Component\\\\Translation\\\\MessageCatalogue, Symfony\\\\Component\\\\Translation\\\\MessageCatalogueInterface given\\.$#"
15+
count: 2
16+
path: src/FileStorage.php
17+
18+
-
19+
message: "#^Method Translation\\\\SymfonyStorage\\\\FileStorage\\:\\:loadCatalogue\\(\\) has no return typehint specified\\.$#"
20+
count: 1
21+
path: src/FileStorage.php
22+

phpstan.neon.dist

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: max
6+
inferPrivatePropertyTypeFromConstructor: true
7+
checkMissingIterableValueType: false
8+
paths:
9+
- src
10+
excludes_analyse:
11+
- vendor
12+
- Tests

0 commit comments

Comments
 (0)