Skip to content

Commit d51ebad

Browse files
committed
add baseline for phpstan and github action
1 parent 463e003 commit d51ebad

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: PHPStan Baseline Check
2+
3+
on:
4+
pull_request:
5+
branches: [ main, master ]
6+
paths:
7+
- 'src/**/*.php'
8+
9+
jobs:
10+
phpstan:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: '8.1'
21+
extensions: mbstring, intl
22+
23+
- name: Install dependencies
24+
run: composer install --prefer-dist --no-progress --optimize-autoloader
25+
26+
- name: Generate PHPStan baseline (if not exists)
27+
run: |
28+
if [ ! -f phpstan-baseline.neon ]; then
29+
vendor/bin/phpstan analyse --generate-baseline
30+
fi
31+
32+
- name: Run PHPStan with baseline
33+
run: vendor/bin/phpstan analyse --error-format=github

phpstan-baseline.neon.dist

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Call to an undefined method FeedIo\\Feed\\ItemInterface\:\:setHostInContent\(\)\.$#'
5+
identifier: method.notFound
6+
count: 1
7+
path: src/FeedIo/Feed.php
8+
9+
-
10+
message: '#^Offset float on list in isset\(\) does not exist\.$#'
11+
identifier: isset.offset
12+
count: 1
13+
path: src/FeedIo/Reader/Result/UpdateStats.php
14+
15+
-
16+
message: '#^Call to an undefined method FeedIo\\Feed\\NodeInterface\:\:getHostFromLink\(\)\.$#'
17+
identifier: method.notFound
18+
count: 1
19+
path: src/FeedIo/Rule/Link.php
20+
21+
-
22+
message: '#^PHPDoc tag @var with type FeedIo\\Reader\\FixerAbstract is not subtype of native type FeedIo\\Reader\\Fixer\\HttpLastModified\|FeedIo\\Reader\\Fixer\\PublicId\.$#'
23+
identifier: varTag.nativeType
24+
count: 1
25+
path: src/FeedIo/Specification.php

phpstan.neon.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
includes:
2+
- phpstan-baseline.neon.dist
3+
14
parameters:
25
errorFormat: table
36
level: 5

0 commit comments

Comments
 (0)