Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
parent::setup()
should be parent::setUp()
with a capital U.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3165392-2-setup-case.patch | 608 bytes | TR |
|
Comments
Comment #2
TR CreditAttribution: TR commentedComment #4
TR CreditAttribution: TR commentedCommitted.
Comment #5
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedDid you just happen to spot the incorrect case by chance? Or was it shown in phpstan? I don't think this is covered by Drupal Coder yet, and if not I could write a sniff for Coder for this type of standard.
Comment #6
TR CreditAttribution: TR commentedLong but familiar story - I copied a test from core, modified it for one of my modules, then when I tested it on drupal.org I got all sorts of coding standards errors (which are suppressed for core tests but show up for the same tests in contrib). Also, my modified test failed to run because core used the wrong method visibility in the test base.
So as I went through the core queue to address these problems, I ran across #2858646: Methods called with incorrect case which is a 3.5 year old issue that points out the
parent:setup()
problem in core. I re-rolled that patch then decided to check Rules and my other projects to see if we had the same problem, and that's how I found this.I'm not sure it's useful to write a sniff just for this one method - the incorrect function name casing can happen for any function, and of course since PHP ignores case it won't fail. If it's possible to write a sniff to detect ANY incorrect function name casing, then that would be interesting, and I guess it would point out a lot of problems in core.