Skip to content

Commit

Permalink
wip: add psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Jul 24, 2023
1 parent 6429a86 commit 8610ffe
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ jobs:
name: Static analysis for php ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

env:
psalm-version: '5.13.1'

strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
os: ['ubuntu-latest']
include:
- php: '7.2'
psalm-version: '4.30'
- php: '7.3'
psalm-version: '4.30'

steps:
- name: Checkout code base
Expand All @@ -31,7 +39,7 @@ jobs:
tools: phpcs

- name: Setup dependencies
run: composer require -n --no-progress overtrue/phplint
run: composer require -n --no-progress overtrue/phplint vimeo/psalm:${{ matrix.psalm-version || env.psalm-version }}
&& git clone --single-branch --branch master https://github.com/Icinga/icingaweb2.git vendor/icingaweb2
&& git clone --single-branch --branch master https://github.com/Icinga/icingadb-web.git vendor/icingadb-web
&& git clone --single-branch --branch master https://github.com/Icinga/icingaweb2-module-director.git vendor/icingaweb2-module-director
Expand All @@ -47,5 +55,9 @@ jobs:
run: phpcs

- name: PHPStan
continue-on-error: true
uses: php-actions/phpstan@v3
if: success() || matrix.allow_failure

- name: Psalm
run: ./vendor/bin/psalm --output-format=github
27 changes: 27 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<psalm
errorLevel="3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
hideAllErrorsExceptPassedFiles="true"
hideExternalErrors="true"
>
<projectFiles>
<directory name="application" />
<directory name="library" />
</projectFiles>
<extraFiles>
<directory name="vendor" />
</extraFiles>
<issueHandlers>
<UndefinedFunction>
<errorLevel type="suppress">
<referencedFunction name="t" /> <!-- ignore t() error />-->
<referencedFunction name="mt" />
<referencedFunction name="mtp" />
<referencedFunction name="tp" />
</errorLevel>
</UndefinedFunction>
</issueHandlers>
</psalm>

0 comments on commit 8610ffe

Please sign in to comment.