Skip to content

Commit 7743802

Browse files
committed
Introduce PHPStan
1 parent 90a5595 commit 7743802

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2446
-149
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,37 @@ jobs:
8989
- name: Code style with PHP-CS-Fixer
9090
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff
9191

92+
phpstan:
93+
runs-on: ubuntu-latest
94+
steps:
95+
- name: Checkout
96+
uses: actions/checkout@v3
97+
98+
- name: Setup PHP, with composer and extensions
99+
uses: shivammathur/setup-php@v2
100+
with:
101+
php-version: 8.0
102+
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
103+
coverage: none
104+
tools: cs2pr
105+
106+
- name: Get composer cache directory
107+
id: composer-cache
108+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
109+
110+
- name: Cache composer dependencies
111+
uses: actions/cache@v3
112+
with:
113+
path: ${{ steps.composer-cache.outputs.dir }}
114+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
115+
restore-keys: ${{ runner.os }}-composer-
116+
117+
- name: Install dependencies
118+
run: composer install --no-progress --prefer-dist --optimize-autoloader
119+
120+
- name: Static analysis with PHPStan
121+
run: ./vendor/bin/phpstan analyse
122+
92123
coverage:
93124
runs-on: ubuntu-latest
94125
steps:

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
"php-cs-fixer fix --ansi --dry-run --diff",
4646
"phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n",
4747
"phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
48-
"@test-no-coverage"
48+
"@test-no-coverage",
49+
"phpstan analyse --ansi"
4950
],
5051
"fix": [
5152
"php-cs-fixer fix --ansi"
@@ -79,7 +80,8 @@
7980
"phpunit/phpunit": ">=7.0",
8081
"tecnickcom/tcpdf": "^6.5",
8182
"symfony/process": "^4.4",
82-
"friendsofphp/php-cs-fixer": "^3.3"
83+
"friendsofphp/php-cs-fixer": "^3.3",
84+
"phpstan/phpstan-phpunit": "@stable"
8385
},
8486
"suggest": {
8587
"ext-zip": "Allows writing OOXML and ODF",

composer.lock

Lines changed: 118 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)