Skip to content

Commit

Permalink
PHPOffice#634 : Enable PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Jun 18, 2021
1 parent 8db2fd5 commit 7a02afb
Show file tree
Hide file tree
Showing 205 changed files with 3,361 additions and 3,318 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,23 @@ jobs:
phpstan:
name: PHP Static Analysis
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0'] #, '8.1'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: ${{ matrix.php }}
extensions: gd, xml, zip
- uses: actions/checkout@v2

- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

#- name: Run phpstan
# run: ./vendor/bin/phpstan analyse -c phpstan.neon.dist
- name: Run phpstan
run: ./vendor/bin/phpstan analyse -c phpstan.neon.dist

phpunit:
name: PHPUnit
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"require-dev": {
"phpunit/phpunit": ">=7.0",
"phpdocumentor/phpdocumentor":"^2.0|^3.0",
"phpmd/phpmd": "2.*"
"phpmd/phpmd": "2.*",
"phpstan/phpstan": "^0.12.88"
},
"suggest": {
"ext-gd": "Required to add images"
Expand Down
29 changes: 29 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
parameters:
level: 6
bootstrapFiles:
- tests/bootstrap.php
paths:
- src
- tests
reportUnmatchedIgnoredErrors: false
ignoreErrors:
## Relative to PHPExcel
- '#^Call to static method createWriter\(\) on an unknown class PHPExcel_IOFactory\.#'
- '#^Call to static method stringFromColumnIndex\(\) on an unknown class PHPExcel_Cell\.#'
## Relative to Common
- '#^Parameter \#1 \$pValue of static method PhpOffice\\Common\\Drawing\:\:angleToDegrees\(\) expects int, string given\.#'
- '#^Parameter \#1 \$pValue of static method PhpOffice\\Common\\Drawing\:\:centimetersToPixels\(\) expects int, string given\.#'
- '#^Parameter \#1 \$pValue of static method PhpOffice\\Common\\Drawing\:\:degreesToAngle\(\) expects int, float given\.#'
- '#^Parameter \#1 \$pValue of static method PhpOffice\\Common\\Drawing\:\:emuToPixels\(\) expects int, float given\.#'
- '#^Parameter \#1 \$pValue of static method PhpOffice\\Common\\Drawing\:\:emuToPixels\(\) expects int, string given\.#'
- '#^Parameter \#1 \$pValue of static method PhpOffice\\Common\\Drawing\:\:pixelsToCentimeters\(\) expects int, float given\.#'
- '#^Parameter \#1 \$pValue of static method PhpOffice\\Common\\Drawing\:\:pixelsToEmu\(\) expects int, float given\.#'
## PHP 8.0 & GdImage
- '#^Parameter \#1 \$value of method PhpOffice\\PhpPresentation\\Shape\\Drawing\\Gd::setImageResource\(\) expects resource\|null, GdImage\|false given\.#'
- '#^Parameter \#1 \$image of function imagesx expects GdImage, resource given\.#'
- '#^Parameter \#1 \$image of function imagesy expects GdImage, resource given\.#'
- '#^Parameter \#1 \$image of function imagealphablending expects GdImage, resource given\.#'
- '#^Parameter \#1 \$image of function imagesavealpha expects GdImage, resource given\.#'

## Remove after remove ArrayObject
treatPhpDocTypesAsCertain: false
Loading

0 comments on commit 7a02afb

Please sign in to comment.