I decided to look at some examples, and I found one that gives me pause.[0]
if ( $i == 0 ) {
$this->servers[$i]['master'] = true;
} else {
$this->servers[$i]['replica'] = true;
}I don't know what's specifically going on here, but it's possible that only $this->servers[$i]['master'] or $this->servers[$i]['replica'] is ever set (rather than both being previously set to false, for example), so something like this could *possibly* break later code (that would be some brittle code, but worse things have been done): $this->servers[$i]['master'] = ( $i == 0 ); $this->servers[$i]['replica'] = !$this->servers[$i]['master']; I'm not sure how else to refactor this to avoid the pointless conditional failure. That said, thanks for the work to continue to improve our code base! —Trey [0] https://gerrit.wikimedia.org/g/mediawiki/core/+/6968592a9acd683cb7fee4b0f7d6056ae5987c89/includes/libs/rdbms/lbfactory/LBFactorySimple.php#62 Trey Jones Sr. Software Engineer, Search Platform Wikimedia Foundation On Mon, Feb 11, 2019 at 12:43 PM Daimona <[email protected]> wrote: > Hi, > All patches in the codesniffer repo have a sample run against mwcore set up > in CI. As can be seen in [0], the current version is triggered 13 times by > MW core. No idea about extensions, though. > Daimona > > [0]: > > https://integration.wikimedia.org/ci/job/mw-tools-codesniffer-mwcore-testrun/966/console > > _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
