diff --git a/includes/parser/PPCustomFrame_Hash.php b/includes/parser/PPCustomFrame_Hash.php index a92b104d5d2..29863458875 100644 --- a/includes/parser/PPCustomFrame_Hash.php +++ b/includes/parser/PPCustomFrame_Hash.php @@ -26,8 +26,13 @@ // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPCustomFrame_Hash extends PPFrame_Hash { + /** @var array */ public $args; + /** + * @param Preprocessor $preprocessor + * @param array $args + */ public function __construct( $preprocessor, $args ) { parent::__construct( $preprocessor ); $this->args = $args; @@ -58,7 +63,7 @@ class PPCustomFrame_Hash extends PPFrame_Hash { /** * @param int|string $index - * @return string|bool + * @return string|false */ public function getArgument( $index ) { return $this->args[$index] ?? false; diff --git a/includes/parser/PPDStack.php b/includes/parser/PPDStack.php index b9d796d7a05..301646b91ba 100644 --- a/includes/parser/PPDStack.php +++ b/includes/parser/PPDStack.php @@ -26,6 +26,7 @@ class PPDStack { /** @var PPDStackElement[] */ public $stack; + /** @var string|array */ public $rootAccum; /** @var string|array */ public $accum; @@ -58,7 +59,7 @@ class PPDStack { } /** - * @return bool|PPDPart + * @return false|PPDPart */ public function getCurrentPart() { if ( $this->top === false ) { diff --git a/includes/parser/PPDStackElement.php b/includes/parser/PPDStackElement.php index fe2b04e2236..88424309f36 100644 --- a/includes/parser/PPDStackElement.php +++ b/includes/parser/PPDStackElement.php @@ -57,8 +57,12 @@ class PPDStackElement { */ public $lineStart; + /** @var string */ public $partClass = PPDPart::class; + /** + * @param array $data + */ public function __construct( $data = [] ) { $class = $this->partClass; $this->parts = [ new $class ]; diff --git a/includes/parser/PPFrame_Hash.php b/includes/parser/PPFrame_Hash.php index 92a289681b7..0f8ffe67d43 100644 --- a/includes/parser/PPFrame_Hash.php +++ b/includes/parser/PPFrame_Hash.php @@ -40,21 +40,29 @@ class PPFrame_Hash implements PPFrame { * @var Title */ public $title; + + /** + * @var (string|false)[] + */ public $titleCache; /** * Hashtable listing templates which are disallowed for expansion in this frame, * having been encountered previously in parent frames. + * @var string[] */ public $loopCheckHash; /** * Recursion depth of this frame, top = 0 * Note that this is NOT the same as expansion depth in expand() + * @var int */ public $depth; + /** @var bool */ private $volatile = false; + /** @var int|null */ private $ttl = null; /** @@ -79,8 +87,8 @@ class PPFrame_Hash implements PPFrame { * Create a new child frame * $args is optionally a multi-root PPNode or array containing the template arguments * - * @param array|bool|PPNode_Hash_Array $args - * @param Title|bool $title + * @param array|false|PPNode_Hash_Array $args + * @param Title|false $title * @param int $indexOffset * @throws MWException * @return PPTemplateFrame_Hash @@ -500,8 +508,8 @@ class PPFrame_Hash implements PPFrame { } /** - * @param bool $level - * @return array|bool|string + * @param string|false $level + * @return array|false|string */ public function getPDBK( $level = false ) { if ( $level === false ) { diff --git a/includes/parser/PPNode_Hash_Array.php b/includes/parser/PPNode_Hash_Array.php index 3892616ac40..e9a47250f37 100644 --- a/includes/parser/PPNode_Hash_Array.php +++ b/includes/parser/PPNode_Hash_Array.php @@ -25,8 +25,12 @@ // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPNode_Hash_Array implements PPNode { + /** @var array */ public $value; + /** + * @param array $value + */ public function __construct( $value ) { $this->value = $value; } diff --git a/includes/parser/PPNode_Hash_Attr.php b/includes/parser/PPNode_Hash_Attr.php index 91ba69d8d3a..24a3e9849ff 100644 --- a/includes/parser/PPNode_Hash_Attr.php +++ b/includes/parser/PPNode_Hash_Attr.php @@ -25,8 +25,14 @@ // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPNode_Hash_Attr implements PPNode { - public $name, $value; - private $store, $index; + /** @var string */ + public $name; + /** @var string */ + public $value; + /** @var array */ + private $store; + /** @var int */ + private $index; /** * Construct an object using the data from $store[$index]. The rest of the diff --git a/includes/parser/PPNode_Hash_Text.php b/includes/parser/PPNode_Hash_Text.php index 182982f35f7..8e4eec7aaee 100644 --- a/includes/parser/PPNode_Hash_Text.php +++ b/includes/parser/PPNode_Hash_Text.php @@ -25,8 +25,12 @@ // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPNode_Hash_Text implements PPNode { + /** @var string */ public $value; - private $store, $index; + /** @var array */ + private $store; + /** @var int */ + private $index; /** * Construct an object using the data from $store[$index]. The rest of the diff --git a/includes/parser/PPNode_Hash_Tree.php b/includes/parser/PPNode_Hash_Tree.php index 55ea08f69ed..909b2665be8 100644 --- a/includes/parser/PPNode_Hash_Tree.php +++ b/includes/parser/PPNode_Hash_Tree.php @@ -25,22 +25,26 @@ // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPNode_Hash_Tree implements PPNode { + /** @var string */ public $name; /** * The store array for children of this node. It is "raw" in the sense that * nodes are two-element arrays ("descriptors") rather than PPNode_Hash_* * objects. + * @var array */ private $rawChildren; /** * The store array for the siblings of this node, including this node itself. + * @var array */ private $store; /** * The index into $this->store which contains the descriptor of this node. + * @var int */ private $index; diff --git a/includes/parser/PPTemplateFrame_Hash.php b/includes/parser/PPTemplateFrame_Hash.php index 4e827e31da6..7acb396804e 100644 --- a/includes/parser/PPTemplateFrame_Hash.php +++ b/includes/parser/PPTemplateFrame_Hash.php @@ -26,15 +26,23 @@ // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps class PPTemplateFrame_Hash extends PPFrame_Hash { - public $numberedArgs, $namedArgs, $parent; - public $numberedExpansionCache, $namedExpansionCache; + /** @var array */ + public $numberedArgs; + /** @var array */ + public $namedArgs; + /** @var PPFrame_Hash */ + public $parent; + /** @var array */ + public $numberedExpansionCache; + /** @var array */ + public $namedExpansionCache; /** * @param Preprocessor $preprocessor - * @param bool|PPFrame $parent + * @param false|PPFrame $parent * @param array $numberedArgs * @param array $namedArgs - * @param bool|Title $title + * @param false|Title $title */ public function __construct( $preprocessor, $parent = false, $numberedArgs = [], $namedArgs = [], $title = false @@ -62,7 +70,6 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { $s = 'tplframe{'; $first = true; $args = $this->numberedArgs + $this->namedArgs; - // @phan-suppress-next-line PhanTypeMismatchForeach FIXME args need better documentation foreach ( $args as $name => $value ) { if ( $first ) { $first = false; @@ -140,7 +147,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { /** * @param int $index - * @return string|bool + * @return string|false */ public function getNumberedArgument( $index ) { if ( !isset( $this->numberedArgs[$index] ) ) { @@ -158,7 +165,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { /** * @param string $name - * @return string|bool + * @return string|false */ public function getNamedArgument( $name ) { if ( !isset( $this->namedArgs[$name] ) ) { @@ -175,7 +182,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { /** * @param int|string $name - * @return string|bool + * @return string|false */ public function getArgument( $name ) { $text = $this->getNumberedArgument( $name );