Commit 91965fd3 by Carsten Brandt

phpdoc formatting issues

parent 12d34849
...@@ -205,16 +205,18 @@ class PhpDocController extends Controller ...@@ -205,16 +205,18 @@ class PhpDocController extends Controller
$listIndent = false; $listIndent = false;
$indent = ''; $indent = '';
foreach($lines as $i => $line) { foreach($lines as $i => $line) {
if (preg_match('~^(\s+)/\*\*$~', $line, $matches)) { if (preg_match('~^(\s*)/\*\*$~', $line, $matches)) {
$docBlock = true; $docBlock = true;
$indent = $matches[1]; $indent = $matches[1];
} elseif (preg_match('~^(\s+)\*/~', $line)) { } elseif (preg_match('~^(\s+)\*+/~', $line)) {
if ($docBlock) { // could be the end of normal comment
$lines[$i] = $indent . ' */';
}
$docBlock = false; $docBlock = false;
$codeBlock = false; $codeBlock = false;
$listIndent = ''; $listIndent = '';
$lines[$i] = $indent . ' */';
} elseif ($docBlock) { } elseif ($docBlock) {
$docLine = trim($line, " \t*"); $docLine = str_replace("\t", ' ', rtrim(substr(ltrim($line), 2)));
if (empty($docLine)) { if (empty($docLine)) {
$listIndent = ''; $listIndent = '';
} elseif ($docLine[0] === '@') { } elseif ($docLine[0] === '@') {
...@@ -223,15 +225,16 @@ class PhpDocController extends Controller ...@@ -223,15 +225,16 @@ class PhpDocController extends Controller
$docLine = preg_replace('/\s+/', ' ', $docLine); $docLine = preg_replace('/\s+/', ' ', $docLine);
} elseif (preg_match('/^(~~~|```)/', $docLine)) { } elseif (preg_match('/^(~~~|```)/', $docLine)) {
$codeBlock = !$codeBlock; $codeBlock = !$codeBlock;
} elseif (preg_match('/^([0-9]+\.|-|\*|\+) /', $docLine, $matches)) { $listIndent = '';
} elseif (preg_match('/^(\s*)([0-9]+\.|-|\*|\+) /', $docLine, $matches)) {
$listIndent = str_repeat(' ', strlen($matches[0])); $listIndent = str_repeat(' ', strlen($matches[0]));
$lines[$i] = $indent . ' * ' . $docLine; $lines[$i] = $indent . ' * ' . $docLine;
continue; continue;
} }
if ($codeBlock) { if ($codeBlock) {
$lines[$i] = rtrim($indent . ' * ' . substr(ltrim($line), 2)); $lines[$i] = rtrim($indent . ' * ' . $docLine);
} else { } else {
$lines[$i] = rtrim($indent . ' * ' . $listIndent . $docLine); $lines[$i] = rtrim($indent . ' * ' . (empty($listIndent) ? $docLine : ($listIndent . ltrim($docLine))));
} }
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* @copyright Copyright (c) 2008 Yii Software LLC * @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
namespace yii; namespace yii;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
......
...@@ -171,7 +171,7 @@ class Widget extends Component implements ViewContextInterface ...@@ -171,7 +171,7 @@ class Widget extends Component implements ViewContextInterface
* - relative path (e.g. "index"): the actual view file will be looked for under [[viewPath]]. * - relative path (e.g. "index"): the actual view file will be looked for under [[viewPath]].
* *
* If the view name does not contain a file extension, it will use the default one `.php`. * If the view name does not contain a file extension, it will use the default one `.php`.
*
* @param string $view the view name. * @param string $view the view name.
* @param array $params the parameters (name-value pairs) that should be made available in the view. * @param array $params the parameters (name-value pairs) that should be made available in the view.
* @return string the rendering result. * @return string the rendering result.
......
...@@ -69,7 +69,7 @@ class DbCache extends Cache ...@@ -69,7 +69,7 @@ class DbCache extends Cache
* @var integer the probability (parts per million) that garbage collection (GC) should be performed * @var integer the probability (parts per million) that garbage collection (GC) should be performed
* when storing a piece of data in the cache. Defaults to 100, meaning 0.01% chance. * when storing a piece of data in the cache. Defaults to 100, meaning 0.01% chance.
* This number should be between 0 and 1000000. A value 0 meaning no GC will be performed at all. * This number should be between 0 and 1000000. A value 0 meaning no GC will be performed at all.
**/ */
public $gcProbability = 100; public $gcProbability = 100;
/** /**
......
...@@ -52,7 +52,7 @@ class FileCache extends Cache ...@@ -52,7 +52,7 @@ class FileCache extends Cache
* @var integer the probability (parts per million) that garbage collection (GC) should be performed * @var integer the probability (parts per million) that garbage collection (GC) should be performed
* when storing a piece of data in the cache. Defaults to 10, meaning 0.001% chance. * when storing a piece of data in the cache. Defaults to 10, meaning 0.001% chance.
* This number should be between 0 and 1000000. A value 0 means no GC will be performed at all. * This number should be between 0 and 1000000. A value 0 means no GC will be performed at all.
**/ */
public $gcProbability = 10; public $gcProbability = 10;
/** /**
* @var integer the permission to be set for newly created cache files. * @var integer the permission to be set for newly created cache files.
......
...@@ -82,7 +82,7 @@ class CaptchaAction extends Action ...@@ -82,7 +82,7 @@ class CaptchaAction extends Action
/** /**
* @var integer the offset between characters. Defaults to -2. You can adjust this property * @var integer the offset between characters. Defaults to -2. You can adjust this property
* in order to decrease or increase the readability of the captcha. * in order to decrease or increase the readability of the captcha.
**/ */
public $offset = -2; public $offset = -2;
/** /**
* @var string the TrueType font file. This can be either a file path or path alias. * @var string the TrueType font file. This can be either a file path or path alias.
......
...@@ -76,7 +76,6 @@ use yii\caching\Cache; ...@@ -76,7 +76,6 @@ use yii\caching\Cache;
* configuration like the following: * configuration like the following:
* *
* ~~~ * ~~~
* [
* 'components' => [ * 'components' => [
* 'db' => [ * 'db' => [
* 'class' => '\yii\db\Connection', * 'class' => '\yii\db\Connection',
...@@ -86,7 +85,6 @@ use yii\caching\Cache; ...@@ -86,7 +85,6 @@ use yii\caching\Cache;
* 'charset' => 'utf8', * 'charset' => 'utf8',
* ], * ],
* ], * ],
* ]
* ~~~ * ~~~
* *
* @property string $driverName Name of the DB driver. * @property string $driverName Name of the DB driver.
......
...@@ -350,7 +350,7 @@ class QueryBuilder extends \yii\base\Object ...@@ -350,7 +350,7 @@ class QueryBuilder extends \yii\base\Object
* Builds a SQL statement for removing a primary key constraint to an existing table. * Builds a SQL statement for removing a primary key constraint to an existing table.
* @param string $name the name of the primary key constraint to be removed. * @param string $name the name of the primary key constraint to be removed.
* @param string $table the table that the primary key constraint will be removed from. * @param string $table the table that the primary key constraint will be removed from.
* @return string the SQL statement for removing a primary key constraint from an existing table. * * @return string the SQL statement for removing a primary key constraint from an existing table.
*/ */
public function dropPrimaryKey($name, $table) public function dropPrimaryKey($name, $table)
{ {
......
...@@ -254,7 +254,7 @@ class QueryBuilder extends \yii\db\QueryBuilder ...@@ -254,7 +254,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
* @param string $name the name of the primary key constraint to be removed. * @param string $name the name of the primary key constraint to be removed.
* @param string $table the table that the primary key constraint will be removed from. * @param string $table the table that the primary key constraint will be removed from.
* @return string the SQL statement for removing a primary key constraint from an existing table. * @return string the SQL statement for removing a primary key constraint from an existing table.
* @throws NotSupportedException this is not supported by SQLite * * @throws NotSupportedException this is not supported by SQLite
*/ */
public function dropPrimaryKey($name, $table) public function dropPrimaryKey($name, $table)
{ {
......
...@@ -33,7 +33,7 @@ class RangeValidator extends Validator ...@@ -33,7 +33,7 @@ class RangeValidator extends Validator
/** /**
* @var boolean whether to invert the validation logic. Defaults to false. If set to true, * @var boolean whether to invert the validation logic. Defaults to false. If set to true,
* the attribute value should NOT be among the list of values defined via [[range]]. * the attribute value should NOT be among the list of values defined via [[range]].
**/ */
public $not = false; public $not = false;
/** /**
......
...@@ -29,7 +29,7 @@ class RegularExpressionValidator extends Validator ...@@ -29,7 +29,7 @@ class RegularExpressionValidator extends Validator
/** /**
* @var boolean whether to invert the validation logic. Defaults to false. If set to true, * @var boolean whether to invert the validation logic. Defaults to false. If set to true,
* the regular expression defined via [[pattern]] should NOT match the attribute value. * the regular expression defined via [[pattern]] should NOT match the attribute value.
**/ */
public $not = false; public $not = false;
/** /**
......
...@@ -32,13 +32,13 @@ class UrlValidator extends Validator ...@@ -32,13 +32,13 @@ class UrlValidator extends Validator
/** /**
* @var array list of URI schemes which should be considered valid. By default, http and https * @var array list of URI schemes which should be considered valid. By default, http and https
* are considered to be valid schemes. * are considered to be valid schemes.
**/ */
public $validSchemes = ['http', 'https']; public $validSchemes = ['http', 'https'];
/** /**
* @var string the default URI scheme. If the input doesn't contain the scheme part, the default * @var string the default URI scheme. If the input doesn't contain the scheme part, the default
* scheme will be prepended to it (thus changing the input). Defaults to null, meaning a URL must * scheme will be prepended to it (thus changing the input). Defaults to null, meaning a URL must
* contain the scheme part. * contain the scheme part.
**/ */
public $defaultScheme; public $defaultScheme;
/** /**
* @var boolean whether validation process should take into account IDN (internationalized * @var boolean whether validation process should take into account IDN (internationalized
......
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