Commit 3437c571 by Carsten Brandt

phpdoc controller did not find some setters

fixes #3255
parent c259f4e0
...@@ -416,11 +416,11 @@ class PhpDocController extends Controller ...@@ -416,11 +416,11 @@ class PhpDocController extends Controller
$gets = $this->match( $gets = $this->match(
'#\* @return (?<type>[\w\\|\\\\\\[\\]]+)(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' . '#\* @return (?<type>[\w\\|\\\\\\[\\]]+)(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' .
'[\s\n]{2,}public function (?<kind>get)(?<name>\w+)\((?:,? ?\$\w+ ?= ?[^,]+)*\)#', '[\s\n]{2,}public function (?<kind>get)(?<name>\w+)\((?:,? ?\$\w+ ?= ?[^,]+)*\)#',
$class['content']); $class['content'], true);
$sets = $this->match( $sets = $this->match(
'#\* @param (?<type>[\w\\|\\\\\\[\\]]+) \$\w+(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' . '#\* @param (?<type>[\w\\|\\\\\\[\\]]+) \$\w+(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' .
'[\s\n]{2,}public function (?<kind>set)(?<name>\w+)\(\$\w+(?:, ?\$\w+ ?= ?[^,]+)*\)#', '[\s\n]{2,}public function (?<kind>set)(?<name>\w+)\(\$\w+(?:, ?\$\w+ ?= ?[^,]+)*\)#',
$class['content']); $class['content'], true);
// check for @property annotations in getter and setter // check for @property annotations in getter and setter
$properties = $this->match( $properties = $this->match(
'#\* @(?<kind>property) (?<type>[\w\\|\\\\\\[\\]]+)(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' . '#\* @(?<kind>property) (?<type>[\w\\|\\\\\\[\\]]+)(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' .
...@@ -500,15 +500,24 @@ class PhpDocController extends Controller ...@@ -500,15 +500,24 @@ class PhpDocController extends Controller
return [$className, $phpdoc]; return [$className, $phpdoc];
} }
protected function match($pattern, $subject) protected function match($pattern, $subject, $split = false)
{ {
$sets = []; $sets = [];
preg_match_all($pattern . 'suU', $subject, $sets, PREG_SET_ORDER); // split subject by double newlines because regex sometimes has problems with matching
foreach ($sets as &$set) // in the complete set of methods
foreach ($set as $i => $match) // example: yii\di\ServiceLocator setComponents() is not recognized in the whole but in
if (is_numeric($i) /*&& $i != 0*/) // a part of the class.
unset($set[$i]); $parts = $split ? explode("\n\n", $subject) : [$subject];
foreach($parts as $part) {
preg_match_all($pattern . 'suU', $part, $matches, PREG_SET_ORDER);
foreach ($matches as &$set) {
foreach ($set as $i => $match)
if (is_numeric($i) /*&& $i != 0*/)
unset($set[$i]);
$sets[] = $set;
}
}
return $sets; return $sets;
} }
......
...@@ -24,7 +24,7 @@ use yii\base\MailEvent; ...@@ -24,7 +24,7 @@ use yii\base\MailEvent;
* @property View $view View instance. Note that the type of this property differs in getter and setter. See * @property View $view View instance. Note that the type of this property differs in getter and setter. See
* [[getView()]] and [[setView()]] for details. * [[getView()]] and [[setView()]] for details.
* @property string $viewPath The directory that contains the view files for composing mail messages Defaults * @property string $viewPath The directory that contains the view files for composing mail messages Defaults
* to '@app/mail'. This property is read-only. * to '@app/mail'.
* *
* @author Paul Klimov <klimov.paul@gmail.com> * @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0 * @since 2.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment