is unused.
For some reason config factory passed but the property (defined in base class) is not used
Proposed resolution
Start use config factory passed to constructor
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 3325184-22-9.5.patch | 667 bytes | andypost |
| #5 | 3325184-5.patch | 1.32 KB | andypost |
Issue fork drupal-3325184
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 #3
spokjeNote: This deprecation was not done according to the documentation here: https://www.drupal.org/about/core/policies/core-change-policies/drupal-d..., but according to this comment by @alexpott here: https://git.drupalcode.org/project/drupal/-/merge_requests/3008#note_135753
If this is the accepted new way of deprecation, we need to update the mentioned documentation.
Comment #4
spokjeComment #5
andypostOther approach - form using
config()method from trait, so it just missing to assign the property defined in parent classComment #6
andypostIt looks cleaner
Comment #7
andypostit looks like bug so could be backported
Comment #9
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 200, following Review a patch or merge require as a guide.
Reviewing patch #5 looks like a good simple change. Guess it was a small phpstan error.
Feel good to mark.
Comment #10
xjmComment #11
xjmPHP 8.1 property promotion would have avoided this bug! That's out of scope, though...
I agree that the approach in #5 is cleaner.
I reviewed the parent class and confirmed that
FormBasealready includes documentation for the corresponding protected property:That's interesting and gave me pause for a moment, but it's also probably why no one noticed this bug before PHPStan.
The only hypothetical issue I could think of here would be if someone were relying on the unintended behavior of a null
CronForm::$configFactory, but that's extremely obscure and also against the above documented best practice, so I think this fix is also safe to backport.Trying to commit this but PHPStan is OOMing on me, so clicking save on my review comment in case I forget about this issue.
Comment #13
xjmI closed the MR for clarity.
I'm having PHPStan issues with committing this. First it was OOMing; now, I'm getting:
Comment #14
mondrakeIf #5 is the RTBCed patch, then I think this is practically a duplicate of #3323994: Fix PHPStan L1 errors "Constructor of class Foo has an unused parameter $bar".
Comment #16
xjmOkay sheesh. I was finally able to commit this by:
Then the full scan completed after a mere hour and twenty minutes (!!).
Apologies @mondrake; didn't see your comment before I pushed, because of the hour-and-twenty-minute thing.
Thanks everyone for working this. Setting PTBP for backport after the commit freeze, since this is technically a runtime bug.
Comment #17
mondrakeMaybe silly question, but why running PHPStan on the entire code base locally before committing? Aren't DrupalCI runs enough? Are you running all the PHPUnit tests locally as well? (that would require what... one day?)
Comment #18
xjm@mondrake, I'm forced to because the baseline is changing. On normal commits it runs only on changed files.
Comment #19
xjmQueued test runs against 10.0.x and 9.5.x in the hopes that this can be cherry-picked safely.
Comment #21
xjmCherry-picked to 10.0.x. NW for a 9.5.x backport, which will give me the chance to try @catch's suggestion of trying a lower number of parallel processes when committing the baseline change...
Comment #22
andypost9.5 has no phpstan so only fix
Comment #23
gaurav-mathur commentedPatch #22 applied successfully on drupal version 9.5.x and its working fine.
Thank you
Comment #24
longwave#22 is good to go.
Comment #26
xjm@gaurav-mathur, thank you for reviewing this issue!
The automated testing infrastructure tells us whether the change set still applies, so we do not need people to review that. It is also not sufficient criteria for the issue to be marked "Reviewed and Tested by the Community".
What we do need people to review is whether the solution completely fixes the problem without introducing other problems, and whether it's the best solution we can come up with. See the patch review guide for more information. When you do post a review, be sure to describe what you reviewed and how. This helps other reviewers understand why you considered the issue RTBC (and is considered for issue credit).
Also see the issue credit guidelines for more information on which kinds of contributions are credited.
In this case, I confirmed that the change was identical to the original patch, minus the change to the phpstan baseline because there is no phpstan in 9.5.x
Committed #22 to 9.5.x. Thanks!
Comment #27
xjmPublished the CR.
Comment #28
xjm...Actually, I deleted the CR, because it was about the previous approach with the deprecation.