/** * Constructs a PHP_CodeSniffer_CommentParser_ParameterElement. * * @param PHP_CodeSniffer_CommentParser_DocElement $previousElement The element * previous to * this one. * @param array $tokens The tokens * that make up * this element. * @param PHP_CodeSniffer_File $phpcsFile The file that * this element * is in. */ public function __construct($previousElement, $tokens, PHP_CodeSniffer_File $phpcsFile) { parent::__construct($previousElement, $tokens, 'param', $phpcsFile); // Handle special variable type: array(x => y). $type = strtolower($this->_type); if ($this->_varName === '=>' && strpos($type, 'array(') !== false) { $rawContent = $this->getRawContent(); $matches = array(); if (preg_match('/^(\\s+)(array\\(.*\\))(\\s+)(\\$\\S*)(\\s+)(.*)/i', $rawContent, $matches) !== 0) { // Process the sub elements correctly for this special case. if (count($matches) === 7) { $this->processSubElement('type', $matches[2], $matches[1]); $this->processSubElement('varName', $matches[4], $matches[3]); $this->processSubElement('comment', $matches[6], $matches[5]); } } } }
/** * Constructs a PHP_CodeSniffer_CommentParser_PairElement doc tag. * * @param PHP_CodeSniffer_CommentParser_DocElement $previousElement The element * before this * one. * @param array $tokens The tokens * that comprise * this element. * @param string $tag The tag that * this element * represents. * @param PHP_CodeSniffer_File $phpcsFile The file that * this element * is in. */ public function __construct($previousElement, $tokens, $tag, PHP_CodeSniffer_File $phpcsFile) { parent::__construct($previousElement, $tokens, $tag, $phpcsFile); }
/** * Constructs a PHP_CodeSniffer_CommentParser_PairElement doc tag. * * @param PHP_CodeSniffer_CommentParser_DocElement $previousElement The element before this one. * @param array $tokens The tokens that comprise this element. * @param string $tag The tag that this element represents. */ public function __construct($previousElement, $tokens, $tag) { parent::__construct($previousElement, $tokens, $tag); }