MediaWiki master
MissingCommentConstraint.php
Go to the documentation of this file.
1<?php
8
10
19
20 public function __construct(
21 private readonly string $section,
22 private readonly string $userComment,
23 ) {
24 }
25
26 public function checkConstraint(): PageEditStatus {
27 if ( $this->section === 'new' && $this->userComment === '' ) {
28 return PageEditStatus::newFatal( 'missingcommenttext' )
29 ->setValue( self::AS_TEXTBOX_EMPTY );
30 }
31 return PageEditStatus::newGood();
32 }
33
34}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:69
Abstract class for all constraints that can prevent edits.
Do not allow the user to post an empty comment (only used for new section)
__construct(private readonly string $section, private readonly string $userComment,)
Status returned by edit constraints and other page editing checks.
setValue(int $value)
Sets the value of the status.