Fix PHPStan per https://project.pages.drupalcode.org/gitlab_templates/jobs/phpstan/
Note that we have our own PHPStan config, set at level 2.
# Configuration file for PHPStan static code checking, see https://phpstan.org.
includes:
- phar://phpstan.phar/conf/bleedingEdge.neon
- phpstan-baseline.neon
parameters:
level: 2
paths:
- .
ignoreErrors:
# new static() is a best practice in Drupal, so we cannot fix that.
- "#^Unsafe usage of new static#"| Comment | File | Size | Author |
|---|---|---|---|
| #12 | DomainCommands.patch | 16.56 KB | agentrickard |
Issue fork domain-3458055
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #7
agentrickardI think I am going to dial back to level 1 PHPStan for now.Just seeing @webflo's updates. So lets see how that goes.
I added
reportUnmatchedIgnoredErrors: falseto mask these:No error to ignore is reported on line 65.I also accidentally broke tests.
Comment #8
webflo commentedI think level 2 is achievable. We should create a baseline and refactor it step by step. Maybe one submodule after another.
Comment #9
agentrickardYes. I fixed my earlier problems and have been fixing things in reverse alphabetical order. Trying to finish up domain_config_ui today.
Comment #11
agentrickardThis is all looking good. I have moved the remaining issues into phpstan-baseline.neon.
@webflo -- I think those can be fixed in a separate issue.
This could use a real-world test, but if it works for you, then I feel good about the state of the code and adding new maintainers.
Comment #12
agentrickardWe fixed everything except Drush, which should be a separate issue.
The attached patch did not work as documented here -- https://www.drush.org/12.x/dependency-injection/#create-method -- using Druah 12.4 on PHP 8.3.
That can be a separate issue.
Comment #14
webflo commented