Skip to content

Commit

Permalink
Add D9 deprecations configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthijs-va committed Oct 15, 2020
1 parent 1544c7a commit 925b5e2
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,38 @@ For an extension:
}
```

For an extension (to check only for D9 deprecations):

```json
"grumphp": {
"config-default-path": "vendor/digipolisgent/qa-drupal/configs/grumphp-extension-d9.yml"
}
```

Now install this package and its requirements by executing execute following command:
<pre><code>composer require --dev digipolisgent/qa-drupal:^1.0</code></pre>


# Configuration

**This section only applies to the site and extension configuration of GrumPHP.**

You can optionally extend or override the task configuration files by creating
them in your project root. For example: create a `phpcs.xml` or `phpcs.local.xml`
file to override the configuration provided by this package.

Note that Yaml and Neon files will be merged with your local files. So if you create
a `phpstan.neon` file it will be merged with the `phpstan.neon` file of this package.

To prevent this, create a `.env` or `.env.local` file and add following contents:
```
PHPSTAN_SKIP_PACKAGE_GLOBAL=1
```

The skip variable name is always the same `[FILENAME]_SKIP_[TYPE]`, wherin `[FILENAME]`
if the file name and `[TYPE]` is either:

- `LOCAL` to skip `phpstan.local.neon`.
- `PROJECT` to skip `phpstan.neon`.
- `PACKAGE_TYPE` to skip `phpstan-extension.neon` (if in an extension) of this package.
- `PACKAGE_GLOBAL` to skip `phpstan.neon` of this package.
16 changes: 16 additions & 0 deletions configs/grumphp-extension-d9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
parameters:
hooks_dir: ~
hooks_preset: local
stop_on_failure: true
hide_circumvention_tip: true
ascii: ~
tasks:
phpstan:
configuration: vendor/digipolisgent/qa-drupal/configs/phpstan-extension-d9.neon
triggered_by:
- php
- inc
- install
- module
- theme
- profile
14 changes: 14 additions & 0 deletions configs/phpstan-extension-d9.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
includes:
- vendor/mglaman/phpstan-drupal/extension.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon

parameters:
tipsOfTheDay: false
customRulesetUsed: true
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- '#^(?:(?!deprecated).)*$#'
excludes_analyse:
- 'tests/*'
drupal:
drupal_root: ../drupal
6 changes: 3 additions & 3 deletions configs/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
tipsOfTheDay: false
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- "#Unsafe usage of new static\\(\\)#"
- "#\\Drupal calls should be avoided in classes#"
- '#Unsafe usage of new static\(\)#'
- '#\Drupal calls should be avoided in classes#'
excludes_analyse:
- "*/node_modules/*"
- '*/node_modules/*'

0 comments on commit 925b5e2

Please sign in to comment.