Closed (fixed)
Project:
Drupal core
Version:
10.1.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
20 Nov 2022 at 11:11 UTC
Updated:
26 Mar 2023 at 19:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
spokjeComment #3
spokjeComment #4
spokjeThe attached level2.txt is the output of
vendor/bin/phpstan analyze --configuration=core/phpstan.neon.distafter setting PHPStan to level 2.We're down from the original
[ERROR] Found 9440 errorsto[ERROR] Found 9237 errors.There are a few questions raised however during this "exercise":
1) I didn't touch issues in the namespaces
Drupal\Component\Annotation\DoctrineandDrupal\Tests\Component\Annotation\Doctrine\Fixtures.Classes in these namespaces are all (almost) 1-on-1 copies of the Doctrine project.
Personally I think we should exclude this files from being scrutinized by PHPStan.
2) Not sure how to handle this one:
Comment #5
spokjeHmmm, we have seem to fix some level 1 issues along the way.
Comment #6
spokje...and PHPStan doesn't show all the changes at once.
I regenerated the baseline:
vendor/bin/phpstan analyze --configuration=core/phpstan.neon.dist --generate-baseline ./core/phpstan-baseline.neonComment #7
spokjeComment #8
mondrakeIt would be good to have a coding standard change to allow using non-FQCN in comments, rather
useimports on file headers and then just the class names. PHPStan fully supports that, and IMHO readibility would greatly improve.need to adjust the docs above and below, too.
shouldn't it be
\Drupal\Core\Config\Entity\ConfigEntityInterface?mmm sounds strange to refer a runtime trait to a test class...
this is losing information, could it be avoided?
kinda redundant, could it be just one of the two? actually with #3309010: Support PHPDoc Types in @param @var @return annotations all this could be vastly improved
comment should be wrapped on 80 chars
Comment #9
mondrakeNot a big brain, still I'd give some feedback :)
#4.1 IMHO we should do nothing. #3252386: Use PHP attributes instead of doctrine annotations would probably make these classes redundant at some point in time. Until then, I see no issue to keep these errors in a baseline (so that any change on that code in the meatime at least would not add errors).
#4.2 'callable' is a basic type, it should be all lowercase and no backslash in front.
Comment #10
spokjeComment #11
spokjeAddressed #8 and #9.
Comment #12
spokjeComment #13
spokjeComment #14
spokjeAdded the output of
$ vendor/bin/phpstan analyze --configuration=core/phpstan.neon.dist --xdebug --no-ansion lvl2 before and after the patch has been applied.Comment #15
mondrakeThis seems rather strange... does it fail if we totally remove the hint? One may wonder why we need to have a trait if $this is an implementation of an interface at this point?
Adding the PHPStan-1 tag as it seems this fixes some L1 baseline errors too.
Comment #16
spokjeThis seems rather strange... does it fail if we totally remove the hint?It fails PHPUnit:
Class 'CategorizingPluginManagerTrait' could not be found in 'D:\htdocs\drupal\core\lib\Drupal\Core\Plugin\CategorizingPluginManagerTrait.php'.Comment #17
mondrakeI suppose you meant PHPStan, I can't see how this could fail PHPUnit. What happens if we remove the typehint completely? What's strange to me is typehinting $this (which is the current state, not the change itself)
Comment #18
spokjeSorry about that, was actually running the trait in phpunit, which will of course fail... *facepalm*
Let's find out in the attached patch...
Comment #19
spokjeWorks for me :)
Comment #20
spokjeRerolled 3322743-18.patch in a new MR, let's get this reviewed for 10.1.x first, instead of rerolling 2 patches endlessly.
Comment #22
Manoj Raj.R commentedLooks good catch to me of all those rectifying the issues,spelling,typo etc..
Comment #23
mondrakeI see one last thing, commented in the MR.
Comment #24
spokjeComment #25
mondrakeSee inline comment.
Comment #26
spokjeDeath by tooling, see https://drupal.slack.com/archives/C51GNJG91/p1673375643741729
Comment #27
mondrakeSame here. https://www.drupal.org/project/drupal/issues/3191623#comment-14861657
I switched back to patch workflow.
Comment #28
spokjeI'm going to walk away from (at least this one) until this is fixed. Not in the mood to go back to 2010 tech :)
Comment #29
spokjeAaaaand...We're back in business.
Comment #31
smustgrave commentedRemoving credit from myself as I just rebased. Will mark after that runs.
Comment #32
smustgrave commentedNo issues LGTM
Comment #33
longwaveOne question about the session handler parameter but otherwise this looks ready to go.
Comment #34
spokjeComment #35
mondrakeImprovements of docs. LGTM
Comment #37
longwaveCommitted and pushed to 10.1.x, thanks!