fixed phpdoc type names

This commit is contained in:
Carsten Brandt
2016-02-25 20:24:07 +01:00
parent ef050338cc
commit 191f2a4943
18 changed files with 38 additions and 21 deletions

View File

@ -247,6 +247,7 @@ class PhpDocController extends Controller
$codeBlock = false; $codeBlock = false;
$tag = true; $tag = true;
$docLine = preg_replace('/\s+/', ' ', $docLine); $docLine = preg_replace('/\s+/', ' ', $docLine);
$docLine = $this->fixParamTypes($docLine);
} elseif (preg_match('/^(~~~|```)/', $docLine)) { } elseif (preg_match('/^(~~~|```)/', $docLine)) {
$codeBlock = !$codeBlock; $codeBlock = !$codeBlock;
$listIndent = ''; $listIndent = '';
@ -265,6 +266,20 @@ class PhpDocController extends Controller
} }
} }
protected function fixParamTypes($line)
{
return preg_replace_callback('~@(param|return) ([\w\\|]+)~i', function($matches) {
$types = explode('|', $matches[2]);
foreach($types as $i => $type) {
switch($type){
case 'int': $types[$i] = 'integer'; break;
case 'bool': $types[$i] = 'boolean'; break;
}
}
return '@' . $matches[1] . ' ' . implode('|', $types);
}, $line);
}
/** /**
* Fixes line spacing code style for properties and constants * Fixes line spacing code style for properties and constants
*/ */

View File

@ -134,7 +134,7 @@ class Security extends Component
* Verifies and decrypts data encrypted with [[encryptByPassword()]]. * Verifies and decrypts data encrypted with [[encryptByPassword()]].
* @param string $data the encrypted data to decrypt * @param string $data the encrypted data to decrypt
* @param string $password the password to use for decryption * @param string $password the password to use for decryption
* @return bool|string the decrypted data or false on authentication failure * @return boolean|string the decrypted data or false on authentication failure
* @see encryptByPassword() * @see encryptByPassword()
*/ */
public function decryptByPassword($data, $password) public function decryptByPassword($data, $password)
@ -147,7 +147,7 @@ class Security extends Component
* @param string $data the encrypted data to decrypt * @param string $data the encrypted data to decrypt
* @param string $inputKey the input to use for encryption and authentication * @param string $inputKey the input to use for encryption and authentication
* @param string $info optional context and application specific information, see [[hkdf()]] * @param string $info optional context and application specific information, see [[hkdf()]]
* @return bool|string the decrypted data or false on authentication failure * @return boolean|string the decrypted data or false on authentication failure
* @see encryptByKey() * @see encryptByKey()
*/ */
public function decryptByKey($data, $inputKey, $info = null) public function decryptByKey($data, $inputKey, $info = null)
@ -214,7 +214,7 @@ class Security extends Component
* @param string $secret the decryption password or key * @param string $secret the decryption password or key
* @param string $info context/application specific information, @see encrypt() * @param string $info context/application specific information, @see encrypt()
* *
* @return bool|string the decrypted data or false on authentication failure * @return boolean|string the decrypted data or false on authentication failure
* @throws InvalidConfigException on OpenSSL not loaded * @throws InvalidConfigException on OpenSSL not loaded
* @throws Exception on OpenSSL error * @throws Exception on OpenSSL error
* @see encrypt() * @see encrypt()

View File

