diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2021-02-10 23:31:02 +0100 |
---|---|---|
committer | Umherirrender <umherirrender_de.wp@web.de> | 2021-02-11 00:13:52 +0000 |
commit | 8de3b7d324a2650c4c8d603738f0b92f04f33367 (patch) | |
tree | 33c0834bfff0c4878c9a31805db02de411de2d23 /includes/export/XmlDumpWriter.php | |
parent | 077b84664db0fa866abfd44c03b650e0048a3db8 (diff) | |
download | mediawikicore-8de3b7d324a2650c4c8d603738f0b92f04f33367.tar.gz mediawikicore-8de3b7d324a2650c4c8d603738f0b92f04f33367.zip |
Use static closures where safe to use
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.
Created by I25a17fb22b6b669e817317a0f45051ae9c608208
Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
Diffstat (limited to 'includes/export/XmlDumpWriter.php')
-rw-r--r-- | includes/export/XmlDumpWriter.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/includes/export/XmlDumpWriter.php b/includes/export/XmlDumpWriter.php index 300e79770542..4349fb1ae637 100644 --- a/includes/export/XmlDumpWriter.php +++ b/includes/export/XmlDumpWriter.php @@ -248,7 +248,7 @@ class XmlDumpWriter { if ( $row->page_is_redirect ) { $page = MediaWikiServices::getInstance()->getWikiPageFactory()->newFromTitle( $this->currentTitle ); $redirect = $this->invokeLenient( - function () use ( $page ) { + static function () use ( $page ) { return $page->getRedirectTarget(); }, 'Failed to get redirect target of page ' . $page->getId() @@ -399,7 +399,7 @@ class XmlDumpWriter { $out .= " <sha1/>\n"; } else { $sha1 = $this->invokeLenient( - function () use ( $rev ) { + static function () use ( $rev ) { return $rev->getSha1(); }, 'failed to determine sha1 for revision ' . $rev->getId() @@ -413,7 +413,7 @@ class XmlDumpWriter { if ( $contentMode === self::WRITE_CONTENT ) { /** @var Content $content */ $content = $this->invokeLenient( - function () use ( $rev ) { + static function () use ( $rev ) { return $rev->getContent( SlotRecord::MAIN, RevisionRecord::RAW ); }, 'Failed to load main slot content of revision ' . $rev->getId() @@ -470,7 +470,7 @@ class XmlDumpWriter { $textAttributes = [ 'bytes' => $this->invokeLenient( - function () use ( $slot ) { + static function () use ( $slot ) { return $slot->getSize(); }, 'failed to determine size for slot ' . $slot->getRole() . ' of revision ' @@ -480,7 +480,7 @@ class XmlDumpWriter { if ( $isV11 ) { $textAttributes['sha1'] = $this->invokeLenient( - function () use ( $slot ) { + static function () use ( $slot ) { return $slot->getSha1(); }, 'failed to determine sha1 for slot ' . $slot->getRole() . ' of revision ' @@ -490,7 +490,7 @@ class XmlDumpWriter { if ( $contentMode === self::WRITE_CONTENT ) { $content = $this->invokeLenient( - function () use ( $slot ) { + static function () use ( $slot ) { return $slot->getContent(); }, 'failed to load content for slot ' . $slot->getRole() . ' of revision ' |