filerepo: Use @method LocalRepo::newFile() to document the return type

This avoids PhpStorm IDE warnings

Change-Id: I521aa1b1243ceabd40e7da18bf73ab95af7039cc
This commit is contained in:
Aaron Schulz 2019-08-29 16:03:43 -07:00 committed by Umherirrender
parent 3c30d10ba2
commit 2c87b59f35
6 changed files with 1 additions and 8 deletions

View 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 */

View 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

View file

@ -114,7 +114,6 @@ class ImportableUploadRevisionImporter implements UploadRevisionImporter {
$user
);
} else {
'@phan-var LocalFile $file';
$flags = 0;
$status = $file->upload(
$source,

View 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();

View 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 ) {

View 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,