@ -355,7 +355,7 @@ class MemCache extends Cache
/** /**
* Trims duration to 30 days (2592000 seconds). * Trims duration to 30 days (2592000 seconds).
* @param integer $duration the number of seconds * @param integer $duration the number of seconds
* @return int the duration * @return integer the duration
* @since 2.0.7 * @since 2.0.7
* @see http://php.net/manual/en/memcache.set.php * @see http://php.net/manual/en/memcache.set.php
* @see http://php.net/manual/en/memcached.expiration.php * @see http://php.net/manual/en/memcached.expiration.php

View File

@ -186,7 +186,7 @@ class Controller extends \yii\base\Controller
* ``` * ```
* *
* @param string $string the string to print * @param string $string the string to print
* @return int|boolean Number of bytes printed or false on error * @return integer|boolean Number of bytes printed or false on error
*/ */
public function stdout($string) public function stdout($string)
{ {
@ -211,7 +211,7 @@ class Controller extends \yii\base\Controller
* ``` * ```
* *
* @param string $string the string to print * @param string $string the string to print
* @return int|boolean Number of bytes printed or false on error * @return integer|boolean Number of bytes printed or false on error
*/ */
public function stderr($string) public function stderr($string)
{ {

View File

@ -133,7 +133,7 @@ class CacheController extends Controller
* ``` * ```
* *
* @param string $db id connection component * @param string $db id connection component
* @return int exit code * @return integer exit code
* @throws Exception * @throws Exception
* @throws \yii\base\InvalidConfigException * @throws \yii\base\InvalidConfigException
* *

View File

@ -368,7 +368,7 @@ class FixtureController extends Controller
/** /**
* Checks if needed to apply all fixtures. * Checks if needed to apply all fixtures.
* @param string $fixture * @param string $fixture
* @return bool * @return boolean
*/ */
public function needToApplyAll($fixture) public function needToApplyAll($fixture)
{ {

View File

@ -164,7 +164,7 @@ class HelpController extends Controller
/** /**
* Validates if the given class is a valid console controller class. * Validates if the given class is a valid console controller class.
* @param string $controllerClass * @param string $controllerClass
* @return bool * @return boolean
*/ */
protected function validateControllerClass($controllerClass) protected function validateControllerClass($controllerClass)
{ {

View File

@ -574,7 +574,7 @@ EOD;
* Finds out a line of the first non-char PHP token found * Finds out a line of the first non-char PHP token found
* *
* @param array $tokens * @param array $tokens
* @return int|string * @return integer|string
* @since 2.0.1 * @since 2.0.1
*/ */
protected function getLine($tokens) protected function getLine($tokens)

View File

@ -47,7 +47,7 @@ class ServeController extends Controller
* *
* @param string $address address to serve on. Either "host" or "host:port". * @param string $address address to serve on. Either "host" or "host:port".
* *
* @return int * @return integer
*/ */
public function actionIndex($address = 'localhost') public function actionIndex($address = 'localhost')
{ {

View File

@ -372,7 +372,7 @@ class Query extends Component implements QueryInterface
* Restores the value of select to make this query reusable. * Restores the value of select to make this query reusable.
* @param string|Expression $selectExpression * @param string|Expression $selectExpression
* @param Connection|null $db * @param Connection|null $db
* @return bool|string * @return boolean|string
*/ */
protected function queryScalar($selectExpression, $db) protected function queryScalar($selectExpression, $db)
{ {

View File

@ -213,7 +213,7 @@ class Transaction extends \yii\base\Object
} }
/** /**
* @return int The current nesting level of the transaction. * @return integer The current nesting level of the transaction.
* @since 2.0.8 * @since 2.0.8
*/ */
public function getLevel() public function getLevel()

View File

@ -356,7 +356,7 @@ class GridView extends BaseListView
/** /**
* Renders the caption element. * Renders the caption element.
* @return bool|string the rendered caption element or `false` if no caption element should be rendered. * @return boolean|string the rendered caption element or `false` if no caption element should be rendered.
*/ */
public function renderCaption() public function renderCaption()
{ {
@ -369,7 +369,7 @@ class GridView extends BaseListView
/** /**
* Renders the column group HTML. * Renders the column group HTML.
* @return bool|string the column group HTML or `false` if no column group should be rendered. * @return boolean|string the column group HTML or `false` if no column group should be rendered.
*/ */
public function renderColumnGroup() public function renderColumnGroup()
{ {

View File

@ -587,7 +587,7 @@ class BaseConsole
/** /**
* Returns true if the console is running on windows * Returns true if the console is running on windows
* @return bool * @return boolean
*/ */
public static function isRunningOnWindows() public static function isRunningOnWindows()
{ {
@ -691,7 +691,7 @@ class BaseConsole
* Prints a string to STDOUT. * Prints a string to STDOUT.
* *
* @param string $string the string to print * @param string $string the string to print
* @return int|boolean Number of bytes printed or false on error * @return integer|boolean Number of bytes printed or false on error
*/ */
public static function stdout($string) public static function stdout($string)
{ {
@ -702,7 +702,7 @@ class BaseConsole
* Prints a string to STDERR. * Prints a string to STDERR.
* *
* @param string $string the string to print * @param string $string the string to print
* @return int|boolean Number of bytes printed or false on error * @return integer|boolean Number of bytes printed or false on error
*/ */
public static function stderr($string) public static function stderr($string)
{ {

View File

@ -26,6 +26,7 @@ class BaseUrl
*/ */
public static $urlManager; public static $urlManager;
/** /**
* Creates a URL for the given route. * Creates a URL for the given route.
* *

View File

@ -317,7 +317,7 @@ class MessageFormatter extends Component
* @param array $token the token to parse * @param array $token the token to parse
* @param array $args arguments to replace * @param array $args arguments to replace
* @param string $locale the locale * @param string $locale the locale
* @return bool|string parsed token or false on failure * @return boolean|string parsed token or false on failure
* @throws \yii\base\NotSupportedException when unsupported formatting is used. * @throws \yii\base\NotSupportedException when unsupported formatting is used.
*/ */
private function parseToken($token, $args, $locale) private function parseToken($token, $args, $locale)

View File

@ -324,7 +324,7 @@ class FileValidator extends Validator
* Converts php.ini style size to bytes * Converts php.ini style size to bytes
* *
* @param string $sizeStr $sizeStr * @param string $sizeStr $sizeStr
* @return int * @return integer
*/ */
private function sizeToBytes($sizeStr) private function sizeToBytes($sizeStr)
{ {

View File

@ -535,7 +535,7 @@ class IpValidator extends Validator
* @param string $ip an IPv4 or IPv6 address * @param string $ip an IPv4 or IPv6 address
* @param integer $cidr * @param integer $cidr
* @param string $range subnet in CIDR format e.g. `10.0.0.0/8` or `2001:af::/64` * @param string $range subnet in CIDR format e.g. `10.0.0.0/8` or `2001:af::/64`
* @return bool * @return boolean
*/ */
private function inRange($ip, $cidr, $range) private function inRange($ip, $cidr, $range)
{ {

View File

@ -74,6 +74,7 @@ class DbSession extends MultiFieldSession
*/ */
public $sessionTable = '{{%session}}'; public $sessionTable = '{{%session}}';
/** /**
* Initializes the DbSession component. * Initializes the DbSession component.
* This method will initialize the [[db]] property to make sure it refers to a valid DB connection. * This method will initialize the [[db]] property to make sure it refers to a valid DB connection.