forked from mongodb/mongo-php-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHPLIB-610: Psalm Integration (mongodb#973)
* Add base psalm configuration * Run psalm on GitHub Actions * Fix psalm errors * Use development version of psalm The upcoming release will include an updated callmap for the MongoDB classes. * Add unfixable error to psalm baseline * Enforce psalm errorLevel 1 for new code Existing errors are added to the baseline, meaning that new code needs to adhere to the strictest psalm level. * Run coding standards and static analysis checks on feature branches * Add contribution docs for psalm * Improve ChangeStreamIterator handling of wrapped iterator * Specify callable explicitly in ChangeStream * Make null coalesce within ternary more readable * Rewrite conditional to avoid suppressing psalm errors * Move psalm config to dist file * Add comment about ChangeStreamIterator::getInnerIterator
- Loading branch information
Showing
32 changed files
with
1,071 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: "Static Analysis" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "v*.*" | ||
- "master" | ||
- "feature/*" | ||
push: | ||
branches: | ||
- "v*.*" | ||
- "master" | ||
- "feature/*" | ||
|
||
jobs: | ||
psalm: | ||
name: "Psalm" | ||
runs-on: "ubuntu-20.04" | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- "7.4" | ||
driver-version: | ||
- "mongodb/mongo-php-driver@master" | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
|
||
- name: Setup cache environment | ||
id: extcache | ||
uses: shivammathur/cache-extensions@v1 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: "mongodb-${{ matrix.driver-version }}" | ||
key: "extcache-v1" | ||
|
||
- name: Cache extensions | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.extcache.outputs.dir }} | ||
key: ${{ steps.extcache.outputs.key }} | ||
restore-keys: ${{ steps.extcache.outputs.key }} | ||
|
||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
coverage: "none" | ||
extensions: "mongodb-${{ matrix.driver-version }}" | ||
php-version: "${{ matrix.php-version }}" | ||
tools: "cs2pr" | ||
|
||
- name: "Show driver information" | ||
run: "php --ri mongodb" | ||
|
||
- name: "Cache dependencies installed with Composer" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: "~/.composer/cache" | ||
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-composer-locked-" | ||
|
||
- name: "Install dependencies with Composer" | ||
run: "composer install --no-interaction --no-progress --no-suggest" | ||
|
||
- name: "Run Psalm" | ||
run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,7 @@ phpunit.xml | |
.phpcs-cache | ||
phpcs.xml | ||
|
||
# psalm | ||
psalm.xml | ||
|
||
mongocryptd.pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.