Document $file in FileDeleteForm as LocalFile (not File)
authorUmherirrender <umherirrender_de.wp@web.de>
Wed, 4 Sep 2019 18:46:57 +0000 (20:46 +0200)
committerKrinkle <krinklemail@gmail.com>
Sun, 8 Sep 2019 04:02:20 +0000 (04:02 +0000)
Deletion is only possible for files on the local wiki, so this is always
a LocalFile. The static self::doDelete already requires a LocalFile.

Caught by PhanTypeMismatchArgument, to be enabled with I34d65fe3ff191.

Change-Id: Iee0774340208b493b075085485343e05f922751c

includes/FileDeleteForm.php
includes/page/ImagePage.php

index 1241e1c..e31f9d2 100644 (file)
@@ -36,18 +36,18 @@ class FileDeleteForm {
        private $title = null;
 
        /**
-        * @var File
+        * @var LocalFile
         */
        private $file = null;
 
        /**
-        * @var File
+        * @var LocalFile
         */
        private $oldfile = null;
        private $oldimage = '';
 
        /**
-        * @param File $file File object we're deleting
+        * @param LocalFile $file File object we're deleting
         */
        public function __construct( $file ) {
                $this->title = $file->getTitle();
@@ -451,9 +451,9 @@ class FileDeleteForm {
         * value was provided, does it correspond to an
         * existing, local, old version of this file?
         *
-        * @param File &$file
-        * @param File &$oldfile
-        * @param File $oldimage
+        * @param LocalFile &$file
+        * @param LocalFile &$oldfile
+        * @param LocalFile $oldimage
         * @return bool
         */
        public static function haveDeletableFile( &$file, &$oldfile, $oldimage ) {
index 2f6d4da..653e443 100644 (file)
@@ -987,6 +987,7 @@ EOT
                        parent::delete();
                        return;
                }
+               '@phan-var LocalFile $file';
 
                $deleter = new FileDeleteForm( $file );
                $deleter->execute();