Krinkle has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/341481 )
Change subject: Clean up get_class() in /includes/filerepo and /includes/resourceloader ...................................................................... Clean up get_class() in /includes/filerepo and /includes/resourceloader * get_class() -> __CLASS__ (same as self::class) * get_called_class() -> static::class * get_class($this) -> static::class Change-Id: Ic4f9b150ddc35e25f51297de7fc12410d421be4d --- M includes/filerepo/ForeignAPIRepo.php M includes/filerepo/ForeignDBRepo.php M includes/filerepo/ForeignDBViaLBRepo.php M includes/filerepo/NullRepo.php M includes/filerepo/file/File.php M includes/filerepo/file/LocalFile.php M includes/resourceloader/ResourceLoaderModule.php 7 files changed, 11 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/81/341481/1 diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index ca41718..43f1d21 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -571,7 +571,7 @@ $cache = ObjectCache::getMainWANInstance(); return $cache->getWithSetCallback( - $this->getLocalCacheKey( get_class( $this ), $target, md5( $url ) ), + $this->getLocalCacheKey( static::class, $target, md5( $url ) ), $cacheTTL, function ( $curValue, &$ttl ) use ( $url, $cache ) { $html = self::httpGet( $url, 'default', [], $mtime ); @@ -593,13 +593,13 @@ * @throws MWException */ function enumFiles( $callback ) { - throw new MWException( 'enumFiles is not supported by ' . get_class( $this ) ); + throw new MWException( 'enumFiles is not supported by ' . static::class ); } /** * @throws MWException */ protected function assertWritableRepo() { - throw new MWException( get_class( $this ) . ': write operations are not supported.' ); + throw new MWException( static::class . ': write operations are not supported.' ); } } diff --git a/includes/filerepo/ForeignDBRepo.php b/includes/filerepo/ForeignDBRepo.php index f49ef88..3e88508 100644 --- a/includes/filerepo/ForeignDBRepo.php +++ b/includes/filerepo/ForeignDBRepo.php @@ -138,7 +138,7 @@ } protected function assertWritableRepo() { - throw new MWException( get_class( $this ) . ': write operations are not supported.' ); + throw new MWException( static::class . ': write operations are not supported.' ); } /** diff --git a/includes/filerepo/ForeignDBViaLBRepo.php b/includes/filerepo/ForeignDBViaLBRepo.php index a9cd030..f83fd1c 100644 --- a/includes/filerepo/ForeignDBViaLBRepo.php +++ b/includes/filerepo/ForeignDBViaLBRepo.php @@ -100,7 +100,7 @@ } protected function assertWritableRepo() { - throw new MWException( get_class( $this ) . ': write operations are not supported.' ); + throw new MWException( static::class . ': write operations are not supported.' ); } public function getInfo() { diff --git a/includes/filerepo/NullRepo.php b/includes/filerepo/NullRepo.php index f2b7395..1c12e02 100644 --- a/includes/filerepo/NullRepo.php +++ b/includes/filerepo/NullRepo.php @@ -33,6 +33,6 @@ } protected function assertWritableRepo() { - throw new MWException( get_class( $this ) . ': write operations are not supported.' ); + throw new MWException( static::class . ': write operations are not supported.' ); } } diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 3b873ea..f7e85a8 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -1766,7 +1766,7 @@ * @throws MWException */ function readOnlyError() { - throw new MWException( get_class( $this ) . ': write operations are not supported' ); + throw new MWException( static::class . ': write operations are not supported' ); } /** diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index a1cb0a2..a633fd2 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -391,7 +391,7 @@ * @param int $flags */ function loadFromDB( $flags = 0 ) { - $fname = get_class( $this ) . '::' . __FUNCTION__; + $fname = static::class . '::' . __FUNCTION__; # Unconditionally set loaded=true, we don't want the accessors constantly rechecking $this->dataLoaded = true; @@ -416,7 +416,7 @@ * This covers fields that are sometimes not cached. */ protected function loadExtraFromDB() { - $fname = get_class( $this ) . '::' . __FUNCTION__; + $fname = static::class . '::' . __FUNCTION__; # Unconditionally set loaded=true, we don't want the accessors constantly rechecking $this->extraDataLoaded = true; @@ -1100,7 +1100,7 @@ */ public function nextHistoryLine() { # Polymorphic function name to distinguish foreign and local fetches - $fname = get_class( $this ) . '::' . __FUNCTION__; + $fname = static::class . '::' . __FUNCTION__; $dbr = $this->repo->getReplicaDB(); diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index d4dabe7..a2b4b1d 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -843,7 +843,7 @@ */ public function getDefinitionSummary( ResourceLoaderContext $context ) { return [ - '_class' => get_class( $this ), + '_class' => static::class, '_cacheEpoch' => $this->getConfig()->get( 'CacheEpoch' ), ]; } -- To view, visit https://gerrit.wikimedia.org/r/341481 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic4f9b150ddc35e25f51297de7fc12410d421be4d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits