Merge "Clarify IDatabase docs for upsert() and replace()"
[lhc/web/wiklou.git] / includes / logging / LogFormatter.php
index 0ffe691..35bb451 100644 (file)
@@ -19,7 +19,7 @@
  *
  * @file
  * @author Niklas Laxström
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ * @license GPL-2.0-or-later
  * @since 1.19
  */
 use MediaWiki\Linker\LinkRenderer;
@@ -189,6 +189,7 @@ class LogFormatter {
         * to avoid formatting for any particular user.
         * @see getActionText()
         * @return string Plain text
+        * @return-taint tainted
         */
        public function getPlainActionText() {
                $this->plaintext = true;
@@ -377,7 +378,7 @@ class LogFormatter {
                                                // new key (5::duration/6::flags) or old key (0/optional 1)
                                                if ( $entry->isLegacy() ) {
                                                        $rawDuration = $parameters[0];
-                                                       $rawFlags = isset( $parameters[1] ) ? $parameters[1] : '';
+                                                       $rawFlags = $parameters[1] ?? '';
                                                } else {
                                                        $rawDuration = $parameters['5::duration'];
                                                        $rawFlags = $parameters['6::flags'];
@@ -436,6 +437,8 @@ class LogFormatter {
        /**
         * Gets the log action, including username.
         * @return string HTML
+        * phan-taint-check gets very confused by $this->plaintext, so disable.
+        * @return-taint onlysafefor_html
         */
        public function getActionText() {
                if ( $this->canView( LogPage::DELETED_ACTION ) ) {
@@ -639,7 +642,7 @@ class LogFormatter {
        /**
         * Helper to make a link to the page, taking the plaintext
         * value in consideration.
-        * @param Title $title The page
+        * @param Title|null $title The page
         * @param array $parameters Query parameters
         * @param string|null $html Linktext of the link as raw html
         * @throws MWException
@@ -702,6 +705,7 @@ class LogFormatter {
         * Helper method for displaying restricted element.
         * @param string $message
         * @return string HTML or wiki text
+        * @return-taint onlysafefor_html
         */
        protected function getRestrictedElement( $message ) {
                if ( $this->plaintext ) {
@@ -737,6 +741,12 @@ class LogFormatter {
                return $this->context->msg( $key );
        }
 
+       /**
+        * @param User $user
+        * @param int $toolFlags Combination of Linker::TOOL_LINKS_* flags
+        * @return string wikitext or html
+        * @return-taint onlysafefor_html
+        */
        protected function makeUserLink( User $user, $toolFlags = 0 ) {
                if ( $this->plaintext ) {
                        $element = $user->getName();
@@ -938,6 +948,10 @@ class LegacyLogFormatter extends LogFormatter {
                return $this->comment;
        }
 
+       /**
+        * @return string
+        * @return-taint onlysafefor_html
+        */
        protected function getActionMessage() {
                $entry = $this->entry;
                $action = LogPage::actionText(