Fix/suppress misc phan errors (#2)
[lhc/web/wiklou.git] / includes / specials / SpecialBlock.php
index 0cf790b..155d6a4 100644 (file)
@@ -308,18 +308,6 @@ class SpecialBlock extends FormSpecialPage {
                        'cssclass' => 'mw-block-confirm',
                ];
 
-               // Block Id if a block already exists matching the target
-               $a['BlockId'] = [
-                       'type' => 'hidden',
-                       'default' => '',
-               ];
-
-               // Has the form been submitted
-               $a['WasPosted'] = [
-                       'type' => 'hidden',
-                       'default' => '',
-               ];
-
                $this->maybeAlterFormDefaults( $a );
 
                // Allow extensions to add more fields
@@ -397,14 +385,14 @@ class SpecialBlock extends FormSpecialPage {
                                $fields['Expiry']['default'] = wfTimestamp( TS_RFC2822, $block->getExpiry() );
                        }
 
-                       $fields['BlockId']['default'] = $block->getId();
-
                        $this->alreadyBlocked = true;
                        $this->preErrors[] = [ 'ipb-needreblock', wfEscapeWikiText( (string)$block->getTarget() ) ];
                }
 
-               if ( $this->getRequest()->wasPosted() ) {
-                       $fields['WasPosted']['default'] = true;
+               if ( $this->alreadyBlocked || $this->getRequest()->wasPosted()
+                       || $this->getRequest()->getCheck( 'wpCreateAccount' )
+               ) {
+                       $this->getOutput()->addJsConfigVars( 'wgCreateAccountDirty', true );
                }
 
                # We always need confirmation to do HideUser
@@ -632,6 +620,7 @@ class SpecialBlock extends FormSpecialPage {
         *     the HTMLForm
         * @param WebRequest|null $request Optionally try and get data from a request too
         * @return array [ User|string|null, Block::TYPE_ constant|null ]
+        * @phan-return array{0:User|string|null,1:int|null}
         */
        public static function getTargetAndType( $par, WebRequest $request = null ) {
                $i = 0;