allowSelfRedirect = $allowSelfRedirect; $this->newContent = $newContent; $this->originalContent = $originalContent; $this->title = $title; } public function checkConstraint(): string { if ( !$this->allowSelfRedirect && $this->newContent->isRedirect() && $this->newContent->getRedirectTarget()->equals( $this->title ) ) { // T29683 If the page already redirects to itself, don't warn. $currentTarget = $this->originalContent->getRedirectTarget(); if ( !$currentTarget || !$currentTarget->equals( $this->title ) ) { $this->result = self::CONSTRAINT_FAILED; return self::CONSTRAINT_FAILED; } } $this->result = self::CONSTRAINT_PASSED; return self::CONSTRAINT_PASSED; } public function getLegacyStatus(): StatusValue { $statusValue = StatusValue::newGood(); if ( $this->result === self::CONSTRAINT_FAILED ) { $statusValue->fatal( 'selfredirect' ); $statusValue->value = self::AS_SELF_REDIRECT; } return $statusValue; } }