parent::setup() should be parent::setUp() with a capital U.

CommentFileSizeAuthor
#2 3165392-2-setup-case.patch608 bytestr

Comments

TR created an issue. See original summary.

tr’s picture

Status: Active » Needs review
StatusFileSize
new608 bytes

  • TR committed 2118f93 on 8.x-3.x
    Issue #3165392 by TR: Wrong function name case in...
tr’s picture

Status: Needs review » Fixed

Committed.

jonathan1055’s picture

Did 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.

tr’s picture

Long 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.