Skip to content

Commit

Permalink
chore: add phpstan strict type checking (#153)
Browse files Browse the repository at this point in the history
* chore: add phpstan strict type checking

chore: update lando tooling to better reflect usage

chore: only run phpcs and phpstan on latest php version

chore: update step name

feat: update phpstan to mirro upgrade_status results

feat: update phpstan to ignore errors from phpunit dynamic call

fix: remove booleansInConditions check

* feat: added baseline

* fix: update baseline file

* feat: ignore Drupal 12 deprecations

* fix: update baseline
  • Loading branch information
millnut authored Aug 6, 2024
1 parent 15c01d0 commit f2c9232
Show file tree
Hide file tree
Showing 5 changed files with 336 additions and 15 deletions.
15 changes: 3 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ on:
branches:
- '3.x'
schedule:
- cron: "0 7 * * *"
- cron: '0 7 * * *'
workflow_dispatch:

env:
LOCALGOV_DRUPAL_PROJECT: localgovdrupal/localgov-project
LOCALGOV_DRUPAL_PROJECT_PATH:

jobs:

build:
name: Install LocalGov Drupal
runs-on: ubuntu-latest
Expand All @@ -39,7 +38,6 @@ jobs:
- '8.3'

steps:

- name: Save git branch and git repo names to env if this is not a pull request
if: github.event_name != 'pull_request'
run: |
Expand Down Expand Up @@ -98,12 +96,9 @@ jobs:
drupal-version:
- '~10.0'
php-version:
- '8.1'
- '8.2'
- '8.3'

steps:

- name: Cached workspace
uses: actions/cache@v2
with:
Expand All @@ -123,7 +118,7 @@ jobs:
./bin/phpcs -p ${LOCALGOV_DRUPAL_PROJECT_PATH}
phpstan:
name: Deprecated code checks
name: Static analysis checks
needs: build
runs-on: ubuntu-latest

Expand All @@ -135,12 +130,9 @@ jobs:
drupal-version:
- '~10.0'
php-version:
- '8.1'
- '8.2'
- '8.3'

steps:

- name: Cached workspace
uses: actions/cache@v2
with:
Expand All @@ -154,7 +146,7 @@ jobs:
with:
php-version: ${{ matrix.php-version }}

- name: Run deprecated code checks
- name: Run PHPStan code checks
run: |
cd html
./bin/phpstan analyse -c ./phpstan.neon ./web/modules/contrib/localgov* ./web/profiles/contrib/localgov* ./web/themes/contrib/localgov*
Expand All @@ -176,7 +168,6 @@ jobs:
- '8.3'

steps:

- name: Clone Drupal container
uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .lando.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ tooling:
composer:
service: appserver
cmd: /usr/local/bin/composer
deprecated:
sca:
service: appserver
cmd: 'bash -c "/app/vendor/bin/phpstan analyse -c /app/phpstan.neon /app/web/profiles/contrib/localgov* /app/web/modules/contrib/localgov* /app/web/themes/contrib/localgov*"'
drush:
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"phpspec/prophecy-phpunit": "^2",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-strict-rules": "^1.5",
"squizlabs/php_codesniffer": "^3.6"
},
"conflict": {
Expand Down
Loading

0 comments on commit f2c9232

Please sign in to comment.