* @ingroup Parser
*/
class MagicWordArray {
- /** @var array */
+ /** @var string[] */
public $names = [];
/** @var MagicWordFactory */
private $regex;
/**
- * @param array $names
+ * @param string[] $names
* @param MagicWordFactory|null $factory
*/
public function __construct( $names = [], MagicWordFactory $factory = null ) {
/**
* Add a number of magic words by name
*
- * @param array $names
+ * @param string[] $names
*/
public function addArray( $names ) {
$this->names = array_merge( $this->names, array_values( $names ) );
/**
* Get the base regex
- * @return array
+ * @return string[]
*/
public function getBaseRegex() {
if ( is_null( $this->baseRegex ) ) {
/**
* Get an unanchored regex that does not match parameters
- * @return array
+ * @return string[]
*/
public function getRegex() {
if ( is_null( $this->regex ) ) {
/**
* Get a regex for matching variables with parameters
*
- * @return string
+ * @return string[]
*/
public function getVariableRegex() {
return str_replace( "\\$1", "(.*?)", $this->getRegex() );
/**
* Get a regex anchored to the start of the string that does not match parameters
*
- * @return array
+ * @return string[]
*/
public function getRegexStart() {
$base = $this->getBaseRegex();
/**
* Get an anchored regex for matching variables with parameters
*
- * @return array
+ * @return string[]
*/
public function getVariableStartToEndRegex() {
$base = $this->getBaseRegex();
/**
* @since 1.20
- * @return array
+ * @return string[]
*/
public function getNames() {
return $this->names;