Commit 1b7e1cd0 by Carsten Brandt

Merge pull request #2605 branch 'feature' of https://github.com/mongosoft/yii2 into code-style

* 'feature' of https://github.com/mongosoft/yii2: returned back formatting language files code style. WHILE code style. FOR code style. FOREACH code style. operator IF @param, @var, @property and @return must declare types as boolean, integer, string, array or null short echo tags short array syntax Conflicts: extensions/apidoc/commands/RenderController.php extensions/apidoc/models/BaseDoc.php extensions/apidoc/models/Context.php extensions/apidoc/templates/bootstrap/Renderer.php extensions/apidoc/templates/bootstrap/layouts/guide.php extensions/apidoc/templates/bootstrap/layouts/main.php extensions/apidoc/templates/bootstrap/views/index.php extensions/apidoc/templates/html/Renderer.php extensions/apidoc/templates/offline/views/index.php extensions/apidoc/templates/offline/views/offline.php extensions/apidoc/templates/online/views/index.php extensions/elasticsearch/Connection.php extensions/redis/ActiveQuery.php framework/base/ErrorException.php framework/helpers/BaseFileHelper.php tests/unit/framework/helpers/FileHelperTest.php
parents 668dacba eb89a856
......@@ -141,7 +141,7 @@ class User extends ActiveRecord implements IdentityInterface
* Validates password
*
* @param string $password password to validate
* @return bool if password provided is valid for current user
* @return boolean if password provided is valid for current user
*/
public function validatePassword($password)
{
......
......@@ -92,7 +92,7 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface
* Validates password
*
* @param string $password password to validate
* @return bool if password provided is valid for current user
* @return boolean if password provided is valid for current user
*/
public function validatePassword($password)
{
......
......@@ -24,7 +24,7 @@ class PhpDocController extends Controller
public $defaultAction = 'property';
/**
* @var bool whether to update class docs directly. Setting this to false will just output docs
* @var boolean whether to update class docs directly. Setting this to false will just output docs
* for copy and paste.
*/
public $updateFiles = true;
......@@ -314,7 +314,7 @@ class PhpDocController extends Controller
// check if parent class has setter defined
$c = $className;
$parentSetter = false;
while($parent = get_parent_class($c)) {
while ($parent = get_parent_class($c)) {
if (method_exists($parent, 'set' . ucfirst($propName))) {
$parentSetter = true;
break;
......@@ -329,7 +329,7 @@ class PhpDocController extends Controller
// check if parent class has getter defined
$c = $className;
$parentGetter = false;
while($parent = get_parent_class($c)) {
while ($parent = get_parent_class($c)) {
if (method_exists($parent, 'set' . ucfirst($propName))) {
$parentGetter = true;
break;
......
......@@ -120,7 +120,7 @@ needs to be divisible by 10. In the rules you would define: `['attributeName', '
Then, your own method could look like this:
```php
public function myValidationMethod($attribute) {
if(($this->$attribute % 10) != 0) {
if (($this->$attribute % 10) != 0) {
$this->addError($attribute, 'cannot divide value by 10');
}
}
......
......@@ -252,7 +252,7 @@ if ($event === null) {
}
// the following is NOT allowed:
if(!$model && null === $event)
if (!$model && null === $event)
throw new Exception('test');
```
......
......@@ -25,7 +25,7 @@ use yii\widgets\ActiveForm;
$this->title = 'Posts';
?>
<!-- Separate PHP blocks are preferred for foreach, for, if etc. -->
<?php foreach($posts as $post): ?>
<?php foreach ($posts as $post): ?>
<!-- Note indentation level here. -->
<h2><?= Html::encode($post['title']) ?></h2>
<p><?= Html::encode($post['shortDescription']) ?></p>
......
......@@ -224,7 +224,7 @@ class ApiMarkdown extends GithubMarkdown
*
* @param string $content
* @param TypeDoc $context
* @param bool $paragraph
* @param boolean $paragraph
* @return string
*/
public static function process($content, $context = null, $paragraph = false)
......
......@@ -110,7 +110,7 @@ class Context extends Component
}
}
// inherit docs
foreach($this->classes as $class) {
foreach ($this->classes as $class) {
$this->inheritDocs($class);
}
// inherit properties, methods, contants and events to subclasses
......
......@@ -30,7 +30,7 @@ if (isset($readme)) {
</tr>
<?php
ksort($types);
foreach($types as $i => $class):
foreach ($types as $i => $class):
?>
<tr>
<td><?= $renderer->createTypeLink($class, $class, $class->name) ?></td>
......
......@@ -32,7 +32,7 @@ ArrayHelper::multisort($constants, 'name');
<tr>
<th>Constant</th><th>Value</th><th>Description</th><th>Defined By</th>
</tr>
<?php foreach($constants as $constant): ?>
<?php foreach ($constants as $constant): ?>
<tr<?= $constant->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $constant->name ?>">
<td><?= $constant->name ?><a name="<?= $constant->name ?>-detail"></a></td>
<td><?= $constant->value ?></td>
......
......@@ -16,12 +16,12 @@ if (empty($events)) {
ArrayHelper::multisort($events, 'name');
?>
<h2>Event Details</h2>
<?php foreach($events as $event): ?>
<?php foreach ($events as $event): ?>
<div class="detailHeader h3" id="<?= $event->name.'-detail' ?>">
<?= $event->name ?>
<span class="detailHeaderTag small">
event
<?php if(!empty($event->since)): ?>
<?php if (!empty($event->since)): ?>
(available since version <?= $event->since ?>)
<?php endif; ?>
</span>
......
......@@ -32,13 +32,13 @@ ArrayHelper::multisort($events, 'name');
<tr>
<th>Event</th><th>Type</th><th>Description</th><th>Defined By</th>
</tr>
<?php foreach($events as $event): ?>
<?php foreach ($events as $event): ?>
<tr<?= $event->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $event->name ?>">
<td><?= $renderer->createSubjectLink($event) ?></td>
<td><?= $renderer->createTypeLink($event->types) ?></td>
<td>
<?= ApiMarkdown::process($event->shortDescription, $event->definedBy, true) ?>
<?php if(!empty($event->since)): ?>
<?php if (!empty($event->since)): ?>
(available since version <?= $event->since ?>)
<?php endif; ?>
</td>
......
......@@ -21,7 +21,7 @@ ArrayHelper::multisort($methods, 'name');
?>
<h2>Method Details</h2>
<?php foreach($methods as $method): ?>
<?php foreach ($methods as $method): ?>
<div class="detailHeader h3" id="<?= $method->name . '()-detail' ?>">
<?= $method->name ?>()
......@@ -29,7 +29,7 @@ ArrayHelper::multisort($methods, 'name');
<?= $method->visibility ?>
method
<?php if (!empty($method->since)): ?>
(available since version <?php echo $method->since; ?>)
(available since version <?= $method->since ?>)
<?php endif; ?>
</span>
</div>
......@@ -38,22 +38,22 @@ ArrayHelper::multisort($methods, 'name');
<tr><td colspan="3">
<div class="signature2"><?= $renderer->renderMethodSignature($method) ?></div>
</td></tr>
<?php if(!empty($method->params) || !empty($method->return) || !empty($method->exceptions)): ?>
<?php foreach($method->params as $param): ?>
<?php if (!empty($method->params) || !empty($method->return) || !empty($method->exceptions)): ?>
<?php foreach ($method->params as $param): ?>
<tr>
<td class="paramNameCol"><?= $param->name ?></td>
<td class="paramTypeCol"><?= $renderer->createTypeLink($param->types) ?></td>
<td class="paramDescCol"><?= ApiMarkdown::process($param->description, $type) ?></td>
</tr>
<?php endforeach; ?>
<?php if(!empty($method->return)): ?>
<?php if (!empty($method->return)): ?>
<tr>
<td class="paramNameCol"><?= 'return'; ?></td>
<td class="paramTypeCol"><?= $renderer->createTypeLink($method->returnTypes); ?></td>
<td class="paramDescCol"><?= ApiMarkdown::process($method->return, $type); ?></td>
</tr>
<?php endif; ?>
<?php foreach($method->exceptions as $exception => $description): ?>
<?php foreach ($method->exceptions as $exception => $description): ?>
<tr>
<td class="paramNameCol"><?= 'throws' ?></td>
<td class="paramTypeCol"><?= $renderer->createTypeLink($exception) ?></td>
......
......@@ -36,8 +36,8 @@ if ($protected && count($type->getProtectedMethods()) == 0 || !$protected && cou
<?php
$methods = $type->methods;
ArrayHelper::multisort($methods, 'name');
foreach($methods as $method): ?>
<?php if($protected && $method->visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?>
foreach ($methods as $method): ?>
<?php if ($protected && $method->visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?>
<tr<?= $method->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $method->name ?>()">
<td><?= $renderer->createSubjectLink($method, $method->name.'()') ?></td>
<td><?= ApiMarkdown::process($method->shortDescription, $method->definedBy, true) ?></td>
......
......@@ -21,17 +21,17 @@ ArrayHelper::multisort($properties, 'name');
?>
<h2>Property Details</h2>
<?php foreach($properties as $property): ?>
<?php foreach ($properties as $property): ?>
<div class="detailHeader h3" id="<?= $property->name.'-detail' ?>">
<?= $property->name ?>
<span class="detailHeaderTag small">
<?= $property->visibility ?>
<?php if($property->getIsReadOnly()) echo ' <em>read-only</em> '; ?>
<?php if($property->getIsWriteOnly()) echo ' <em>write-only</em> '; ?>
<?php if ($property->getIsReadOnly()) echo ' <em>read-only</em> '; ?>
<?php if ($property->getIsWriteOnly()) echo ' <em>write-only</em> '; ?>
property
<?php if(!empty($property->since)): ?>
(available since version <?php echo $property->since; ?>)
<?php if (!empty($property->since)): ?>
(available since version <?= $property->since ?>)
<?php endif; ?>
</span>
</div>
......
......@@ -36,8 +36,8 @@ if ($protected && count($type->getProtectedProperties()) == 0 || !$protected &&
<?php
$properties = $type->properties;
ArrayHelper::multisort($properties, 'name');
foreach($properties as $property): ?>
<?php if($protected && $property->visibility == 'protected' || !$protected && $property->visibility != 'protected'): ?>
foreach ($properties as $property): ?>
<?php if ($protected && $property->visibility == 'protected' || !$protected && $property->visibility != 'protected'): ?>
<tr<?= $property->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $property->name ?>">
<td><?= $renderer->createSubjectLink($property) ?></td>
<td><?= $renderer->createTypeLink($property->types) ?></td>
......
......@@ -24,7 +24,7 @@ if (empty($see)) {
<div class="SeeAlso">
<h4>See Also</h4>
<ul>
<?php foreach($see as $ref): ?>
<?php foreach ($see as $ref): ?>
<li><?= \yii\apidoc\helpers\ApiMarkdown::process($ref, $object->definedBy, true) ?></li>
<?php endforeach; ?>
</ul>
......
......@@ -31,16 +31,16 @@ $renderer = $this->context;
?></h1>
<div id="nav">
<a href="index.html">All Classes</a>
<?php if(!($type instanceof InterfaceDoc) && !empty($type->properties)): ?>
<?php if (!($type instanceof InterfaceDoc) && !empty($type->properties)): ?>
| <a href="#properties">Properties</a>
<?php endif; ?>
<?php if(!empty($type->methods)): ?>
<?php if (!empty($type->methods)): ?>
| <a href="#methods">Methods</a>
<?php endif; ?>
<?php if($type instanceof ClassDoc && !empty($type->events)): ?>
<?php if ($type instanceof ClassDoc && !empty($type->events)): ?>
| <a href="#events">Events</a>
<?php endif; ?>
<?php if($type instanceof ClassDoc && !empty($type->constants)): ?>
<?php if ($type instanceof ClassDoc && !empty($type->constants)): ?>
| <a href="#constants">Constants</a>
<?php endif; ?>
</div>
......@@ -56,10 +56,10 @@ $renderer = $this->context;
<?php if ($type instanceof ClassDoc && !empty($type->interfaces)): ?>
<tr><th>Implements</th><td><?= $renderer->renderInterfaces($type->interfaces) ?></td></tr>
<?php endif; ?>
<?php if(!($type instanceof InterfaceDoc) && !empty($type->traits)): ?>
<?php if (!($type instanceof InterfaceDoc) && !empty($type->traits)): ?>
<tr><th>Uses Traits</th><td><?= $renderer->renderTraits($type->traits) ?></td></tr>
<?php endif; ?>
<?php if($type instanceof ClassDoc && !empty($type->subclasses)): ?>
<?php if ($type instanceof ClassDoc && !empty($type->subclasses)): ?>
<tr><th>Subclasses</th><td><?= $renderer->renderClasses($type->subclasses) ?></td></tr>
<?php endif; ?>
<?php if ($type instanceof InterfaceDoc && !empty($type->implementedBy)): ?>
......@@ -68,7 +68,7 @@ $renderer = $this->context;
<?php if ($type instanceof TraitDoc && !empty($type->usedBy)): ?>
<tr><th>Implemented by</th><td><?= $renderer->renderClasses($type->usedBy) ?></td></tr>
<?php endif; ?>
<?php if(!empty($type->since)): ?>
<?php if (!empty($type->since)): ?>
<tr><th>Available since version</th><td><?= $type->since ?></td></tr>
<?php endif; ?>
<?php if(($sourceUrl = $renderer->getSourceUrl($type)) !== null): ?>
......@@ -100,6 +100,6 @@ $renderer = $this->context;
<?= $this->render('@yii/apidoc/templates/html/views/propertyDetails', ['type' => $type]) ?>
<?= $this->render('@yii/apidoc/templates/html/views/methodDetails', ['type' => $type]) ?>
<?php if($type instanceof ClassDoc): ?>
<?php if ($type instanceof ClassDoc): ?>
<?= $this->render('@yii/apidoc/templates/html/views/eventDetails', ['type' => $type]) ?>
<?php endif; ?>
......@@ -23,7 +23,7 @@ use yii\apidoc\models\TraitDoc;
</tr>
<?php
ksort($types);
foreach($types as $i => $class):
foreach ($types as $i => $class):
?>
<tr>
<td><?= $this->context->typeLink($class, $class->name) ?></td>
......
......@@ -70,7 +70,7 @@ class NavBar extends Widget
*/
public $screenReaderToggleText = 'Toggle navigation';
/**
* @var bool whether the navbar content should be included in an inner div container which by default
* @var boolean whether the navbar content should be included in an inner div container which by default
* adds left and right padding. Set this to false for a 100% width navbar.
*/
public $renderInnerContainer = true;
......
......@@ -133,7 +133,7 @@ class Progress extends Widget
/**
* Generates a bar
* @param int $percent the percentage of the bar
* @param integer $percent the percentage of the bar
* @param string $label, optional, the label to display at the bar
* @param array $options the HTML attributes of the bar
* @return string the rendering result.
......
......@@ -23,7 +23,7 @@ use yii\helpers\Html;
</tr>
</thead>
<tbody>
<?php foreach($values as $name => $value): ?>
<?php foreach ($values as $name => $value): ?>
<tr>
<th style="width: 200px;"><?= Html::encode($name) ?></th>
<td style="overflow:auto"><?= Html::encode($value) ?></td>
......
......@@ -23,7 +23,7 @@ use yii\helpers\VarDumper;
</tr>
</thead>
<tbody>
<?php foreach($values as $name => $value): ?>
<?php foreach ($values as $name => $value): ?>
<tr>
<th style="width: 200px;"><?= Html::encode($name) ?></th>
<td><?= htmlspecialchars(VarDumper::dumpAsString($value), ENT_QUOTES|ENT_SUBSTITUTE, \Yii::$app->charset, true) ?></td>
......
......@@ -364,7 +364,7 @@ class Command extends Component
* @param $pattern
* @param $settings
* @param $mappings
* @param int $order
* @param integer $order
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html
*/
......
......@@ -29,7 +29,7 @@ class Connection extends Component
const EVENT_AFTER_OPEN = 'afterOpen';
/**
* @var bool whether to autodetect available cluster nodes on [[open()]]
* @var boolean whether to autodetect available cluster nodes on [[open()]]
*/
public $autodetectCluster = true;
/**
......@@ -244,8 +244,8 @@ class Connection extends Component
$body .= $data;
return mb_strlen($data, '8bit');
},
CURLOPT_HEADERFUNCTION => function ($curl, $data) use (&$headers) {
foreach (explode("\r\n", $data) as $row) {
CURLOPT_HEADERFUNCTION => function($curl, $data) use (&$headers) {
foreach(explode("\r\n", $data) as $row) {
if (($pos = strpos($row, ':')) !== false) {
$headers[strtolower(substr($row, 0, $pos))] = trim(substr($row, $pos + 1));
}
......
......@@ -18,7 +18,7 @@ namespace <?= $generator->ns ?>;
class <?= $generator->getControllerClass() ?> extends <?= '\\' . trim($generator->baseClass, '\\') . "\n" ?>
{
<?php foreach($generator->getActionIDs() as $action): ?>
<?php foreach ($generator->getActionIDs() as $action): ?>
public function action<?= Inflector::id2camel($action) ?>()
{
return $this->render('<?= $action ?>');
......
......@@ -45,7 +45,7 @@ class Connection extends Component
*/
public $hostname = 'localhost';
/**
* @var int the port to use for connecting to the redis server. Default port is 6379.
* @var integer the port to use for connecting to the redis server. Default port is 6379.
*/
public $port = 6379;
/**
......@@ -54,7 +54,7 @@ class Connection extends Component
*/
public $password;
/**
* @var int the redis database to use. This is an integer value starting from 0. Defaults to 0.
* @var integer the redis database to use. This is an integer value starting from 0. Defaults to 0.
*/
public $database = 0;
/**
......
......@@ -160,7 +160,7 @@ class Customer extends \yii\redis\ActiveRecord
*/
public static function active($query)
{
$query->andWhere(array('status' => 1));
$query->andWhere(['status' => 1]);
}
}
```
......
......@@ -338,7 +338,7 @@ class Query extends Component implements QueryInterface
/**
* Sets the value indicating whether to SELECT DISTINCT or not.
* @param bool $value whether to SELECT DISTINCT or not.
* @param boolean $value whether to SELECT DISTINCT or not.
* @return static the query object itself
*/
public function distinct($value = true)
......
......@@ -158,7 +158,7 @@ yii = (function ($) {
return {};
}
var qs = url.substring(pos + 1).split('&');
for(var i = 0, result = {}; i < qs.length; i++){
for (var i = 0, result = {}; i < qs.length; i++) {
qs[i] = qs[i].split('=');
result[decodeURIComponent(qs[i][0])] = decodeURIComponent(qs[i][1]);
}
......
......@@ -64,7 +64,7 @@ class ErrorException extends \ErrorException implements Arrayable
* Returns if error is one of fatal type.
*
* @param array $error error got from error_get_last()
* @return bool if error is one of fatal type
* @return boolean if error is one of fatal type
*/
public static function isFatalError($error)
{
......
......@@ -406,7 +406,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
/**
* Check whether the named relation has been populated with records.
* @param string $name the relation name (case-sensitive)
* @return bool whether relation has been populated with records.
* @return boolean whether relation has been populated with records.
*/
public function isRelationPopulated($name)
{
......
......@@ -396,7 +396,7 @@ class Query extends Component implements QueryInterface
/**
* Sets the value indicating whether to SELECT DISTINCT or not.
* @param bool $value whether to SELECT DISTINCT or not.
* @param boolean $value whether to SELECT DISTINCT or not.
* @return static the query object itself
*/
public function distinct($value = true)
......@@ -754,7 +754,7 @@ class Query extends Component implements QueryInterface
/**
* Appends a SQL statement using UNION operator.
* @param string|Query $sql the SQL statement to be appended using UNION
* @param bool $all TRUE if using UNION ALL and FALSE if using UNION
* @param boolean $all TRUE if using UNION ALL and FALSE if using UNION
* @return static the query object itself
*/
public function union($sql, $all = false)
......
......@@ -123,7 +123,7 @@ class BaseConsole
/**
* Scrolls whole page up by sending ANSI control code SU to the terminal.
* New lines are added at the bottom. This is not supported by ANSI.SYS used in windows.
* @param int $lines number of lines to scroll up
* @param integer $lines number of lines to scroll up
*/
public static function scrollUp($lines = 1)
{
......@@ -133,7 +133,7 @@ class BaseConsole
/**
* Scrolls whole page down by sending ANSI control code SD to the terminal.
* New lines are added at the top. This is not supported by ANSI.SYS used in windows.
* @param int $lines number of lines to scroll down
* @param integer $lines number of lines to scroll down
*/
public static function scrollDown($lines = 1)
{
......@@ -474,7 +474,7 @@ class BaseConsole
* colorcodes will just be removed (And %% will be transformed into %)
*
* @param string $string String to convert
* @param bool $colored Should the string be colored?
* @param boolean $colored Should the string be colored?
* @return string
*/
// TODO rework/refactor according to https://github.com/yiisoft/yii2/issues/746
......@@ -554,7 +554,7 @@ class BaseConsole
* - not tty consoles
*
* @param mixed $stream
* @return bool true if the stream supports ANSI colors, otherwise false.
* @return boolean true if the stream supports ANSI colors, otherwise false.
*/
public static function streamSupportsAnsiColors($stream)
{
......@@ -575,7 +575,7 @@ class BaseConsole
/**
* Usage: list($width, $height) = ConsoleHelper::getScreenSize();
*
* @param bool $refresh whether to force checking and not re-use cached size value.
* @param boolean $refresh whether to force checking and not re-use cached size value.
* This is useful to detect changing window size while the application is running but may
* not get up to date values on every terminal.
* @return array|boolean An array of ($width, $height) or false when it was not able to determine size.
......@@ -617,7 +617,7 @@ class BaseConsole
/**
* Gets input from STDIN and returns a string right-trimmed for EOLs.
*
* @param bool $raw If set to true, returns the raw string without trimming
* @param boolean $raw If set to true, returns the raw string without trimming
* @return string the string read from stdin
*/
public static function stdin($raw = false)
......@@ -898,7 +898,7 @@ class BaseConsole
* @param string|boolean $remove This can be `false` to leave the progress bar on screen and just print a newline.
* If set to `true`, the line of the progress bar will be cleared. This may also be a string to be displayed instead
* of the progress bar.
* @param bool $keepPrefix whether to keep the prefix that has been specified for the progressbar when progressbar
* @param boolean $keepPrefix whether to keep the prefix that has been specified for the progressbar when progressbar
* gets removed. Defaults to true.
* @see startProgress
* @see updateProgress
......
......@@ -147,7 +147,6 @@ class BaseFileHelper
* @param string $src the source directory
* @param string $dst the destination directory
* @param array $options options for directory copy. Valid options are:
* @throws \yii\base\InvalidParamException if unable to open directory
*
* - dirMode: integer, the permission to be set for newly copied directories. Defaults to 0775.
* - fileMode: integer, the permission to be set for newly copied files. Defaults to the current environment setting.
......@@ -178,6 +177,7 @@ class BaseFileHelper
* - afterCopy: callback, a PHP callback that is called after each sub-directory or file is successfully copied.
* The signature of the callback should be: `function ($from, $to)`, where `$from` is the sub-directory or
* file copied from, while `$to` is the copy target.
* @throws \yii\base\InvalidParamException if unable to open directory
*/
public static function copyDirectory($src, $dst, $options = [])
{
......
......@@ -332,7 +332,7 @@ class BaseInflector
* Converts an underscored or CamelCase word into a English
* sentence.
* @param string $words
* @param bool $ucAll whether to set all words to uppercase
* @param boolean $ucAll whether to set all words to uppercase
* @return string
*/
public static function titleize($words, $ucAll = false)
......@@ -415,7 +415,7 @@ class BaseInflector
/**
* Returns a human-readable string from $word
* @param string $word the string to humanize
* @param bool $ucAll whether to set all words to uppercase or not
* @param boolean $ucAll whether to set all words to uppercase or not
* @return string
*/
public static function humanize($word, $ucAll = false)
......@@ -455,7 +455,7 @@ class BaseInflector
* [[$transliteration]] array.
* @param string $string An arbitrary string to convert
* @param string $replacement The replacement to use for spaces
* @param bool $lowercase whether to return the string in lowercase or not. Defaults to `true`.
* @param boolean $lowercase whether to return the string in lowercase or not. Defaults to `true`.
* @return string The converted string.
*/
public static function slug($string, $replacement = '-', $lowercase = true)
......@@ -484,7 +484,7 @@ class BaseInflector
/**
* Converts number to its ordinal English form. For example, converts 13 to 13th, 2 to 2nd ...
* @param int $number the number to get its ordinal value
* @param integer $number the number to get its ordinal value
* @return string
*/
public static function ordinalize($number)
......
......@@ -259,7 +259,7 @@ class MessageFormatter extends Component
/**
* Tokenizes a pattern by separating normal text from replaceable patterns
* @param string $pattern patter to tokenize
* @return array|bool array of tokens or false on failure
* @return array|boolean array of tokens or false on failure
*/
private static function tokenizePattern($pattern)
{
......
......@@ -320,7 +320,7 @@ class YiiRequirementChecker
/**
* Normalizes requirement ensuring it has correct format.
* @param array $requirement raw requirement.
* @param int $requirementKey requirement key in the list.
* @param integer $requirementKey requirement key in the list.
* @return array normalized requirement.
*/
function normalizeRequirement($requirement, $requirementKey = 0)
......
......@@ -51,7 +51,7 @@
<table class="table table-bordered">
<tr><th>Name</th><th>Result</th><th>Required By</th><th>Memo</th></tr>
<?php foreach($requirements as $requirement): ?>
<?php foreach ($requirements as $requirement): ?>
<tr class="<?php echo $requirement['condition'] ? 'success' : ($requirement['mandatory'] ? 'error' : 'warning') ?>">
<td>
<?php echo $requirement['name'] ?>
......
......@@ -64,7 +64,7 @@ class AssetConverter extends Component implements AssetConverterInterface
* @param string $basePath asset base path and command working directory
* @param string $asset the name of the asset file
* @param string $result the name of the file to be generated by the converter command
* @return bool true on success, false on failure. Failures will be logged.
* @return boolean true on success, false on failure. Failures will be logged.
* @throws \yii\base\Exception when the command fails and YII_DEBUG is true.
* In production mode the error will be logged.
*/
......
......@@ -90,7 +90,7 @@ class LinkPager extends Widget
*/
public $lastPageLabel;
/**
* @var bool whether to register link tags in the HTML header for prev, next, first and last page.
* @var boolean whether to register link tags in the HTML header for prev, next, first and last page.
* Defaults to `false` to avoid conflicts when multiple pagers are used on one page.
* @see http://www.w3.org/TR/html401/struct/links.html#h-12.1.2
* @see registerLinkTags()
......
......@@ -27,7 +27,7 @@ class ElasticSearchTestCase extends TestCase
if (strpos($host, ':')===false) {
$host .= ':9200';
}
if(!@stream_socket_client($host, $errorNumber, $errorDescription, 0.5)) {
if (!@stream_socket_client($host, $errorNumber, $errorDescription, 0.5)) {
$this->markTestSkipped('No elasticsearch server running at ' . $params['dsn'] . ' : ' . $errorNumber . ' - ' . $errorDescription);
}
......@@ -35,7 +35,7 @@ class ElasticSearchTestCase extends TestCase
}
/**
* @param bool $reset whether to clean up the test database
* @param boolean $reset whether to clean up the test database
* @return Connection
*/
public function getConnection($reset = true)
......
......@@ -28,7 +28,7 @@ class RedisCacheTest extends CacheTestCase
$this->markTestSkipped('No redis server connection configured.');
}
$connection = new Connection($params);
if(!@stream_socket_client($connection->hostname . ':' . $connection->port, $errorNumber, $errorDescription, 0.5)) {
if (!@stream_socket_client($connection->hostname . ':' . $connection->port, $errorNumber, $errorDescription, 0.5)) {
$this->markTestSkipped('No redis server running at ' . $connection->hostname . ':' . $connection->port . ' : ' . $errorNumber . ' - ' . $errorDescription);
}
......
......@@ -21,7 +21,7 @@ abstract class RedisTestCase extends TestCase
$this->markTestSkipped('No redis server connection configured.');
}
$connection = new Connection($params);
if(!@stream_socket_client($connection->hostname . ':' . $connection->port, $errorNumber, $errorDescription, 0.5)) {
if (!@stream_socket_client($connection->hostname . ':' . $connection->port, $errorNumber, $errorDescription, 0.5)) {
$this->markTestSkipped('No redis server running at ' . $connection->hostname . ':' . $connection->port . ' : ' . $errorNumber . ' - ' . $errorDescription);
}
......@@ -31,7 +31,7 @@ abstract class RedisTestCase extends TestCase
}
/**
* @param bool $reset whether to clean up the test database
* @param boolean $reset whether to clean up the test database
* @return Connection
*/
public function getConnection($reset = true)
......
......@@ -25,7 +25,7 @@ class SchemaTest extends SphinxTestCase
$indexes = $schema->getIndexSchemas();
$this->assertEquals(count($schema->getIndexNames()), count($indexes));
foreach($indexes as $index) {
foreach ($indexes as $index) {
$this->assertInstanceOf('yii\sphinx\IndexSchema', $index);
}
}
......@@ -62,7 +62,7 @@ class SchemaTest extends SphinxTestCase
$schema = $this->getConnection()->schema;
foreach($values as $value) {
foreach ($values as $value) {
$this->assertEquals($value[1], $schema->getPdoType($value[0]));
}
fclose($fp);
......
......@@ -82,8 +82,8 @@ class SphinxTestCase extends TestCase
}
/**
* @param bool $reset whether to clean up the test database
* @param bool $open whether to open test database
* @param boolean $reset whether to clean up the test database
* @param boolean $open whether to open test database
* @return \yii\sphinx\Connection
*/
public function getConnection($reset = false, $open = true)
......@@ -119,8 +119,8 @@ class SphinxTestCase extends TestCase
}
/**
* @param bool $reset whether to clean up the test database
* @param bool $open whether to open and populate test database
* @param boolean $reset whether to clean up the test database
* @param boolean $open whether to open and populate test database
* @return \yii\db\Connection
*/
public function getDbConnection($reset = true, $open = true)
......
......@@ -22,7 +22,7 @@ use yii\caching\Cache;
abstract class CacheTestCase extends TestCase
{
/**
* @var int virtual time to be returned by mocked time() function.
* @var integer virtual time to be returned by mocked time() function.
* Null means normal time() behavior.
*/
public static $time;
......
......@@ -34,7 +34,7 @@ class DbCacheTest extends CacheTestCase
}
/**
* @param bool $reset whether to clean up the test database
* @param boolean $reset whether to clean up the test database
* @return \yii\db\Connection
*/
public function getConnection($reset = true)
......
......@@ -35,8 +35,8 @@ abstract class DatabaseTestCase extends TestCase
}
/**
* @param bool $reset whether to clean up the test database
* @param bool $open whether to open and populate test database
* @param boolean $reset whether to clean up the test database
* @param boolean $open whether to open and populate test database
* @return \yii\db\Connection
*/
public function getConnection($reset = true, $open = true)
......
......@@ -32,7 +32,7 @@ class SchemaTest extends DatabaseTestCase
$tables = $schema->getTableSchemas();
$this->assertEquals(count($schema->getTableNames()), count($tables));
foreach($tables as $table) {
foreach ($tables as $table) {
$this->assertInstanceOf('yii\db\TableSchema', $table);
}
}
......@@ -85,7 +85,7 @@ class SchemaTest extends DatabaseTestCase
/** @var Schema $schema */
$schema = $this->getConnection()->schema;
foreach($values as $value) {
foreach ($values as $value) {
$this->assertEquals($value[1], $schema->getPdoType($value[0]));
}
fclose($fp);
......
......@@ -28,7 +28,7 @@ class CubridSchemaTest extends SchemaTest
/** @var Schema $schema */
$schema = $this->getConnection()->schema;
foreach($values as $value) {
foreach ($values as $value) {
$this->assertEquals($value[1], $schema->getPdoType($value[0]));
}
fclose($fp);
......
......@@ -254,14 +254,14 @@ class FileHelperTest extends TestCase
public function testFindFilesExclude()
{
$basePath = $this->testFilePath . DIRECTORY_SEPARATOR;
$dirs = ['', 'one', 'one'.DIRECTORY_SEPARATOR.'two', 'three'];
$dirs = ['', 'one', 'one' . DIRECTORY_SEPARATOR . 'two', 'three'];
$files = array_fill_keys(array_map(function($n){return "a.$n";}, range(1,8)), 'file contents');
$tree = $files;
$root = $files;
$flat = [];
foreach($dirs as $dir) {
foreach($files as $fileName=>$contents) {
foreach ($dirs as $dir) {
foreach ($files as $fileName => $contents) {
$flat[] = rtrim($basePath.$dir,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$fileName;
}
if ($dir === '') continue;
......
......@@ -66,7 +66,7 @@ class TargetTest extends TestCase
$this->assertEquals(count($expected), count(static::$messages));
$i = 0;
foreach($expected as $e) {
foreach ($expected as $e) {
$this->assertEquals('test' . $e, static::$messages[$i++][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