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