diff --git a/build/controllers/PhpDocController.php b/build/controllers/PhpDocController.php
index a104dd5..760cb05 100644
--- a/build/controllers/PhpDocController.php
+++ b/build/controllers/PhpDocController.php
@@ -115,7 +115,7 @@ class PhpDocController extends Controller
if (trim($lines[1]) == '*' || substr(trim($lines[1]), 0, 3) == '* @') {
$this->stderr("[WARN] Class $className has no short description.\n", Console::FG_YELLOW, Console::BOLD);
}
- foreach($lines as $line) {
+ foreach ($lines as $line) {
if (substr(trim($line), 0, 9) == '* @since ') {
$seenSince = true;
} elseif (substr(trim($line), 0, 10) == '* @author ') {
@@ -138,7 +138,7 @@ class PhpDocController extends Controller
$newFileContent = [];
$n = count($fileContent);
- for($i = 0; $i < $n; $i++) {
+ for ($i = 0; $i < $n; $i++) {
if ($i > $start || $i < $docStart) {
$newFileContent[] = $fileContent[$i];
} else {
@@ -164,7 +164,7 @@ class PhpDocController extends Controller
{
$lines = explode("\n", $doc);
$n = count($lines);
- for($i = 0; $i < $n; $i++) {
+ for ($i = 0; $i < $n; $i++) {
$lines[$i] = rtrim($lines[$i]);
if (trim($lines[$i]) == '*' && trim($lines[$i + 1]) == '*') {
unset($lines[$i]);
@@ -184,7 +184,7 @@ class PhpDocController extends Controller
$lines = explode("\n", $doc);
$propertyPart = false;
$propertyPosition = false;
- foreach($lines as $i => $line) {
+ foreach ($lines as $i => $line) {
if (substr(trim($line), 0, 12) == '* @property ') {
$propertyPart = true;
} elseif ($propertyPart && trim($line) == '*') {
@@ -200,7 +200,7 @@ class PhpDocController extends Controller
}
}
$finalDoc = '';
- foreach($lines as $i => $line) {
+ foreach ($lines as $i => $line) {
$finalDoc .= $line . "\n";
if ($i == $propertyPosition) {
$finalDoc .= $properties;
diff --git a/docs/guide/controller.md b/docs/guide/controller.md
index bb78120..39b7f0f 100644
--- a/docs/guide/controller.md
+++ b/docs/guide/controller.md
@@ -89,7 +89,7 @@ class BlogController extends Controller
$post = Post::find($id);
$text = $post->text;
- if($version) {
+ if ($version) {
$text = $post->getHistory($version);
}
@@ -121,13 +121,13 @@ class BlogController extends Controller
public function actionUpdate($id)
{
$post = Post::find($id);
- if(!$post) {
+ if (!$post) {
throw new HttpException(404);
}
- if(\Yii::$app->request->isPost)) {
+ if (\Yii::$app->request->isPost)) {
$post->load($_POST);
- if($post->save()) {
+ if ($post->save()) {
$this->redirect(['view', 'id' => $post->id]);
}
}
diff --git a/docs/guide/upgrade-from-v1.md b/docs/guide/upgrade-from-v1.md
index f04e849..628cf54 100644
--- a/docs/guide/upgrade-from-v1.md
+++ b/docs/guide/upgrade-from-v1.md
@@ -179,7 +179,7 @@ $model->save();
$postTags = [];
$tagsCount = count($_POST['PostTag']);
-while($tagsCount-- > 0){
+while ($tagsCount-- > 0) {
$postTags[] = new PostTag(['post_id' => $model->id]);
}
Model::loadMultiple($postTags, $_POST);
diff --git a/docs/guide/view.md b/docs/guide/view.md
index 98e0140..ee469e6 100644
--- a/docs/guide/view.md
+++ b/docs/guide/view.md
@@ -28,7 +28,7 @@ as the corresponding key.
So the view for the action above should be in `views/site/index.php` and can be something like:
```php
-
Hello, =$username?>!
+
Hello, = $username ?>!
```
Instead of just scalar values you can pass anything else such as arrays or objects.
@@ -305,7 +305,7 @@ Then we're using it in `index.php` view where we display a list of users:
```php
render('_profile', [
'username' => $user->name,
'tagline' => $user->tagline,
diff --git a/framework/yii/BaseYii.php b/framework/yii/BaseYii.php
index 5d546bd..09312c3 100644
--- a/framework/yii/BaseYii.php
+++ b/framework/yii/BaseYii.php
@@ -515,7 +515,7 @@ class BaseYii
return self::$app->getI18n()->translate($category, $message, $params, $language ?: self::$app->language);
} else {
$p = [];
- foreach((array) $params as $name => $value) {
+ foreach ((array) $params as $name => $value) {
$p['{' . $name . '}'] = $value;
}
return ($p === []) ? $message : strtr($message, $p);
diff --git a/framework/yii/base/View.php b/framework/yii/base/View.php
index d3db27d..e7ea3fe 100644
--- a/framework/yii/base/View.php
+++ b/framework/yii/base/View.php
@@ -519,7 +519,7 @@ class View extends Component
$this->trigger(self::EVENT_END_PAGE);
$content = ob_get_clean();
- foreach(array_keys($this->assetBundles) as $bundle) {
+ foreach (array_keys($this->assetBundles) as $bundle) {
$this->registerAssetFiles($bundle);
}
echo strtr($content, [
@@ -549,7 +549,7 @@ class View extends Component
return;
}
$bundle = $this->assetBundles[$name];
- foreach($bundle->depends as $dep) {
+ foreach ($bundle->depends as $dep) {
$this->registerAssetFiles($dep);
}
$bundle->registerAssetFiles($this);
diff --git a/framework/yii/caching/RedisCache.php b/framework/yii/caching/RedisCache.php
index 3a40254..d31d66b 100644
--- a/framework/yii/caching/RedisCache.php
+++ b/framework/yii/caching/RedisCache.php
@@ -139,7 +139,7 @@ class RedisCache extends Cache
$response = $this->_connection->executeCommand('MGET', $keys);
$result = [];
$i = 0;
- foreach($keys as $key) {
+ foreach ($keys as $key) {
$result[$key] = $response[$i++];
}
return $result;
diff --git a/framework/yii/data/ActiveDataProvider.php b/framework/yii/data/ActiveDataProvider.php
index 012b7dd..ca7696f 100644
--- a/framework/yii/data/ActiveDataProvider.php
+++ b/framework/yii/data/ActiveDataProvider.php
@@ -170,7 +170,7 @@ class ActiveDataProvider extends BaseDataProvider
if (($sort = $this->getSort()) !== false && empty($sort->attributes) && $this->query instanceof ActiveQuery) {
/** @var Model $model */
$model = new $this->query->modelClass;
- foreach($model->attributes() as $attribute) {
+ foreach ($model->attributes() as $attribute) {
$sort->attributes[$attribute] = [
'asc' => [$attribute => Sort::ASC],
'desc' => [$attribute => Sort::DESC],
diff --git a/framework/yii/db/cubrid/Schema.php b/framework/yii/db/cubrid/Schema.php
index 68aa8ee..0b9d0f5 100644
--- a/framework/yii/db/cubrid/Schema.php
+++ b/framework/yii/db/cubrid/Schema.php
@@ -147,7 +147,7 @@ class Schema extends \yii\db\Schema
}
$foreignKeys = $this->db->pdo->cubrid_schema(\PDO::CUBRID_SCH_IMPORTED_KEYS, $table->name);
- foreach($foreignKeys as $key) {
+ foreach ($foreignKeys as $key) {
if (isset($table->foreignKeys[$key['FK_NAME']])) {
$table->foreignKeys[$key['FK_NAME']][$key['FKCOLUMN_NAME']] = $key['PKCOLUMN_NAME'];
} else {
@@ -230,7 +230,7 @@ class Schema extends \yii\db\Schema
$this->db->open();
$tables = $this->db->pdo->cubrid_schema(\PDO::CUBRID_SCH_TABLE);
$tableNames = [];
- foreach($tables as $table) {
+ foreach ($tables as $table) {
// do not list system tables
if ($table['TYPE'] != 0) {
$tableNames[] = $table['NAME'];
diff --git a/framework/yii/gii/generators/form/templates/action.php b/framework/yii/gii/generators/form/templates/action.php
index 7e2f876..adc2a59 100644
--- a/framework/yii/gii/generators/form/templates/action.php
+++ b/framework/yii/gii/generators/form/templates/action.php
@@ -17,7 +17,7 @@ public function action= Inflector::id2camel(trim(basename($generator->viewName
$model = new = $generator->modelClass ?>= empty($generator->scenarioName) ? "" : "(['scenario' => '{$generator->scenarioName}'])" ?>;
if ($model->load($_POST)) {
- if($model->validate()) {
+ if ($model->validate()) {
// form inputs are valid, do something here
return;
}
diff --git a/framework/yii/gii/views/default/view.php b/framework/yii/gii/views/default/view.php
index 3123b57..2104d75 100644
--- a/framework/yii/gii/views/default/view.php
+++ b/framework/yii/gii/views/default/view.php
@@ -34,19 +34,19 @@ foreach ($generator->templates as $name => $path) {
]); ?>
- =$this->renderFile($generator->formView(), [
+ = $this->renderFile($generator->formView(), [
'generator' => $generator,
'form' => $form,
- ]); ?>
- =$form->field($generator, 'template')->sticky()
+ ]) ?>
+ = $form->field($generator, 'template')->sticky()
->label('Code Template')
->dropDownList($templates)->hint('
Please select which set of the templates should be used to generated the code.
- '); ?>
+ ') ?>
= Html::submitButton('Preview', ['name' => 'preview', 'class' => 'btn btn-primary']) ?>
-
+
= Html::submitButton('Generate', ['name' => 'generate', 'class' => 'btn btn-success']) ?>
diff --git a/framework/yii/i18n/MessageFormatter.php b/framework/yii/i18n/MessageFormatter.php
index 3c165e6..7abff83 100644
--- a/framework/yii/i18n/MessageFormatter.php
+++ b/framework/yii/i18n/MessageFormatter.php
@@ -190,7 +190,7 @@ class MessageFormatter extends Component
$pattern = $parts[0];
$d = 0;
$stack = [];
- for($i = 1; $i < $c; $i++) {
+ for ($i = 1; $i < $c; $i++) {
if (preg_match('~^(\s*)([\d\w]+)(\s*)([},])(\s*)(.*)$~us', $parts[$i], $matches)) {
// if we are not inside a plural or select this is a message
if (!isset($stack[$d]) || $stack[$d] != 'plural' && $stack[$d] != 'select') {
@@ -257,7 +257,7 @@ class MessageFormatter extends Component
return [$pattern];
}
$tokens = [mb_substr($pattern, 0, $pos)];
- while(true) {
+ while (true) {
$open = mb_strpos($pattern, '{', $pos + 1);
$close = mb_strpos($pattern, '}', $pos + 1);
if ($open === false && $close === false) {
@@ -326,7 +326,7 @@ class MessageFormatter extends Component
$select = static::tokenizePattern($token[2]);
$c = count($select);
$message = false;
- for($i = 0; $i + 1 < $c; $i++) {
+ for ($i = 0; $i + 1 < $c; $i++) {
if (is_array($select[$i]) || !is_array($select[$i + 1])) {
return false;
}
@@ -352,7 +352,7 @@ class MessageFormatter extends Component
$c = count($plural);
$message = false;
$offset = 0;
- for($i = 0; $i + 1 < $c; $i++) {
+ for ($i = 0; $i + 1 < $c; $i++) {
if (is_array($plural[$i]) || !is_array($plural[$i + 1])) {
return false;
}
diff --git a/framework/yii/redis/Connection.php b/framework/yii/redis/Connection.php
index a5da73e..140f985 100644
--- a/framework/yii/redis/Connection.php
+++ b/framework/yii/redis/Connection.php
@@ -384,7 +384,7 @@ class Connection extends Component
private function parseResponse($command)
{
- if(($line = fgets($this->_socket)) === false) {
+ if (($line = fgets($this->_socket)) === false) {
throw new Exception("Failed to read from socket.\nRedis command was: " . $command);
}
$type = $line[0];
@@ -405,7 +405,7 @@ class Connection extends Component
$length = $line + 2;
$data = '';
while ($length > 0) {
- if(($block = fread($this->_socket, $line + 2)) === false) {
+ if (($block = fread($this->_socket, $line + 2)) === false) {
throw new Exception("Failed to read from socket.\nRedis command was: " . $command);
}
$data .= $block;
@@ -415,7 +415,7 @@ class Connection extends Component
case '*': // Multi-bulk replies
$count = (int) $line;
$data = [];
- for($i = 0; $i < $count; $i++) {
+ for ($i = 0; $i < $count; $i++) {
$data[] = $this->parseResponse($command);
}
return $data;
diff --git a/framework/yii/views/errorHandler/exception.php b/framework/yii/views/errorHandler/exception.php
index beebb29..4b90de9 100644
--- a/framework/yii/views/errorHandler/exception.php
+++ b/framework/yii/views/errorHandler/exception.php
@@ -367,8 +367,8 @@ pre .diff .change{
= $handler->renderCallStackItem($exception->getFile(), $exception->getLine(), null, null, 1) ?>
getTrace(), $length = count($trace); $i < $length; ++$i): ?>
- =$handler->renderCallStackItem(@$trace[$i]['file'] ?: null, @$trace[$i]['line'] ?: null,
- @$trace[$i]['class'] ?: null, @$trace[$i]['function'] ?: null, $i + 2); ?>
+ = $handler->renderCallStackItem(@$trace[$i]['file'] ?: null, @$trace[$i]['line'] ?: null,
+ @$trace[$i]['class'] ?: null, @$trace[$i]['function'] ?: null, $i + 2) ?>
diff --git a/tests/unit/framework/caching/RedisCacheTest.php b/tests/unit/framework/caching/RedisCacheTest.php
index b9df7a9..b064f78 100644
--- a/tests/unit/framework/caching/RedisCacheTest.php
+++ b/tests/unit/framework/caching/RedisCacheTest.php
@@ -24,11 +24,11 @@ class RedisCacheTest extends CacheTestCase
'dataTimeout' => 0.1,
];
$dsn = $config['hostname'] . ':' .$config['port'];
- if(!@stream_socket_client($dsn, $errorNumber, $errorDescription, 0.5)) {
+ if (!@stream_socket_client($dsn, $errorNumber, $errorDescription, 0.5)) {
$this->markTestSkipped('No redis server running at ' . $dsn .' : ' . $errorNumber . ' - ' . $errorDescription);
}
- if($this->_cacheInstance === null) {
+ if ($this->_cacheInstance === null) {
$this->_cacheInstance = new RedisCache($config);
}
return $this->_cacheInstance;
diff --git a/tests/unit/framework/helpers/ConsoleTest.php b/tests/unit/framework/helpers/ConsoleTest.php
index 6775b5a..ce6d3fe 100644
--- a/tests/unit/framework/helpers/ConsoleTest.php
+++ b/tests/unit/framework/helpers/ConsoleTest.php
@@ -73,7 +73,7 @@ class ConsoleTest extends TestCase
/* public function testScreenSize()
{
- for($i = 1; $i < 20; $i++) {
+ for ($i = 1; $i < 20; $i++) {
echo implode(', ', Console::getScreenSize(true)) . "\n";
ob_flush();
sleep(1);
diff --git a/tests/unit/framework/validators/UrlValidatorTest.php b/tests/unit/framework/validators/UrlValidatorTest.php
index 1323434..50baa9c 100644
--- a/tests/unit/framework/validators/UrlValidatorTest.php
+++ b/tests/unit/framework/validators/UrlValidatorTest.php
@@ -59,7 +59,7 @@ class UrlValidatorTest extends TestCase
public function testValidateWithIdn()
{
- if(!function_exists('idn_to_ascii')) {
+ if (!function_exists('idn_to_ascii')) {
$this->markTestSkipped('intl package required');
return;
}