filerepo: Use @method LocalRepo::newFile() to document the return type
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 29 Aug 2019 23:03:43 +0000 (16:03 -0700)
committerUmherirrender <umherirrender_de.wp@web.de>
Wed, 4 Sep 2019 18:12:23 +0000 (20:12 +0200)
This avoids PhpStorm IDE warnings

Change-Id: I521aa1b1243ceabd40e7da18bf73ab95af7039cc

includes/filerepo/LocalRepo.php
includes/filerepo/file/LocalFileMoveBatch.php
includes/import/ImportableUploadRevisionImporter.php
includes/revisiondelete/RevDelFileList.php
maintenance/deleteArchivedFiles.php
maintenance/importImages.php

index 8e3355c..84c0a61 100644 (file)
@@ -32,6 +32,7 @@ use Wikimedia\Rdbms\IDatabase;
  * in the wiki's own database. This is the most commonly used repository class.
  *
  * @ingroup FileRepo
+ * @method LocalFile|null newFile( $title, $time = false )
  */
 class LocalRepo extends FileRepo {
        /** @var callable */
index 137119d..21980b9 100644 (file)
@@ -126,10 +126,8 @@ class LocalFileMoveBatch {
        public function execute() {
                $repo = $this->file->repo;
                $status = $repo->newGood();
-               /** @var LocalFile $destFile */
                $destFile = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
                        ->newFile( $this->target );
-               '@phan-var LocalFile $destFile';
 
                $this->file->lock();
                $destFile->lock(); // quickly fail if destination is not available
index e5f4b57..4be13b0 100644 (file)
@@ -114,7 +114,6 @@ class ImportableUploadRevisionImporter implements UploadRevisionImporter {
                                $user
                        );
                } else {
-                       '@phan-var LocalFile $file';
                        $flags = 0;
                        $status = $file->upload(
                                $source,
index 334dccf..ca7bc04 100644 (file)
@@ -110,10 +110,8 @@ class RevDelFileList extends RevDelList {
        }
 
        public function doPostCommitUpdates( array $visibilityChangeMap ) {
-               /** @var LocalFile $file */
                $file = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
                        ->newFile( $this->title );
-               '@phan-var LocalFile $file';
                $file->purgeCache();
                $file->purgeDescription();
 
index 7b2ef17..cb95b68 100644 (file)
@@ -66,9 +66,7 @@ class DeleteArchivedFiles extends Maintenance {
                                continue;
                        }
 
-                       /** @var LocalFile $file */
                        $file = $repo->newFile( $row->fa_name );
-                       '@phan-var LocalFile $file';
                        try {
                                $file->lock();
                        } catch ( LocalFileLockError $e ) {
index 7f8e16a..4065978 100644 (file)
@@ -332,7 +332,6 @@ class ImportImages extends Maintenance {
 
                                if ( $this->hasOption( 'dry' ) ) {
                                        $this->output( "done.\n" );
-                                       // @phan-suppress-next-line PhanUndeclaredMethod
                                } elseif ( $image->recordUpload2(
                                        $archive->value,
                                        $summary,