Skip to content
Snippets Groups Projects

Override regex for the see element.

1 file
+ 8
3
Compare changes
  • Side-by-side
  • Inline
+ 8
3
@@ -2134,7 +2134,7 @@ class Parser {
* Docblock array.
*/
protected function setSee(array &$docblock) {
$this->setProperty($docblock, 'see');
$this->setProperty($docblock, 'see', '/' . self::RE_TAG_START . 'see\s(.*?)\n/s');
}
/**
@@ -2180,13 +2180,18 @@ class Parser {
* Docblock array.
* @param string $property
* Property to set.
* @param string $regex
* Regex to use.
*/
protected function setProperty(array &$docblock, $property) {
protected function setProperty(array &$docblock, $property, $regex = NULL) {
$matches = [];
$tmp = [];
if (is_null($regex)) {
$regex = '/' . self::RE_TAG_START . $property . '\s(.*?)(?=\n' . self::RE_TAG_START . '|$)/s';
}
$docblock[$property] = '';
while (preg_match('/' . self::RE_TAG_START . $property . '\s(.*?)(?=\n' . self::RE_TAG_START . '|$)/s', $docblock['content'], $matches)) {
while (preg_match($regex, $docblock['content'], $matches)) {
// Replace the first occurrence as similar namespaces could be truncated.
$pos = strpos($docblock['content'], $matches[0]);
if ($pos !== FALSE) {
Loading