Problem/Motivation
At #3417410: Set up to date the gitlab-ci.yml configuration We found we are not passing the validation checks for PHPStan.
An initial list of errors can be found at : https://git.drupalcode.org/issue/examples-3417410/-/jobs/699833
We would like to have the module Examples passing these checks with the final goal of having a clean pipeline to be used as base for the incoming examples or maintenance tasks of this module.
Proposed resolution
- Follow the instructions from https://www.drupal.org/docs/develop/development-tools/phpstan/getting-st... to have running PHPStan locally.
- Run the PHPStan against the Examples module.
- Fix all findings and make a MR with the fixes.
Notes: We don't have any phpstan.neon defined for this project, we might need to have one to adjust / ignore certain well known issues like Drupal Core does.
In addtion, ideally we are aiming for Level 8, but decide if it is really doable.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | initial-report.txt | 21.73 KB | jlbellido |
Issue fork examples-3417527
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 #2
jlbellidoComment #3
jlbellidoI'm attaching the initial report with all the issues detected before fixing anything:
Comment #5
jlbellidoHello,
I've created an initial MR fixing most of the errors reported. It still pending the following one:
I don't really know if by using Stub files we can fix it since it is a conditional class not always present (depending is Devel is required or not).
Comment #6
jlbellidoI've checked in deep the error from #5 but I think Stub files is not the right way because they are meant for other kind of scenarios according to (https://phpstan.org/user-guide/stub-files). Therefore I don't see other way to get rid of it than ignoring it via php-baseline.neon
I've added a new commit with this approach.
Now we are passing the PHPStan checks for Level 1:
I think this is now ready to be reviewed.
Comment #7
jlbellidoAfter #3417410: Set up to date the gitlab-ci.yml configuration has been merged, now we can see we are passing the PHPStan check within !32 if we compare it with the last run on the main project (https://git.drupalcode.org/project/examples/-/pipelines/85372)
Therefore I'd say this is fully ready to be reviewed by someone else.
Thanks!
Comment #8
avpadernoComment #10
avpadernoComment #13
avpaderno