mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-23 15:56:50 +00:00
A few very minor code cleanups
A bunch of very minor code cleanups I collected in my local dev environment the past months: * Remove dead code. * Make use of the ??= operator where possible. * Fix inconsistent @var syntax. Change-Id: Ie8de34f15503eb2bf0f6df855af55c212235dff3
This commit is contained in:
parent
5a86fd08ff
commit
50f533c9e9
|
@ -282,7 +282,7 @@ class SimpleCaptcha {
|
|||
public function showEditFormFields( EditPage $editPage, OutputPage $out ) {
|
||||
$out->enableOOUI();
|
||||
$page = $editPage->getArticle()->getPage();
|
||||
$key = $key = CacheKeyHelper::getKeyForPage( $page );
|
||||
$key = CacheKeyHelper::getKeyForPage( $page );
|
||||
if ( !isset( $this->activatedCaptchas[$key] ) ) {
|
||||
return;
|
||||
}
|
||||
|
@ -605,9 +605,7 @@ class SimpleCaptcha {
|
|||
}
|
||||
} else {
|
||||
// Get link changes in the slowest way known to man
|
||||
if ( $oldtext === null ) {
|
||||
$oldtext = $this->loadText( $title, $section );
|
||||
}
|
||||
$oldtext ??= $this->loadText( $title, $section );
|
||||
$oldLinks = $this->findLinks( $title, $oldtext );
|
||||
$newLinks = $this->findLinks( $title, $newtext );
|
||||
}
|
||||
|
@ -635,9 +633,7 @@ class SimpleCaptcha {
|
|||
);
|
||||
}
|
||||
// Custom regex checks. Reuse $oldtext if set above.
|
||||
if ( $oldtext === null ) {
|
||||
$oldtext = $this->loadText( $title, $section );
|
||||
}
|
||||
$oldtext ??= $this->loadText( $title, $section );
|
||||
|
||||
foreach ( $wgCaptchaRegexes as $regex ) {
|
||||
$newMatches = [];
|
||||
|
|
|
@ -190,9 +190,7 @@ class GenerateFancyCaptchas extends Maintenance {
|
|||
|
||||
$captchasGenerated = iterator_count( $iter );
|
||||
$filesToStore = [];
|
||||
/**
|
||||
* @var $fileInfo SplFileInfo
|
||||
*/
|
||||
/** @var SplFileInfo $fileInfo */
|
||||
foreach ( $iter as $fileInfo ) {
|
||||
if ( !$fileInfo->isFile() ) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue