diff --git a/apps/advanced/common/models/User.php b/apps/advanced/common/models/User.php
index 2ec5eb9..f3b39cc 100644
--- a/apps/advanced/common/models/User.php
+++ b/apps/advanced/common/models/User.php
@@ -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)
 	{
diff --git a/apps/basic/models/User.php b/apps/basic/models/User.php
index 7a6fcc0..fd0d0d4 100644
--- a/apps/basic/models/User.php
+++ b/apps/basic/models/User.php
@@ -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)
 	{
diff --git a/build/controllers/PhpDocController.php b/build/controllers/PhpDocController.php
index 28343cc..767f422 100644
--- a/build/controllers/PhpDocController.php
+++ b/build/controllers/PhpDocController.php
@@ -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;
diff --git a/docs/guide/validation.md b/docs/guide/validation.md
index fe0ddfb..1f517b2 100644
--- a/docs/guide/validation.md
+++ b/docs/guide/validation.md
@@ -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');
     }
 }
diff --git a/docs/internals/core-code-style.md b/docs/internals/core-code-style.md
index 79e5af6..29c687b 100644
--- a/docs/internals/core-code-style.md
+++ b/docs/internals/core-code-style.md
@@ -252,7 +252,7 @@ if ($event === null) {
 }
 
 // the following is NOT allowed:
-if(!$model && null === $event)
+if (!$model && null === $event)
 	throw new Exception('test');
 ```
 
diff --git a/docs/internals/view-code-style.md b/docs/internals/view-code-style.md
index 351516c..7a115b0 100644
--- a/docs/internals/view-code-style.md
+++ b/docs/internals/view-code-style.md
@@ -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>
diff --git a/extensions/apidoc/apidoc b/extensions/apidoc/apidoc
index 19ca841..706dd1b 100755
--- a/extensions/apidoc/apidoc
+++ b/extensions/apidoc/apidoc
@@ -15,7 +15,7 @@ $composerAutoload = [
 	__DIR__ . '/../../autoload.php', // script is installed as a composer binary
 ];
 $vendorPath = null;
-foreach($composerAutoload as $autoload) {
+foreach ($composerAutoload as $autoload) {
 	if (file_exists($autoload)) {
 		require($autoload);
 		$vendorPath = dirname($autoload);
@@ -27,7 +27,7 @@ $yiiDirs = [
 	__DIR__ . '/vendor/yiisoft/yii2', // standalone with "composer install" run
 	__DIR__ . '/../../yiisoft/yii2', // script is installed as a composer binary
 ];
-foreach($yiiDirs as $dir) {
+foreach ($yiiDirs as $dir) {
 	if (file_exists($dir . '/Yii.php')) {
 		require($dir . '/Yii.php');
 		break;
diff --git a/extensions/apidoc/helpers/ApiMarkdown.php b/extensions/apidoc/helpers/ApiMarkdown.php
index 4fff827..80ba5fa 100644
--- a/extensions/apidoc/helpers/ApiMarkdown.php
+++ b/extensions/apidoc/helpers/ApiMarkdown.php
@@ -70,7 +70,7 @@ class ApiMarkdown extends GithubMarkdown
 		if (!empty($language)) {
 			$block['language'] = $language;
 		}
-		for($i = $current + 1, $count = count($lines); $i < $count; $i++) {
+		for ($i = $current + 1, $count = count($lines); $i < $count; $i++) {
 			if (rtrim($line = $lines[$i]) !== $fence) {
 				$block['content'][] = $line;
 			} else {
@@ -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)
diff --git a/extensions/apidoc/helpers/PrettyPrinter.php b/extensions/apidoc/helpers/PrettyPrinter.php
index 288178d..9085cf0 100644
--- a/extensions/apidoc/helpers/PrettyPrinter.php
+++ b/extensions/apidoc/helpers/PrettyPrinter.php
@@ -38,4 +38,4 @@ class PrettyPrinter extends \phpDocumentor\Reflection\PrettyPrinter
 		$printer = new static();
 		return $printer->prettyPrintExpr($value);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/models/BaseDoc.php b/extensions/apidoc/models/BaseDoc.php
index cabbc69..bda7223 100644
--- a/extensions/apidoc/models/BaseDoc.php
+++ b/extensions/apidoc/models/BaseDoc.php
@@ -76,7 +76,7 @@ class BaseDoc extends Object
 			$this->phpDocContext = $docblock->getContext();
 
 			$this->tags = $docblock->getTags();
-			foreach($this->tags as $i => $tag) {
+			foreach ($this->tags as $i => $tag) {
 				if ($tag instanceof SinceTag) {
 					$this->since = $tag->getVersion();
 					unset($this->tags[$i]);
diff --git a/extensions/apidoc/models/ClassDoc.php b/extensions/apidoc/models/ClassDoc.php
index c317881..53cd58f 100644
--- a/extensions/apidoc/models/ClassDoc.php
+++ b/extensions/apidoc/models/ClassDoc.php
@@ -45,12 +45,12 @@ class ClassDoc extends TypeDoc
 		if (($subject = parent::findSubject($subjectName)) !== null) {
 			return $subject;
 		}
-		foreach($this->events as $name => $event) {
+		foreach ($this->events as $name => $event) {
 			if ($subjectName == $name) {
 				return $event;
 			}
 		}
-		foreach($this->constants as $name => $constant) {
+		foreach ($this->constants as $name => $constant) {
 			if ($subjectName == $name) {
 				return $constant;
 			}
@@ -64,7 +64,7 @@ class ClassDoc extends TypeDoc
 	public function getNativeEvents()
 	{
 		$events = [];
-		foreach($this->events as $name => $event) {
+		foreach ($this->events as $name => $event) {
 			if ($event->definedBy != $this->name) {
 				continue;
 			}
@@ -93,13 +93,13 @@ class ClassDoc extends TypeDoc
 		$this->isAbstract = $reflector->isAbstract();
 		$this->isFinal = $reflector->isFinal();
 
-		foreach($reflector->getInterfaces() as $interface) {
+		foreach ($reflector->getInterfaces() as $interface) {
 			$this->interfaces[] = ltrim($interface, '\\');
 		}
-		foreach($reflector->getTraits() as $trait) {
+		foreach ($reflector->getTraits() as $trait) {
 			$this->traits[] = ltrim($trait, '\\');
 		}
-		foreach($reflector->getConstants() as $constantReflector) {
+		foreach ($reflector->getConstants() as $constantReflector) {
 			$docblock = $constantReflector->getDocBlock();
 			if ($docblock !== null && count($docblock->getTagsByName('event')) > 0) {
 				$event = new EventDoc($constantReflector);
@@ -112,4 +112,4 @@ class ClassDoc extends TypeDoc
 			}
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/models/ConstDoc.php b/extensions/apidoc/models/ConstDoc.php
index 94a87bf..abca13f 100644
--- a/extensions/apidoc/models/ConstDoc.php
+++ b/extensions/apidoc/models/ConstDoc.php
@@ -33,4 +33,4 @@ class ConstDoc extends BaseDoc
 
 		$this->value = $reflector->getValue();
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/models/Context.php b/extensions/apidoc/models/Context.php
index cabe34e..41c1a6f 100644
--- a/extensions/apidoc/models/Context.php
+++ b/extensions/apidoc/models/Context.php
@@ -57,15 +57,15 @@ class Context extends Component
 		$reflection = new FileReflector($fileName, true);
 		$reflection->process();
 
-		foreach($reflection->getClasses() as $class) {
+		foreach ($reflection->getClasses() as $class) {
 			$class = new ClassDoc($class, $this, ['sourceFile' => $fileName]);
 			$this->classes[$class->name] = $class;
 		}
-		foreach($reflection->getInterfaces() as $interface) {
+		foreach ($reflection->getInterfaces() as $interface) {
 			$interface = new InterfaceDoc($interface, $this, ['sourceFile' => $fileName]);
 			$this->interfaces[$interface->name] = $interface;
 		}
-		foreach($reflection->getTraits() as $trait) {
+		foreach ($reflection->getTraits() as $trait) {
 			$trait = new TraitDoc($trait, $this, ['sourceFile' => $fileName]);
 			$this->traits[$trait->name] = $trait;
 		}
@@ -74,7 +74,7 @@ class Context extends Component
 	public function updateReferences()
 	{
 		// update all subclass references
-		foreach($this->classes as $class) {
+		foreach ($this->classes as $class) {
 			$className = $class->name;
 			while (isset($this->classes[$class->parentClass])) {
 				$class = $this->classes[$class->parentClass];
@@ -82,12 +82,12 @@ class Context extends Component
 			}
 		}
 		// update interfaces of subclasses
-		foreach($this->classes as $class) {
+		foreach ($this->classes as $class) {
 			$this->updateSubclassInferfacesTraits($class);
 		}
 		// update implementedBy and usedBy for interfaces and traits
-		foreach($this->classes as $class) {
-			foreach($class->traits as $trait) {
+		foreach ($this->classes as $class) {
+			foreach ($class->traits as $trait) {
 				if (isset($this->traits[$trait])) {
 					$trait = $this->traits[$trait];
 					$trait->usedBy[] = $class->name;
@@ -95,12 +95,12 @@ class Context extends Component
 					$class->methods = array_merge($trait->methods, $class->methods);
 				}
 			}
-			foreach($class->interfaces as $interface) {
+			foreach ($class->interfaces as $interface) {
 				if (isset($this->interfaces[$interface])) {
 					$this->interfaces[$interface]->implementedBy[] = $class->name;
 					if ($class->isAbstract) {
 						// add not implemented interface methods
-						foreach($this->interfaces[$interface]->methods as $method) {
+						foreach ($this->interfaces[$interface]->methods as $method) {
 							if (!isset($class->methods[$method->name])) {
 								$class->methods[$method->name] = $method;
 							}
@@ -110,15 +110,15 @@ 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
-		foreach($this->classes as $class) {
+		foreach ($this->classes as $class) {
 			$this->updateSubclassInheritance($class);
 		}
 		// add properties from getters and setters
-		foreach($this->classes as $class) {
+		foreach ($this->classes as $class) {
 			$this->handlePropertyFeature($class);
 		}
 
@@ -131,7 +131,7 @@ class Context extends Component
 	 */
 	protected function updateSubclassInferfacesTraits($class)
 	{
-		foreach($class->subclasses as $subclass) {
+		foreach ($class->subclasses as $subclass) {
 			$subclass = $this->classes[$subclass];
 			$subclass->interfaces = array_unique(array_merge($subclass->interfaces, $class->interfaces));
 			$subclass->traits = array_unique(array_merge($subclass->traits, $class->traits));
@@ -145,7 +145,7 @@ class Context extends Component
 	 */
 	protected function updateSubclassInheritance($class)
 	{
-		foreach($class->subclasses as $subclass) {
+		foreach ($class->subclasses as $subclass) {
 			$subclass = $this->classes[$subclass];
 			$subclass->events = array_merge($class->events, $subclass->events);
 			$subclass->constants = array_merge($class->constants, $subclass->constants);
@@ -203,7 +203,7 @@ class Context extends Component
 		if (!$this->isSubclassOf($class, 'yii\base\Object')) {
 			return;
 		}
-		foreach($class->getPublicMethods() as $name => $method) {
+		foreach ($class->getPublicMethods() as $name => $method) {
 			if ($method->isStatic) {
 				continue;
 			}
@@ -275,7 +275,7 @@ class Context extends Component
 	 */
 	private function paramsOptional($method, $number = 0)
 	{
-		foreach($method->params as $param) {
+		foreach ($method->params as $param) {
 			if (!$param->isOptional && $number-- <= 0) {
 				return false;
 			}
@@ -289,7 +289,7 @@ class Context extends Component
 	 */
 	private function getFirstNotOptionalParameter($method)
 	{
-		foreach($method->params as $param) {
+		foreach ($method->params as $param) {
 			if (!$param->isOptional) {
 				return $param;
 			}
@@ -309,7 +309,7 @@ class Context extends Component
 		if ($classA->name == $classB) {
 			return true;
 		}
-		while($classA->parentClass !== null && isset($this->classes[$classA->parentClass])) {
+		while ($classA->parentClass !== null && isset($this->classes[$classA->parentClass])) {
 			$classA = $this->classes[$classA->parentClass];
 			if ($classA->name == $classB) {
 				return true;
@@ -317,4 +317,4 @@ class Context extends Component
 		}
 		return false;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/models/EventDoc.php b/extensions/apidoc/models/EventDoc.php
index 17515f0..12edc98 100644
--- a/extensions/apidoc/models/EventDoc.php
+++ b/extensions/apidoc/models/EventDoc.php
@@ -34,7 +34,7 @@ class EventDoc extends ConstDoc
 			return;
 		}
 
-		foreach($this->tags as $i => $tag) {
+		foreach ($this->tags as $i => $tag) {
 			if ($tag->getName() == 'event') {
 				$eventTag = new ReturnTag('event', $tag->getContent(), $tag->getDocBlock(), $tag->getLocation());
 				$this->type = $eventTag->getType();
@@ -49,4 +49,4 @@ class EventDoc extends ConstDoc
 			}
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/models/FunctionDoc.php b/extensions/apidoc/models/FunctionDoc.php
index 2a482f1..2befe0a 100644
--- a/extensions/apidoc/models/FunctionDoc.php
+++ b/extensions/apidoc/models/FunctionDoc.php
@@ -45,17 +45,17 @@ class FunctionDoc extends BaseDoc
 
 		$this->isReturnByReference = $reflector->isByRef();
 
-		foreach($reflector->getArguments() as $arg) {
+		foreach ($reflector->getArguments() as $arg) {
 			$arg = new ParamDoc($arg, $context, ['sourceFile' => $this->sourceFile]);
 			$this->params[$arg->name] = $arg;
 		}
 
-		foreach($this->tags as $i => $tag) {
+		foreach ($this->tags as $i => $tag) {
 			if ($tag instanceof ThrowsTag) {
 				$this->exceptions[$tag->getType()] = $tag->getDescription();
 				unset($this->tags[$i]);
 			} elseif ($tag instanceof PropertyTag) {
-				 // ignore property tag
+				// ignore property tag
 			} elseif ($tag instanceof ParamTag) {
 				$paramName = $tag->getVariableName();
 				if (!isset($this->params[$paramName]) && $context !== null) {
diff --git a/extensions/apidoc/models/InterfaceDoc.php b/extensions/apidoc/models/InterfaceDoc.php
index 2b9699f..32cbd83 100644
--- a/extensions/apidoc/models/InterfaceDoc.php
+++ b/extensions/apidoc/models/InterfaceDoc.php
@@ -33,15 +33,15 @@ class InterfaceDoc extends TypeDoc
 			return;
 		}
 
-		foreach($reflector->getParentInterfaces() as $interface) {
+		foreach ($reflector->getParentInterfaces() as $interface) {
 			$this->parentInterfaces[] = ltrim($interface, '\\');
 		}
 
-		foreach($this->methods as $method) {
+		foreach ($this->methods as $method) {
 			$method->isAbstract = true;
 		}
 
 		// interface can not have properties
 		$this->properties = null;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/models/ParamDoc.php b/extensions/apidoc/models/ParamDoc.php
index b1e1007..69af05e 100644
--- a/extensions/apidoc/models/ParamDoc.php
+++ b/extensions/apidoc/models/ParamDoc.php
@@ -53,4 +53,4 @@ class ParamDoc extends Object
 		}
 		$this->isPassedByReference = $reflector->isByRef();
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/models/PropertyDoc.php b/extensions/apidoc/models/PropertyDoc.php
index fc7d99d..0fbb6ca 100644
--- a/extensions/apidoc/models/PropertyDoc.php
+++ b/extensions/apidoc/models/PropertyDoc.php
@@ -63,7 +63,7 @@ class PropertyDoc extends BaseDoc
 			$this->defaultValue = PrettyPrinter::getRepresentationOfValue($reflector->getNode()->default);
 		}
 
-		foreach($this->tags as $tag) {
+		foreach ($this->tags as $tag) {
 			if ($tag instanceof VarTag) {
 				$this->type = $tag->getType();
 				$this->types = $tag->getTypes();
@@ -83,4 +83,4 @@ class PropertyDoc extends BaseDoc
 			];
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/models/TraitDoc.php b/extensions/apidoc/models/TraitDoc.php
index 216a535..3742bfa 100644
--- a/extensions/apidoc/models/TraitDoc.php
+++ b/extensions/apidoc/models/TraitDoc.php
@@ -34,8 +34,8 @@ class TraitDoc extends TypeDoc
 			return;
 		}
 
-		foreach($reflector->getTraits() as $trait) {
+		foreach ($reflector->getTraits() as $trait) {
 			$this->traits[] = ltrim($trait, '\\');
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/models/TypeDoc.php b/extensions/apidoc/models/TypeDoc.php
index 3dc531f..e5756da 100644
--- a/extensions/apidoc/models/TypeDoc.php
+++ b/extensions/apidoc/models/TypeDoc.php
@@ -41,7 +41,7 @@ class TypeDoc extends BaseDoc
 	public function findSubject($subjectName)
 	{
 		if ($subjectName[0] != '$') {
-			foreach($this->methods as $name => $method) {
+			foreach ($this->methods as $name => $method) {
 				if (rtrim($subjectName, '()') == $name) {
 					return $method;
 				}
@@ -53,7 +53,7 @@ class TypeDoc extends BaseDoc
 		if ($this->properties === null) {
 			return null;
 		}
-		foreach($this->properties as $name => $property) {
+		foreach ($this->properties as $name => $property) {
 			if (ltrim($subjectName, '$') == ltrim($name, '$')) {
 				return $property;
 			}
@@ -93,7 +93,7 @@ class TypeDoc extends BaseDoc
 	private function getFilteredMethods($visibility = null, $definedBy = null)
 	{
 		$methods = [];
-		foreach($this->methods as $name => $method) {
+		foreach ($this->methods as $name => $method) {
 			if ($visibility !== null && $method->visibility != $visibility) {
 				continue;
 			}
@@ -140,7 +140,7 @@ class TypeDoc extends BaseDoc
 			return [];
 		}
 		$properties = [];
-		foreach($this->properties as $name => $property) {
+		foreach ($this->properties as $name => $property) {
 			if ($visibility !== null && $property->visibility != $visibility) {
 				continue;
 			}
@@ -167,14 +167,14 @@ class TypeDoc extends BaseDoc
 			return;
 		}
 
-		foreach($this->tags as $i => $tag) {
+		foreach ($this->tags as $i => $tag) {
 			if ($tag instanceof AuthorTag) {
 				$this->authors[$tag->getAuthorName()] = $tag->getAuthorEmail();
 				unset($this->tags[$i]);
 			}
 		}
 
-		foreach($reflector->getProperties() as $propertyReflector) {
+		foreach ($reflector->getProperties() as $propertyReflector) {
 			if ($propertyReflector->getVisibility() != 'private') {
 				$property = new PropertyDoc($propertyReflector, $context, ['sourceFile' => $this->sourceFile]);
 				$property->definedBy = $this->name;
@@ -182,7 +182,7 @@ class TypeDoc extends BaseDoc
 			}
 		}
 
-		foreach($reflector->getMethods() as $methodReflector) {
+		foreach ($reflector->getMethods() as $methodReflector) {
 			if ($methodReflector->getVisibility() != 'private') {
 				$method = new MethodDoc($methodReflector, $context, ['sourceFile' => $this->sourceFile]);
 				$method->definedBy = $this->name;
@@ -190,4 +190,4 @@ class TypeDoc extends BaseDoc
 			}
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/templates/bootstrap/SideNavWidget.php b/extensions/apidoc/templates/bootstrap/SideNavWidget.php
index ef59a41..0904285 100644
--- a/extensions/apidoc/templates/bootstrap/SideNavWidget.php
+++ b/extensions/apidoc/templates/bootstrap/SideNavWidget.php
@@ -153,7 +153,7 @@ class SideNavWidget extends \yii\bootstrap\Widget
 			$label .= ' ' . Html::tag('b', '', ['class' => 'caret']);
 			if (is_array($items)) {
 				if ($active === false) {
-					foreach($items as $subItem) {
+					foreach ($items as $subItem) {
 						if (isset($subItem['active']) && $subItem['active']) {
 							$active = true;
 						}
diff --git a/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php b/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php
index 1ae8021..0a37707 100644
--- a/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php
+++ b/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\apidoc\templates\bootstrap\assets;
+
 use yii\web\View;
 
 /**
diff --git a/extensions/apidoc/templates/bootstrap/layouts/api.php b/extensions/apidoc/templates/bootstrap/layouts/api.php
index 1acf68c..d6a0002 100644
--- a/extensions/apidoc/templates/bootstrap/layouts/api.php
+++ b/extensions/apidoc/templates/bootstrap/layouts/api.php
@@ -20,7 +20,7 @@ $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
 		$types = $renderer->getNavTypes(isset($type) ? $type : null, $types);
 		ksort($types);
 		$nav = [];
-		foreach($types as $i=>$class) {
+		foreach ($types as $i => $class) {
 			$namespace = $class->namespace;
 			if (empty($namespace)) {
 				$namespace = 'Not namespaced classes';
diff --git a/extensions/apidoc/templates/bootstrap/layouts/guide.php b/extensions/apidoc/templates/bootstrap/layouts/guide.php
index 16f846c..0cad275 100644
--- a/extensions/apidoc/templates/bootstrap/layouts/guide.php
+++ b/extensions/apidoc/templates/bootstrap/layouts/guide.php
@@ -19,7 +19,7 @@ $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
 			'url' => $this->context->generateGuideUrl('index.md'),
 			'active' => isset($currentFile) && (basename($currentFile) == 'index.md'),
 		];
-		foreach($headlines as $file => $headline) {
+		foreach ($headlines as $file => $headline) {
 			$nav[] = [
 				'label' => $headline,
 				'url' => $this->context->generateGuideUrl($file),
diff --git a/extensions/apidoc/templates/bootstrap/layouts/main.php b/extensions/apidoc/templates/bootstrap/layouts/main.php
index bd48f98..602e546 100644
--- a/extensions/apidoc/templates/bootstrap/layouts/main.php
+++ b/extensions/apidoc/templates/bootstrap/layouts/main.php
@@ -54,7 +54,7 @@ $this->beginPage();
 		if (!empty($this->context->extensions))
 		{
 			$extItems = [];
-			foreach($this->context->extensions as $ext) {
+			foreach ($this->context->extensions as $ext) {
 				$extItems[] = [
 					'label' => $ext,
 					'url' => "./ext-{$ext}-index.html",
diff --git a/extensions/apidoc/templates/bootstrap/views/index.php b/extensions/apidoc/templates/bootstrap/views/index.php
index 3037772..ce866e8 100644
--- a/extensions/apidoc/templates/bootstrap/views/index.php
+++ b/extensions/apidoc/templates/bootstrap/views/index.php
@@ -3,6 +3,7 @@
 use yii\apidoc\models\ClassDoc;
 use yii\apidoc\models\InterfaceDoc;
 use yii\apidoc\models\TraitDoc;
+
 /**
  * @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types
  * @var yii\web\View $this
@@ -29,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>
diff --git a/extensions/apidoc/templates/html/views/constSummary.php b/extensions/apidoc/templates/html/views/constSummary.php
index e2b8b02..f5c90ec 100644
--- a/extensions/apidoc/templates/html/views/constSummary.php
+++ b/extensions/apidoc/templates/html/views/constSummary.php
@@ -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>
diff --git a/extensions/apidoc/templates/html/views/eventDetails.php b/extensions/apidoc/templates/html/views/eventDetails.php
index 46fc5bd..e7cfe2d 100644
--- a/extensions/apidoc/templates/html/views/eventDetails.php
+++ b/extensions/apidoc/templates/html/views/eventDetails.php
@@ -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>
diff --git a/extensions/apidoc/templates/html/views/eventSummary.php b/extensions/apidoc/templates/html/views/eventSummary.php
index c010be4..57fcef4 100644
--- a/extensions/apidoc/templates/html/views/eventSummary.php
+++ b/extensions/apidoc/templates/html/views/eventSummary.php
@@ -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>
diff --git a/extensions/apidoc/templates/html/views/methodDetails.php b/extensions/apidoc/templates/html/views/methodDetails.php
index 52ab090..04f208e 100644
--- a/extensions/apidoc/templates/html/views/methodDetails.php
+++ b/extensions/apidoc/templates/html/views/methodDetails.php
@@ -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>
diff --git a/extensions/apidoc/templates/html/views/methodSummary.php b/extensions/apidoc/templates/html/views/methodSummary.php
index 10a32c3..b800eb3 100644
--- a/extensions/apidoc/templates/html/views/methodSummary.php
+++ b/extensions/apidoc/templates/html/views/methodSummary.php
@@ -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>
diff --git a/extensions/apidoc/templates/html/views/propertyDetails.php b/extensions/apidoc/templates/html/views/propertyDetails.php
index 6df09fe..4384c97 100644
--- a/extensions/apidoc/templates/html/views/propertyDetails.php
+++ b/extensions/apidoc/templates/html/views/propertyDetails.php
@@ -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>
diff --git a/extensions/apidoc/templates/html/views/propertySummary.php b/extensions/apidoc/templates/html/views/propertySummary.php
index d3a60d0..3fa3131 100644
--- a/extensions/apidoc/templates/html/views/propertySummary.php
+++ b/extensions/apidoc/templates/html/views/propertySummary.php
@@ -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>
diff --git a/extensions/apidoc/templates/html/views/seeAlso.php b/extensions/apidoc/templates/html/views/seeAlso.php
index 0a5fd90..3752a4f 100644
--- a/extensions/apidoc/templates/html/views/seeAlso.php
+++ b/extensions/apidoc/templates/html/views/seeAlso.php
@@ -6,7 +6,7 @@
  */
 
 $see = [];
-foreach($object->tags as $tag) {
+foreach ($object->tags as $tag) {
 	/** @var $tag phpDocumentor\Reflection\DocBlock\Tag\SeeTag */
 	if (get_class($tag) == 'phpDocumentor\Reflection\DocBlock\Tag\SeeTag') {
 		$ref = $tag->getReference();
@@ -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>
diff --git a/extensions/apidoc/templates/html/views/type.php b/extensions/apidoc/templates/html/views/type.php
index d7b3f1f..5dfc727 100644
--- a/extensions/apidoc/templates/html/views/type.php
+++ b/extensions/apidoc/templates/html/views/type.php
@@ -4,6 +4,7 @@ use yii\apidoc\helpers\ApiMarkdown;
 use yii\apidoc\models\ClassDoc;
 use yii\apidoc\models\InterfaceDoc;
 use yii\apidoc\models\TraitDoc;
+
 /**
  * @var ClassDoc|InterfaceDoc|TraitDoc $type
  * @var yii\web\View $this
@@ -30,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>
@@ -55,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)): ?>
@@ -67,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): ?>
@@ -84,8 +85,8 @@ $renderer = $this->context;
 </div>
 
 <a name="properties"></a>
-<?= $this->render('@yii/apidoc/templates/html/views/propertySummary', ['type' => $type,'protected' => false]) ?>
-<?= $this->render('@yii/apidoc/templates/html/views/propertySummary', ['type' => $type,'protected' => true]) ?>
+<?= $this->render('@yii/apidoc/templates/html/views/propertySummary', ['type' => $type, 'protected' => false]) ?>
+<?= $this->render('@yii/apidoc/templates/html/views/propertySummary', ['type' => $type, 'protected' => true]) ?>
 
 <a name="methods"></a>
 <?= $this->render('@yii/apidoc/templates/html/views/methodSummary', ['type' => $type, 'protected' => false]) ?>
@@ -99,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; ?>
diff --git a/extensions/apidoc/templates/online/ApiRenderer.php b/extensions/apidoc/templates/online/ApiRenderer.php
index 63578b9..d0dea02 100644
--- a/extensions/apidoc/templates/online/ApiRenderer.php
+++ b/extensions/apidoc/templates/online/ApiRenderer.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\apidoc\templates\online;
+
 use yii\apidoc\models\Context;
 use yii\apidoc\models\TypeDoc;
 use yii\console\Controller;
@@ -36,7 +37,7 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer
 		}
 		$packages = [];
 		$notNamespaced = [];
-		foreach(array_merge($context->classes, $context->interfaces, $context->traits) as $type) {
+		foreach (array_merge($context->classes, $context->interfaces, $context->traits) as $type) {
 			/** @var TypeDoc $type */
 			if (empty($type->namespace)) {
 				$notNamespaced[] = str_replace('\\', '-', $type->name);
@@ -46,7 +47,7 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer
 		}
 		ksort($packages);
 		$packages = array_merge(['Not namespaced' => $notNamespaced], $packages);
-		foreach($packages as $name => $classes) {
+		foreach ($packages as $name => $classes) {
 			sort($packages[$name]);
 		}
 		file_put_contents($targetDir . '/packages.txt', serialize($packages));
@@ -64,4 +65,4 @@ class ApiRenderer extends \yii\apidoc\templates\html\ApiRenderer
 	{
 		return $this->generateApiUrl($typeName) . '.html';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/apidoc/templates/online/views/index.php b/extensions/apidoc/templates/online/views/index.php
index 1103c5a..4f1d2b4 100644
--- a/extensions/apidoc/templates/online/views/index.php
+++ b/extensions/apidoc/templates/online/views/index.php
@@ -3,6 +3,7 @@
 use yii\apidoc\models\ClassDoc;
 use yii\apidoc\models\InterfaceDoc;
 use yii\apidoc\models\TraitDoc;
+
 /**
  * @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types
  * @var yii\web\View $this
@@ -22,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>
diff --git a/extensions/authclient/AuthAction.php b/extensions/authclient/AuthAction.php
index 37dd61b..0335ba5 100644
--- a/extensions/authclient/AuthAction.php
+++ b/extensions/authclient/AuthAction.php
@@ -359,4 +359,4 @@ class AuthAction extends Action
 			return Yii::$app->getResponse()->redirect($url);
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/BaseClient.php b/extensions/authclient/BaseClient.php
index 9868d48..f5fe0be 100644
--- a/extensions/authclient/BaseClient.php
+++ b/extensions/authclient/BaseClient.php
@@ -233,4 +233,4 @@ abstract class BaseClient extends Component implements ClientInterface
 		}
 		return $attributes;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/ClientInterface.php b/extensions/authclient/ClientInterface.php
index c9ea0f6..0c46d26 100644
--- a/extensions/authclient/ClientInterface.php
+++ b/extensions/authclient/ClientInterface.php
@@ -54,4 +54,4 @@ interface ClientInterface
 	 * @return array view options in format: optionName => optionValue
 	 */
 	public function getViewOptions();
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/Collection.php b/extensions/authclient/Collection.php
index 69b4c9a..2573cf4 100644
--- a/extensions/authclient/Collection.php
+++ b/extensions/authclient/Collection.php
@@ -104,4 +104,4 @@ class Collection extends Component
 		$config['id'] = $id;
 		return Yii::createObject($config);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/OAuth1.php b/extensions/authclient/OAuth1.php
index b797927..9937a76 100644
--- a/extensions/authclient/OAuth1.php
+++ b/extensions/authclient/OAuth1.php
@@ -175,7 +175,7 @@ class OAuth1 extends BaseOAuth
 			}
 			case 'POST': {
 				$curlOptions[CURLOPT_POST] = true;
-				if (!empty($params)){
+				if (!empty($params)) {
 					$curlOptions[CURLOPT_POSTFIELDS] = $params;
 				}
 				$authorizationHeader = $this->composeAuthorizationHeader($params);
@@ -352,4 +352,4 @@ class OAuth1 extends BaseOAuth
 		}
 		return $header;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/OAuth2.php b/extensions/authclient/OAuth2.php
index 7933eb7..c40ad16 100644
--- a/extensions/authclient/OAuth2.php
+++ b/extensions/authclient/OAuth2.php
@@ -182,4 +182,4 @@ class OAuth2 extends BaseOAuth
 		$tokenConfig['tokenParamKey'] = 'access_token';
 		return parent::createToken($tokenConfig);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/OAuthToken.php b/extensions/authclient/OAuthToken.php
index 88881b0..9aac5b7 100644
--- a/extensions/authclient/OAuthToken.php
+++ b/extensions/authclient/OAuthToken.php
@@ -58,14 +58,16 @@ class OAuthToken extends Object
 	/**
 	 * @param string $expireDurationParamKey expire duration param key.
 	 */
-	public function setExpireDurationParamKey($expireDurationParamKey) {
+	public function setExpireDurationParamKey($expireDurationParamKey)
+	{
 		$this->_expireDurationParamKey = $expireDurationParamKey;
 	}
 
 	/**
 	 * @return string expire duration param key.
 	 */
-	public function getExpireDurationParamKey() {
+	public function getExpireDurationParamKey()
+	{
 		if ($this->_expireDurationParamKey === null) {
 			$this->_expireDurationParamKey = $this->defaultExpireDurationParamKey();
 		}
@@ -75,14 +77,16 @@ class OAuthToken extends Object
 	/**
 	 * @return array
 	 */
-	public function getParams() {
+	public function getParams()
+	{
 		return $this->_params;
 	}
 
 	/**
 	 * @param array $params
 	 */
-	public function setParams(array $params) {
+	public function setParams(array $params)
+	{
 		$this->_params = $params;
 	}
 
@@ -91,7 +95,8 @@ class OAuthToken extends Object
 	 * @param string $name param name.
 	 * @param mixed $value param value,
 	 */
-	public function setParam($name, $value) {
+	public function setParam($name, $value)
+	{
 		$this->_params[$name] = $value;
 	}
 
@@ -100,7 +105,8 @@ class OAuthToken extends Object
 	 * @param string $name param name.
 	 * @return mixed param value.
 	 */
-	public function getParam($name) {
+	public function getParam($name)
+	{
 		return isset($this->_params[$name]) ? $this->_params[$name] : null;
 	}
 
@@ -109,7 +115,8 @@ class OAuthToken extends Object
 	 * @param string $token token value.
 	 * @return static self reference.
 	 */
-	public function setToken($token) {
+	public function setToken($token)
+	{
 		$this->setParam($this->tokenParamKey, $token);
 	}
 
@@ -117,7 +124,8 @@ class OAuthToken extends Object
 	 * Returns token value.
 	 * @return string token value.
 	 */
-	public function getToken() {
+	public function getToken()
+	{
 		return $this->getParam($this->tokenParamKey);
 	}
 
@@ -125,7 +133,8 @@ class OAuthToken extends Object
 	 * Sets the token secret value.
 	 * @param string $tokenSecret token secret.
 	 */
-	public function setTokenSecret($tokenSecret) {
+	public function setTokenSecret($tokenSecret)
+	{
 		$this->setParam($this->tokenSecretParamKey, $tokenSecret);
 	}
 
@@ -133,7 +142,8 @@ class OAuthToken extends Object
 	 * Returns the token secret value.
 	 * @return string token secret value.
 	 */
-	public function getTokenSecret() {
+	public function getTokenSecret()
+	{
 		return $this->getParam($this->tokenSecretParamKey);
 	}
 
@@ -141,7 +151,8 @@ class OAuthToken extends Object
 	 * Sets token expire duration.
 	 * @param string $expireDuration token expiration duration.
 	 */
-	public function setExpireDuration($expireDuration) {
+	public function setExpireDuration($expireDuration)
+	{
 		$this->setParam($this->getExpireDurationParamKey(), $expireDuration);
 	}
 
@@ -149,7 +160,8 @@ class OAuthToken extends Object
 	 * Returns the token expiration duration.
 	 * @return integer token expiration duration.
 	 */
-	public function getExpireDuration() {
+	public function getExpireDuration()
+	{
 		return $this->getParam($this->getExpireDurationParamKey());
 	}
 
@@ -157,7 +169,8 @@ class OAuthToken extends Object
 	 * Fetches default expire duration param key.
 	 * @return string expire duration param key.
 	 */
-	protected function defaultExpireDurationParamKey() {
+	protected function defaultExpireDurationParamKey()
+	{
 		$expireDurationParamKey = 'expires_in';
 		foreach ($this->getParams() as $name => $value) {
 			if (strpos($name, 'expir') !== false) {
@@ -172,7 +185,8 @@ class OAuthToken extends Object
 	 * Checks if token has expired.
 	 * @return boolean is token expired.
 	 */
-	public function getIsExpired() {
+	public function getIsExpired()
+	{
 		$expirationDuration = $this->getExpireDuration();
 		if (empty($expirationDuration)) {
 			return false;
@@ -184,8 +198,9 @@ class OAuthToken extends Object
 	 * Checks if token is valid.
 	 * @return boolean is token valid.
 	 */
-	public function getIsValid() {
+	public function getIsValid()
+	{
 		$token = $this->getToken();
 		return (!empty($token) && !$this->getIsExpired());
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/OpenId.php b/extensions/authclient/OpenId.php
index 2afad4c..9e0dd38 100644
--- a/extensions/authclient/OpenId.php
+++ b/extensions/authclient/OpenId.php
@@ -243,10 +243,10 @@ class OpenId extends BaseClient implements ClientInterface
 
 		if ($this->verifyPeer !== null) {
 			curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifyPeer);
-			if($this->capath) {
+			if ($this->capath) {
 				curl_setopt($curl, CURLOPT_CAPATH, $this->capath);
 			}
-			if($this->cainfo) {
+			if ($this->cainfo) {
 				curl_setopt($curl, CURLOPT_CAINFO, $this->cainfo);
 			}
 		}
@@ -926,4 +926,4 @@ class OpenId extends BaseClient implements ClientInterface
 	{
 		return array_merge(['id' => $this->getClaimedId()], $this->fetchAttributes());
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/clients/Facebook.php b/extensions/authclient/clients/Facebook.php
index 3b78d47..fd59ae0 100644
--- a/extensions/authclient/clients/Facebook.php
+++ b/extensions/authclient/clients/Facebook.php
@@ -80,4 +80,4 @@ class Facebook extends OAuth2
 	{
 		return 'Facebook';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/clients/GitHub.php b/extensions/authclient/clients/GitHub.php
index 6028512..a828dfe 100644
--- a/extensions/authclient/clients/GitHub.php
+++ b/extensions/authclient/clients/GitHub.php
@@ -90,4 +90,4 @@ class GitHub extends OAuth2
 	{
 		return 'GitHub';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/clients/GoogleOAuth.php b/extensions/authclient/clients/GoogleOAuth.php
index a94a4d3..5044232 100644
--- a/extensions/authclient/clients/GoogleOAuth.php
+++ b/extensions/authclient/clients/GoogleOAuth.php
@@ -90,4 +90,4 @@ class GoogleOAuth extends OAuth2
 	{
 		return 'Google';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/clients/GoogleOpenId.php b/extensions/authclient/clients/GoogleOpenId.php
index 8b463d6..9f7035f 100644
--- a/extensions/authclient/clients/GoogleOpenId.php
+++ b/extensions/authclient/clients/GoogleOpenId.php
@@ -87,4 +87,4 @@ class GoogleOpenId extends OpenId
 	{
 		return 'Google';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/clients/LinkedIn.php b/extensions/authclient/clients/LinkedIn.php
index 3752457..afd763a 100644
--- a/extensions/authclient/clients/LinkedIn.php
+++ b/extensions/authclient/clients/LinkedIn.php
@@ -147,7 +147,8 @@ class LinkedIn extends OAuth2
 	 * Generates the auth state value.
 	 * @return string auth state value.
 	 */
-	protected function generateAuthState() {
+	protected function generateAuthState()
+	{
 		return sha1(uniqid(get_class($this), true));
 	}
 
@@ -166,4 +167,4 @@ class LinkedIn extends OAuth2
 	{
 		return 'LinkedIn';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/clients/Twitter.php b/extensions/authclient/clients/Twitter.php
index 1bee436..444de87 100644
--- a/extensions/authclient/clients/Twitter.php
+++ b/extensions/authclient/clients/Twitter.php
@@ -88,4 +88,4 @@ class Twitter extends OAuth1
 	{
 		return 'Twitter';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/clients/YandexOAuth.php b/extensions/authclient/clients/YandexOAuth.php
index e2ddb13..c8148d4 100644
--- a/extensions/authclient/clients/YandexOAuth.php
+++ b/extensions/authclient/clients/YandexOAuth.php
@@ -88,4 +88,4 @@ class YandexOAuth extends OAuth2
 	{
 		return 'Yandex';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/clients/YandexOpenId.php b/extensions/authclient/clients/YandexOpenId.php
index 20c3b81..e4ec9b1 100644
--- a/extensions/authclient/clients/YandexOpenId.php
+++ b/extensions/authclient/clients/YandexOpenId.php
@@ -83,4 +83,4 @@ class YandexOpenId extends OpenId
 	{
 		return 'Yandex';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/signature/BaseMethod.php b/extensions/authclient/signature/BaseMethod.php
index f0deadc..4b0cd99 100644
--- a/extensions/authclient/signature/BaseMethod.php
+++ b/extensions/authclient/signature/BaseMethod.php
@@ -46,4 +46,4 @@ abstract class BaseMethod extends Object
 		}
 		return (strcmp($expectedSignature, $signature) === 0);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/signature/HmacSha1.php b/extensions/authclient/signature/HmacSha1.php
index 3f88435..15885a9 100644
--- a/extensions/authclient/signature/HmacSha1.php
+++ b/extensions/authclient/signature/HmacSha1.php
@@ -44,4 +44,4 @@ class HmacSha1 extends BaseMethod
 	{
 		return base64_encode(hash_hmac('sha1', $baseString, $key, true));
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/signature/PlainText.php b/extensions/authclient/signature/PlainText.php
index 867c319..883a7f5 100644
--- a/extensions/authclient/signature/PlainText.php
+++ b/extensions/authclient/signature/PlainText.php
@@ -30,4 +30,4 @@ class PlainText extends BaseMethod
 	{
 		return $key;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/signature/RsaSha1.php b/extensions/authclient/signature/RsaSha1.php
index 83e4950..ef16608 100644
--- a/extensions/authclient/signature/RsaSha1.php
+++ b/extensions/authclient/signature/RsaSha1.php
@@ -165,4 +165,4 @@ class RsaSha1 extends BaseMethod
 		openssl_free_key($publicKeyId);
 		return ($verificationResult == 1);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/authclient/widgets/ChoiceAsset.php b/extensions/authclient/widgets/ChoiceAsset.php
index a30570a..ecea8bd 100644
--- a/extensions/authclient/widgets/ChoiceAsset.php
+++ b/extensions/authclient/widgets/ChoiceAsset.php
@@ -27,4 +27,4 @@ class ChoiceAsset extends AssetBundle
 	public $depends = [
 		'yii\web\YiiAsset',
 	];
-}
\ No newline at end of file
+}
diff --git a/extensions/bootstrap/NavBar.php b/extensions/bootstrap/NavBar.php
index 8cc3579..2cdd93c 100644
--- a/extensions/bootstrap/NavBar.php
+++ b/extensions/bootstrap/NavBar.php
@@ -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;
diff --git a/extensions/bootstrap/Progress.php b/extensions/bootstrap/Progress.php
index 8f23a58..fbfe135 100644
--- a/extensions/bootstrap/Progress.php
+++ b/extensions/bootstrap/Progress.php
@@ -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.
diff --git a/extensions/composer/Installer.php b/extensions/composer/Installer.php
index 09669be..81cc267 100644
--- a/extensions/composer/Installer.php
+++ b/extensions/composer/Installer.php
@@ -192,7 +192,7 @@ class Installer extends LibraryInstaller
 		if (!file_exists($yiiDir)) {
 			mkdir($yiiDir, 0777, true);
 		}
-		foreach(['Yii.php', 'BaseYii.php', 'classes.php'] as $file) {
+		foreach (['Yii.php', 'BaseYii.php', 'classes.php'] as $file) {
 			file_put_contents($yiiDir . '/' . $file, <<<EOF
 <?php
 /**
@@ -213,7 +213,7 @@ EOF
 	protected function removeBaseYiiFiles()
 	{
 		$yiiDir = $this->vendorDir . '/yiisoft/yii2';
-		foreach(['Yii.php', 'BaseYii.php', 'classes.php'] as $file) {
+		foreach (['Yii.php', 'BaseYii.php', 'classes.php'] as $file) {
 			if (file_exists($yiiDir . '/' . $file)) {
 				unlink($yiiDir . '/' . $file);
 			}
diff --git a/extensions/debug/LogTarget.php b/extensions/debug/LogTarget.php
index b8a8354..3ba67de 100644
--- a/extensions/debug/LogTarget.php
+++ b/extensions/debug/LogTarget.php
@@ -168,5 +168,4 @@ class LogTarget extends Target
 		# / 2 because messages are in couple (begin/end)
 		return count($profileLogs) / 2;
 	}
-
 }
diff --git a/extensions/debug/components/search/matchers/Base.php b/extensions/debug/components/search/matchers/Base.php
index c98b413..a29b40b 100644
--- a/extensions/debug/components/search/matchers/Base.php
+++ b/extensions/debug/components/search/matchers/Base.php
@@ -37,5 +37,4 @@ abstract class Base extends Component implements MatcherInterface
 	{
 		return !empty($this->baseValue) || ($this->baseValue === '0');
 	}
-
 }
diff --git a/extensions/debug/panels/DbPanel.php b/extensions/debug/panels/DbPanel.php
index 48ca756..c95cc51 100644
--- a/extensions/debug/panels/DbPanel.php
+++ b/extensions/debug/panels/DbPanel.php
@@ -175,5 +175,4 @@ class DbPanel extends Panel
 	{
 		return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold));
 	}
-
 }
diff --git a/extensions/debug/panels/MailPanel.php b/extensions/debug/panels/MailPanel.php
index 19a85ca..5193db2 100644
--- a/extensions/debug/panels/MailPanel.php
+++ b/extensions/debug/panels/MailPanel.php
@@ -102,5 +102,4 @@ class MailPanel extends Panel
 		}
 		return $attr;
 	}
-
 }
diff --git a/extensions/debug/views/default/panels/config/detail.php b/extensions/debug/views/default/panels/config/detail.php
index b2cfde1..11ba53f 100644
--- a/extensions/debug/views/default/panels/config/detail.php
+++ b/extensions/debug/views/default/panels/config/detail.php
@@ -35,4 +35,3 @@ echo $this->render('panels/config/table', [
 ]);
 
 echo $panel->getPhpInfo();
-?>
\ No newline at end of file
diff --git a/extensions/debug/views/default/panels/config/table.php b/extensions/debug/views/default/panels/config/table.php
index 0dc2d8d..f5efc65 100644
--- a/extensions/debug/views/default/panels/config/table.php
+++ b/extensions/debug/views/default/panels/config/table.php
@@ -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>
diff --git a/extensions/debug/views/default/panels/db/detail.php b/extensions/debug/views/default/panels/db/detail.php
index 682c794..762fdf5 100644
--- a/extensions/debug/views/default/panels/db/detail.php
+++ b/extensions/debug/views/default/panels/db/detail.php
@@ -67,4 +67,3 @@ echo GridView::widget([
 		]
 	],
 ]);
-?>
diff --git a/extensions/debug/views/default/panels/log/detail.php b/extensions/debug/views/default/panels/log/detail.php
index ccbec5d..5f9d4a1 100644
--- a/extensions/debug/views/default/panels/log/detail.php
+++ b/extensions/debug/views/default/panels/log/detail.php
@@ -70,4 +70,3 @@ echo GridView::widget([
 		],
 	],
 ]);
-?>
diff --git a/extensions/debug/views/default/panels/profile/detail.php b/extensions/debug/views/default/panels/profile/detail.php
index a7ed220..f0d4a66 100644
--- a/extensions/debug/views/default/panels/profile/detail.php
+++ b/extensions/debug/views/default/panels/profile/detail.php
@@ -1,6 +1,7 @@
 <?php
 use yii\grid\GridView;
 use yii\helpers\Html;
+
 ?>
 <h1>Performance Profiling</h1>
 <p>Total processing time: <b><?= $time ?></b>; Peak memory: <b><?= $memory ?></b>.</p>
@@ -50,4 +51,3 @@ echo GridView::widget([
 		],
 	],
 ]);
-?>
diff --git a/extensions/debug/views/default/panels/request/table.php b/extensions/debug/views/default/panels/request/table.php
index 9175e6b..333ede1 100644
--- a/extensions/debug/views/default/panels/request/table.php
+++ b/extensions/debug/views/default/panels/request/table.php
@@ -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>
diff --git a/extensions/elasticsearch/ActiveQuery.php b/extensions/elasticsearch/ActiveQuery.php
index c7d23ad..0ed64aa 100644
--- a/extensions/elasticsearch/ActiveQuery.php
+++ b/extensions/elasticsearch/ActiveQuery.php
@@ -156,7 +156,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
 		}
 		$models = $this->createModels($result['hits']['hits']);
 		if ($this->asArray && !$this->indexBy) {
-			foreach($models as $key => $model) {
+			foreach ($models as $key => $model) {
 				if ($pk === '_id') {
 					$model['_source']['_id'] = $model['_id'];
 				}
@@ -168,7 +168,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
 			$this->findWith($this->with, $models);
 		}
 		if (!$this->asArray) {
-			foreach($models as $model) {
+			foreach ($models as $model) {
 				$model->afterFind();
 			}
 		}
@@ -226,7 +226,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
 				/** @var ActiveRecord $modelClass */
 				$modelClass = $this->modelClass;
 				$pk = $modelClass::primaryKey()[0];
-				foreach($models as $key => $model) {
+				foreach ($models as $key => $model) {
 					if ($pk === '_id') {
 						$model['_source']['_id'] = $model['_id'];
 					}
@@ -238,7 +238,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
 				$this->findWith($this->with, $models);
 			}
 			if (!$this->asArray) {
-				foreach($models as $model) {
+				foreach ($models as $model) {
 					$model->afterFind();
 				}
 			}
diff --git a/extensions/elasticsearch/ActiveRecord.php b/extensions/elasticsearch/ActiveRecord.php
index 4fdff54..06d5d23 100644
--- a/extensions/elasticsearch/ActiveRecord.php
+++ b/extensions/elasticsearch/ActiveRecord.php
@@ -122,7 +122,7 @@ class ActiveRecord extends BaseActiveRecord
 		$command = static::getDb()->createCommand();
 		$result = $command->mget(static::index(), static::type(), $primaryKeys, $options);
 		$models = [];
-		foreach($result['docs'] as $doc) {
+		foreach ($result['docs'] as $doc) {
 			if ($doc['exists']) {
 				$model = static::instantiate($doc);
 				static::populateRecord($model, $doc);
@@ -422,7 +422,7 @@ class ActiveRecord extends BaseActiveRecord
 			return 0;
 		}
 		$bulk = '';
-		foreach($primaryKeys as $pk) {
+		foreach ($primaryKeys as $pk) {
 			$action = Json::encode([
 				"update" => [
 					"_id" => $pk,
@@ -441,7 +441,7 @@ class ActiveRecord extends BaseActiveRecord
 		$response = static::getDb()->post($url, [], $bulk);
 		$n=0;
 		$errors = [];
-		foreach($response['items'] as $item) {
+		foreach ($response['items'] as $item) {
 			if (isset($item['update']['error'])) {
 				$errors[] = $item['update'];
 			} elseif ($item['update']['ok']) {
@@ -480,7 +480,7 @@ class ActiveRecord extends BaseActiveRecord
 			return 0;
 		}
 		$bulk = '';
-		foreach($primaryKeys as $pk) {
+		foreach ($primaryKeys as $pk) {
 			$action = Json::encode([
 				"update" => [
 					"_id" => $pk,
@@ -489,12 +489,12 @@ class ActiveRecord extends BaseActiveRecord
 				],
 			]);
 			$script = '';
-			foreach($counters as $counter => $value) {
+			foreach ($counters as $counter => $value) {
 				$script .= "ctx._source.$counter += $counter;\n";
 			}
 			$data = Json::encode([
 				"script" => $script,
-                "params" => $counters
+				"params" => $counters
 			]);
 			$bulk .= $action . "\n" . $data . "\n";
 		}
@@ -504,7 +504,7 @@ class ActiveRecord extends BaseActiveRecord
 		$response = static::getDb()->post($url, [], $bulk);
 		$n=0;
 		$errors = [];
-		foreach($response['items'] as $item) {
+		foreach ($response['items'] as $item) {
 			if (isset($item['update']['error'])) {
 				$errors[] = $item['update'];
 			} elseif ($item['update']['ok']) {
@@ -543,7 +543,7 @@ class ActiveRecord extends BaseActiveRecord
 			return 0;
 		}
 		$bulk = '';
-		foreach($primaryKeys as $pk) {
+		foreach ($primaryKeys as $pk) {
 			$bulk .= Json::encode([
 				"delete" => [
 					"_id" => $pk,
@@ -558,7 +558,7 @@ class ActiveRecord extends BaseActiveRecord
 		$response = static::getDb()->post($url, [], $bulk);
 		$n=0;
 		$errors = [];
-		foreach($response['items'] as $item) {
+		foreach ($response['items'] as $item) {
 			if (isset($item['delete']['error'])) {
 				$errors[] = $item['delete'];
 			} elseif ($item['delete']['found'] && $item['delete']['ok']) {
diff --git a/extensions/elasticsearch/Command.php b/extensions/elasticsearch/Command.php
index 9ea4a60..69c3746 100644
--- a/extensions/elasticsearch/Command.php
+++ b/extensions/elasticsearch/Command.php
@@ -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
 	 */
@@ -400,4 +400,4 @@ class Command extends Component
 	{
 		return $this->db->get(['_template', $name]);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/elasticsearch/Connection.php b/extensions/elasticsearch/Connection.php
index 75de7a3..290d339 100644
--- a/extensions/elasticsearch/Connection.php
+++ b/extensions/elasticsearch/Connection.php
@@ -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;
 	/**
@@ -63,7 +63,7 @@ class Connection extends Component
 
 	public function init()
 	{
-		foreach($this->nodes as $node) {
+		foreach ($this->nodes as $node) {
 			if (!isset($node['http_address'])) {
 				throw new InvalidConfigException('Elasticsearch node needs at least a http_address configured.');
 			}
@@ -210,7 +210,7 @@ class Connection extends Component
 	private function createUrl($path, $options = [])
 	{
 		if (!is_string($path)) {
-			$url = implode('/', array_map(function($a) {
+			$url = implode('/', array_map(function ($a) {
 				return urlencode(is_array($a) ? implode(',', $a) : $a);
 			}, $path));
 			if (!empty($options)) {
@@ -240,7 +240,7 @@ class Connection extends Component
 			// http://www.php.net/manual/en/function.curl-setopt.php#82418
 			CURLOPT_HTTPHEADER     => ['Expect:'],
 
-			CURLOPT_WRITEFUNCTION  => function($curl, $data) use (&$body) {
+			CURLOPT_WRITEFUNCTION  => function ($curl, $data) use (&$body) {
 				$body .= $data;
 				return mb_strlen($data, '8bit');
 			},
@@ -355,4 +355,4 @@ class Connection extends Component
 	{
 		return $this->get(['_cluster', 'state']);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/elasticsearch/Exception.php b/extensions/elasticsearch/Exception.php
index 1736dec..2510072 100644
--- a/extensions/elasticsearch/Exception.php
+++ b/extensions/elasticsearch/Exception.php
@@ -22,4 +22,4 @@ class Exception extends \yii\db\Exception
 	{
 		return 'Elasticsearch Database Exception';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/elasticsearch/Query.php b/extensions/elasticsearch/Query.php
index 139b2d6..f392d16 100644
--- a/extensions/elasticsearch/Query.php
+++ b/extensions/elasticsearch/Query.php
@@ -501,4 +501,4 @@ class Query extends Component implements QueryInterface
 		$this->timeout = $timeout;
 		return $this;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/elasticsearch/QueryBuilder.php b/extensions/elasticsearch/QueryBuilder.php
index e9511ea..0b6a38b 100644
--- a/extensions/elasticsearch/QueryBuilder.php
+++ b/extensions/elasticsearch/QueryBuilder.php
@@ -177,7 +177,7 @@ class QueryBuilder extends \yii\base\Object
 	private function buildHashCondition($condition)
 	{
 		$parts = [];
-		foreach($condition as $attribute => $value) {
+		foreach ($condition as $attribute => $value) {
 			if ($attribute == '_id') {
 				if ($value == null) { // there is no null pk
 					$parts[] = ['script' => ['script' => '0==1']];
diff --git a/extensions/gii/Generator.php b/extensions/gii/Generator.php
index d82bdc1..9dc3c6b 100644
--- a/extensions/gii/Generator.php
+++ b/extensions/gii/Generator.php
@@ -13,7 +13,6 @@ use yii\base\InvalidConfigException;
 use yii\base\Model;
 use yii\web\View;
 
-
 /**
  * This is the base class for all generator classes.
  *
diff --git a/extensions/gii/components/DiffRendererHtmlInline.php b/extensions/gii/components/DiffRendererHtmlInline.php
index 757addb..908630a 100644
--- a/extensions/gii/components/DiffRendererHtmlInline.php
+++ b/extensions/gii/components/DiffRendererHtmlInline.php
@@ -73,7 +73,7 @@ HTML;
 					}
 				}
 				// Added lines only on the right side
-				else if ($change['tag'] === 'insert') {
+				elseif ($change['tag'] === 'insert') {
 					foreach ($change['changed']['lines'] as $no => $line) {
 						$toLine = $change['changed']['offset'] + $no + 1;
 						$html .= <<<HTML
@@ -86,7 +86,7 @@ HTML;
 					}
 				}
 				// Show deleted lines only on the left side
-				else if ($change['tag'] === 'delete') {
+				elseif ($change['tag'] === 'delete') {
 					foreach ($change['base']['lines'] as $no => $line) {
 						$fromLine = $change['base']['offset'] + $no + 1;
 						$html .= <<<HTML
@@ -99,7 +99,7 @@ HTML;
 					}
 				}
 				// Show modified lines on both sides
-				else if ($change['tag'] === 'replace') {
+				elseif ($change['tag'] === 'replace') {
 					foreach ($change['base']['lines'] as $no => $line) {
 						$fromLine = $change['base']['offset'] + $no + 1;
 						$html .= <<<HTML
@@ -132,4 +132,4 @@ HTML;
 HTML;
 		return $html;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/gii/generators/controller/templates/controller.php b/extensions/gii/generators/controller/templates/controller.php
index b62edc3..95358d2 100644
--- a/extensions/gii/generators/controller/templates/controller.php
+++ b/extensions/gii/generators/controller/templates/controller.php
@@ -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 ?>');
diff --git a/extensions/gii/generators/crud/Generator.php b/extensions/gii/generators/crud/Generator.php
index dd0cb08..0d047ee 100644
--- a/extensions/gii/generators/crud/Generator.php
+++ b/extensions/gii/generators/crud/Generator.php
@@ -499,5 +499,4 @@ class Generator extends \yii\gii\Generator
 			return $model->attributes();
 		}
 	}
-
 }
diff --git a/extensions/jui/AutoCompleteAsset.php b/extensions/jui/AutoCompleteAsset.php
index f48e064..8e2b3f4 100644
--- a/extensions/jui/AutoCompleteAsset.php
+++ b/extensions/jui/AutoCompleteAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/ButtonAsset.php b/extensions/jui/ButtonAsset.php
index 6616b34..b00354e 100644
--- a/extensions/jui/ButtonAsset.php
+++ b/extensions/jui/ButtonAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/CoreAsset.php b/extensions/jui/CoreAsset.php
index d77a25f..f221f53 100644
--- a/extensions/jui/CoreAsset.php
+++ b/extensions/jui/CoreAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/DatePickerAsset.php b/extensions/jui/DatePickerAsset.php
index fddd8df..68fb486 100644
--- a/extensions/jui/DatePickerAsset.php
+++ b/extensions/jui/DatePickerAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/DatePickerRegionalAsset.php b/extensions/jui/DatePickerRegionalAsset.php
index 249373a..fcb931b 100644
--- a/extensions/jui/DatePickerRegionalAsset.php
+++ b/extensions/jui/DatePickerRegionalAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/DialogAsset.php b/extensions/jui/DialogAsset.php
index 109243e..da6a32c 100644
--- a/extensions/jui/DialogAsset.php
+++ b/extensions/jui/DialogAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/DraggableAsset.php b/extensions/jui/DraggableAsset.php
index f3286a5..152ea6e 100644
--- a/extensions/jui/DraggableAsset.php
+++ b/extensions/jui/DraggableAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/DroppableAsset.php b/extensions/jui/DroppableAsset.php
index 84b64b8..ae7afa8 100644
--- a/extensions/jui/DroppableAsset.php
+++ b/extensions/jui/DroppableAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/EffectAsset.php b/extensions/jui/EffectAsset.php
index 79c5aaa..d28347c 100644
--- a/extensions/jui/EffectAsset.php
+++ b/extensions/jui/EffectAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/MenuAsset.php b/extensions/jui/MenuAsset.php
index 8b840a8..c4c66ec 100644
--- a/extensions/jui/MenuAsset.php
+++ b/extensions/jui/MenuAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/ProgressBarAsset.php b/extensions/jui/ProgressBarAsset.php
index d485fbd..b7a5df2 100644
--- a/extensions/jui/ProgressBarAsset.php
+++ b/extensions/jui/ProgressBarAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/ResizableAsset.php b/extensions/jui/ResizableAsset.php
index acf4c73..9097a8f 100644
--- a/extensions/jui/ResizableAsset.php
+++ b/extensions/jui/ResizableAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/SelectableAsset.php b/extensions/jui/SelectableAsset.php
index 61f405f..b794756 100644
--- a/extensions/jui/SelectableAsset.php
+++ b/extensions/jui/SelectableAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/SliderAsset.php b/extensions/jui/SliderAsset.php
index 56c2451..fcba776 100644
--- a/extensions/jui/SliderAsset.php
+++ b/extensions/jui/SliderAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/SortableAsset.php b/extensions/jui/SortableAsset.php
index 69c9ba3..5f31f73 100644
--- a/extensions/jui/SortableAsset.php
+++ b/extensions/jui/SortableAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/SpinnerAsset.php b/extensions/jui/SpinnerAsset.php
index 89a8c59..04bc698 100644
--- a/extensions/jui/SpinnerAsset.php
+++ b/extensions/jui/SpinnerAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/TabsAsset.php b/extensions/jui/TabsAsset.php
index 5bef4c0..49b3bad 100644
--- a/extensions/jui/TabsAsset.php
+++ b/extensions/jui/TabsAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/ThemeAsset.php b/extensions/jui/ThemeAsset.php
index dedcb00..8c7e78e 100644
--- a/extensions/jui/ThemeAsset.php
+++ b/extensions/jui/ThemeAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/jui/TooltipAsset.php b/extensions/jui/TooltipAsset.php
index 1fa4490..f0139a1 100644
--- a/extensions/jui/TooltipAsset.php
+++ b/extensions/jui/TooltipAsset.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\jui;
+
 use yii\web\AssetBundle;
 
 /**
diff --git a/extensions/mongodb/ActiveQuery.php b/extensions/mongodb/ActiveQuery.php
index 351f942..fabea5f 100644
--- a/extensions/mongodb/ActiveQuery.php
+++ b/extensions/mongodb/ActiveQuery.php
@@ -111,7 +111,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
 				$this->findWith($this->with, $models);
 			}
 			if (!$this->asArray) {
-				foreach($models as $model) {
+				foreach ($models as $model) {
 					$model->afterFind();
 				}
 			}
@@ -172,4 +172,4 @@ class ActiveQuery extends Query implements ActiveQueryInterface
 		}
 		return $db->getCollection($this->from);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/ActiveRecord.php b/extensions/mongodb/ActiveRecord.php
index fd48d0e..fdf7301 100644
--- a/extensions/mongodb/ActiveRecord.php
+++ b/extensions/mongodb/ActiveRecord.php
@@ -348,4 +348,4 @@ abstract class ActiveRecord extends BaseActiveRecord
 		}
 		return $this->collectionName() === $record->collectionName() && (string)$this->getPrimaryKey() === (string)$record->getPrimaryKey();
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/Cache.php b/extensions/mongodb/Cache.php
index 3f4eaf7..af016a5 100644
--- a/extensions/mongodb/Cache.php
+++ b/extensions/mongodb/Cache.php
@@ -199,4 +199,4 @@ class Cache extends \yii\caching\Cache
 				]);
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/Collection.php b/extensions/mongodb/Collection.php
index 6f595f8..43a3672 100644
--- a/extensions/mongodb/Collection.php
+++ b/extensions/mongodb/Collection.php
@@ -626,7 +626,8 @@ class Collection extends Object
 	 * @return array the highest scoring documents, in descending order by score.
 	 * @throws Exception on failure.
 	 */
-	public function fullTextSearch($search, $condition = [], $fields = [], $options = []) {
+	public function fullTextSearch($search, $condition = [], $fields = [], $options = [])
+	{
 		$command = [
 			'search' => $search
 		];
@@ -931,4 +932,4 @@ class Collection extends Object
 		}
 		return [$column => $value];
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/Connection.php b/extensions/mongodb/Connection.php
index e79bfcb..11a0c1a 100644
--- a/extensions/mongodb/Connection.php
+++ b/extensions/mongodb/Connection.php
@@ -269,4 +269,4 @@ class Connection extends Component
 	{
 		$this->trigger(self::EVENT_AFTER_OPEN);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/Database.php b/extensions/mongodb/Database.php
index 5c53e50..2ded6b3 100644
--- a/extensions/mongodb/Database.php
+++ b/extensions/mongodb/Database.php
@@ -170,4 +170,4 @@ class Database extends Object
 			throw new Exception('Unknown error, use "w=1" option to enable error tracking');
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/Exception.php b/extensions/mongodb/Exception.php
index 9e3a148..a938561 100644
--- a/extensions/mongodb/Exception.php
+++ b/extensions/mongodb/Exception.php
@@ -22,4 +22,4 @@ class Exception extends \yii\base\Exception
 	{
 		return 'MongoDB Exception';
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/Query.php b/extensions/mongodb/Query.php
index 1ecea39..6594a57 100644
--- a/extensions/mongodb/Query.php
+++ b/extensions/mongodb/Query.php
@@ -343,4 +343,4 @@ class Query extends Component implements QueryInterface
 			return $result;
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/Session.php b/extensions/mongodb/Session.php
index 9b630cc..efa78b6 100644
--- a/extensions/mongodb/Session.php
+++ b/extensions/mongodb/Session.php
@@ -187,4 +187,4 @@ class Session extends \yii\web\Session
 			->remove(['expire' => ['$lt' => time()]]);
 		return true;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/file/ActiveQuery.php b/extensions/mongodb/file/ActiveQuery.php
index 79bcd2f..d19043f 100644
--- a/extensions/mongodb/file/ActiveQuery.php
+++ b/extensions/mongodb/file/ActiveQuery.php
@@ -56,7 +56,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
 				$this->findWith($this->with, $models);
 			}
 			if (!$this->asArray) {
-				foreach($models as $model) {
+				foreach ($models as $model) {
 					$model->afterFind();
 				}
 			}
@@ -117,4 +117,4 @@ class ActiveQuery extends Query implements ActiveQueryInterface
 		}
 		return $db->getFileCollection($this->from);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/file/Collection.php b/extensions/mongodb/file/Collection.php
index 2efdef1..c408364 100644
--- a/extensions/mongodb/file/Collection.php
+++ b/extensions/mongodb/file/Collection.php
@@ -182,4 +182,4 @@ class Collection extends \yii\mongodb\Collection
 			throw new Exception($e->getMessage(), (int)$e->getCode(), $e);
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/mongodb/file/Query.php b/extensions/mongodb/file/Query.php
index 435dcc7..341113e 100644
--- a/extensions/mongodb/file/Query.php
+++ b/extensions/mongodb/file/Query.php
@@ -72,4 +72,4 @@ class Query extends \yii\mongodb\Query
 		}
 		return $result;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/redis/ActiveQuery.php b/extensions/redis/ActiveQuery.php
index df69be1..54aec1f 100644
--- a/extensions/redis/ActiveQuery.php
+++ b/extensions/redis/ActiveQuery.php
@@ -87,10 +87,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 		// TODO add support for orderBy
 		$data = $this->executeScript($db, 'All');
 		$rows = [];
-		foreach($data as $dataRow) {
+		foreach ($data as $dataRow) {
 			$row = [];
 			$c = count($dataRow);
-			for($i = 0; $i < $c; ) {
+			for ($i = 0; $i < $c;) {
 				$row[$dataRow[$i++]] = $dataRow[$i++];
 			}
 			$rows[] = $row;
@@ -101,7 +101,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 				$this->findWith($this->with, $models);
 			}
 			if (!$this->asArray) {
-				foreach($models as $model) {
+				foreach ($models as $model) {
 					$model->afterFind();
 				}
 			}
@@ -128,7 +128,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 		}
 		$row = [];
 		$c = count($data);
-		for($i = 0; $i < $c; ) {
+		for ($i = 0; $i < $c;) {
 			$row[$data[$i++]] = $data[$i++];
 		}
 		if ($this->asArray) {
@@ -336,7 +336,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 		if (count($this->where) == 1) {
 			$pks = (array) reset($this->where);
 		} else {
-			foreach($this->where as $values) {
+			foreach ($this->where as $values) {
 				if (is_array($values)) {
 					// TODO support composite IN for composite PK
 					throw new NotSupportedException('Find by composite PK is not supported by redis ActiveRecord.');
@@ -357,7 +357,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 		}
 		$i = 0;
 		$data = [];
-		foreach($pks as $pk) {
+		foreach ($pks as $pk) {
 			if (++$i > $start && ($limit === null || $i <= $start + $limit)) {
 				$key = $modelClass::keyPrefix() . ':a:' . $modelClass::buildKey($pk);
 				$result = $db->executeCommand('HGETALL', [$key]);
@@ -380,10 +380,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 				return count($data);
 			case 'Column':
 				$column = [];
-				foreach($data as $dataRow) {
+				foreach ($data as $dataRow) {
 					$row = [];
 					$c = count($dataRow);
-					for($i = 0; $i < $c; ) {
+					for ($i = 0; $i < $c;) {
 						$row[$dataRow[$i++]] = $dataRow[$i++];
 					}
 					$column[] = $row[$columnName];
@@ -391,9 +391,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 				return $column;
 			case 'Sum':
 				$sum = 0;
-				foreach($data as $dataRow) {
+				foreach ($data as $dataRow) {
 					$c = count($dataRow);
-					for($i = 0; $i < $c; ) {
+					for ($i = 0; $i < $c;) {
 						if ($dataRow[$i++] == $columnName) {
 							$sum += $dataRow[$i];
 							break;
@@ -404,10 +404,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 			case 'Average':
 				$sum = 0;
 				$count = 0;
-				foreach($data as $dataRow) {
+				foreach ($data as $dataRow) {
 					$count++;
 					$c = count($dataRow);
-					for($i = 0; $i < $c; ) {
+					for ($i = 0; $i < $c;) {
 						if ($dataRow[$i++] == $columnName) {
 							$sum += $dataRow[$i];
 							break;
@@ -417,9 +417,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 				return $sum / $count;
 			case 'Min':
 				$min = null;
-				foreach($data as $dataRow) {
+				foreach ($data as $dataRow) {
 					$c = count($dataRow);
-					for($i = 0; $i < $c; ) {
+					for ($i = 0; $i < $c;) {
 						if ($dataRow[$i++] == $columnName && ($min == null || $dataRow[$i] < $min)) {
 							$min = $dataRow[$i];
 							break;
@@ -429,9 +429,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 				return $min;
 			case 'Max':
 				$max = null;
-				foreach($data as $dataRow) {
+				foreach ($data as $dataRow) {
 					$c = count($dataRow);
-					for($i = 0; $i < $c; ) {
+					for ($i = 0; $i < $c;) {
 						if ($dataRow[$i++] == $columnName && ($max == null || $dataRow[$i] > $max)) {
 							$max = $dataRow[$i];
 							break;
diff --git a/extensions/redis/ActiveRecord.php b/extensions/redis/ActiveRecord.php
index 34c9c05..91af01f 100644
--- a/extensions/redis/ActiveRecord.php
+++ b/extensions/redis/ActiveRecord.php
@@ -139,7 +139,7 @@ class ActiveRecord extends BaseActiveRecord
 			$key = static::keyPrefix() . ':a:' . static::buildKey($pk);
 			// save attributes
 			$args = [$key];
-			foreach($values as $attribute => $value) {
+			foreach ($values as $attribute => $value) {
 				$args[] = $attribute;
 				$args[] = $value;
 			}
@@ -172,13 +172,13 @@ class ActiveRecord extends BaseActiveRecord
 		}
 		$db = static::getDb();
 		$n=0;
-		foreach(static::fetchPks($condition) as $pk) {
+		foreach (static::fetchPks($condition) as $pk) {
 			$newPk = $pk;
 			$pk = static::buildKey($pk);
 			$key = static::keyPrefix() . ':a:' . $pk;
 			// save attributes
 			$args = [$key];
-			foreach($attributes as $attribute => $value) {
+			foreach ($attributes as $attribute => $value) {
 				if (isset($newPk[$attribute])) {
 					$newPk[$attribute] = $value;
 				}
@@ -224,9 +224,9 @@ class ActiveRecord extends BaseActiveRecord
 		}
 		$db = static::getDb();
 		$n=0;
-		foreach(static::fetchPks($condition) as $pk) {
+		foreach (static::fetchPks($condition) as $pk) {
 			$key = static::keyPrefix() . ':a:' . static::buildKey($pk);
-			foreach($counters as $attribute => $value) {
+			foreach ($counters as $attribute => $value) {
 				$db->executeCommand('HINCRBY', [$key, $attribute, $value]);
 			}
 			$n++;
@@ -254,7 +254,7 @@ class ActiveRecord extends BaseActiveRecord
 		$attributeKeys = [];
 		$pks = static::fetchPks($condition);
 		$db->executeCommand('MULTI');
-		foreach($pks as $pk) {
+		foreach ($pks as $pk) {
 			$pk = static::buildKey($pk);
 			$db->executeCommand('LREM', [static::keyPrefix(), 0, $pk]);
 			$attributeKeys[] = static::keyPrefix() . ':a:' . $pk;
@@ -276,9 +276,9 @@ class ActiveRecord extends BaseActiveRecord
 		$primaryKey = static::primaryKey();
 
 		$pks = [];
-		foreach($records as $record) {
+		foreach ($records as $record) {
 			$pk = [];
-			foreach($primaryKey as $key) {
+			foreach ($primaryKey as $key) {
 				$pk[$key] = $record[$key];
 			}
 			$pks[] = $pk;
@@ -304,7 +304,7 @@ class ActiveRecord extends BaseActiveRecord
 			}
 			ksort($key); // ensure order is always the same
 			$isNumeric = true;
-			foreach($key as $value) {
+			foreach ($key as $value) {
 				if (!is_numeric($value)) {
 					$isNumeric = false;
 				}
diff --git a/extensions/redis/Cache.php b/extensions/redis/Cache.php
index 0722b9d..18ac8d7 100644
--- a/extensions/redis/Cache.php
+++ b/extensions/redis/Cache.php
@@ -78,7 +78,7 @@ class Cache extends \yii\caching\Cache
 		parent::init();
 		if (is_string($this->redis)) {
 			$this->redis = Yii::$app->getComponent($this->redis);
-		} else if (is_array($this->redis)) {
+		} elseif (is_array($this->redis)) {
 			if (!isset($this->redis['class'])) {
 				$this->redis['class'] = Connection::className();
 			}
@@ -145,7 +145,7 @@ class Cache extends \yii\caching\Cache
 	protected function setValues($data, $expire)
 	{
 		$args = [];
-		foreach($data as $key => $value) {
+		foreach ($data as $key => $value) {
 			$args[] = $key;
 			$args[] = $value;
 		}
@@ -164,7 +164,7 @@ class Cache extends \yii\caching\Cache
 			}
 			$result = $this->redis->executeCommand('EXEC');
 			array_shift($result);
-			foreach($result as $i => $r) {
+			foreach ($result as $i => $r) {
 				if ($r != 1) {
 					$failedKeys[] = $index[$i];
 				}
diff --git a/extensions/redis/Connection.php b/extensions/redis/Connection.php
index b8bbde2..c7296bc 100644
--- a/extensions/redis/Connection.php
+++ b/extensions/redis/Connection.php
@@ -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;
 	/**
@@ -254,7 +254,7 @@ class Connection extends Component
 		);
 		if ($this->_socket) {
 			if ($this->dataTimeout !== null) {
-				stream_set_timeout($this->_socket, $timeout=(int)$this->dataTimeout, (int) (($this->dataTimeout - $timeout) * 1000000));
+				stream_set_timeout($this->_socket, $timeout = (int)$this->dataTimeout, (int) (($this->dataTimeout - $timeout) * 1000000));
 			}
 			if ($this->password !== null) {
 				$this->executeCommand('AUTH', [$this->password]);
@@ -345,13 +345,13 @@ class Connection extends Component
 	 * for details on the mentioned reply types.
 	 * @trows Exception for commands that return [error reply](http://redis.io/topics/protocol#error-reply).
 	 */
-	public function executeCommand($name, $params=[])
+	public function executeCommand($name, $params = [])
 	{
 		$this->open();
 
 		array_unshift($params, $name);
 		$command = '*' . count($params) . "\r\n";
-		foreach($params as $arg) {
+		foreach ($params as $arg) {
 			$command .= '$' . mb_strlen($arg, '8bit') . "\r\n" . $arg . "\r\n";
 		}
 
diff --git a/extensions/redis/LuaScriptBuilder.php b/extensions/redis/LuaScriptBuilder.php
index 1c1082b..9fd483e 100644
--- a/extensions/redis/LuaScriptBuilder.php
+++ b/extensions/redis/LuaScriptBuilder.php
@@ -133,6 +133,7 @@ class LuaScriptBuilder extends \yii\base\Object
 	 * @param ActiveQuery $query the query used to build the script
 	 * @param string $buildResult the lua script for building the result
 	 * @param string $return the lua variable that should be returned
+	 * @throws yii\base\NotSupportedException when query contains unsupported order by condition
 	 * @return string
 	 */
 	private function build($query, $buildResult, $return)
@@ -155,7 +156,7 @@ class LuaScriptBuilder extends \yii\base\Object
 		$modelClass = $query->modelClass;
 		$key = $this->quoteValue($modelClass::keyPrefix());
 		$loadColumnValues = '';
-		foreach($columns as $column => $alias) {
+		foreach ($columns as $column => $alias) {
 			$loadColumnValues .= "local $alias=redis.call('HGET',$key .. ':a:' .. pk, '$column')\n";
 		}
 
diff --git a/extensions/redis/README.md b/extensions/redis/README.md
index eff0a3f..02ce11a 100644
--- a/extensions/redis/README.md
+++ b/extensions/redis/README.md
@@ -160,7 +160,7 @@ class Customer extends \yii\redis\ActiveRecord
 	 */
 	public static function active($query)
 	{
-		$query->andWhere(array('status' => 1));
+		$query->andWhere(['status' => 1]);
 	}
 }
 ```
diff --git a/extensions/redis/Session.php b/extensions/redis/Session.php
index 04e9074..a9c3bdd 100644
--- a/extensions/redis/Session.php
+++ b/extensions/redis/Session.php
@@ -81,7 +81,7 @@ class Session extends \yii\web\Session
 	{
 		if (is_string($this->redis)) {
 			$this->redis = Yii::$app->getComponent($this->redis);
-		} else if (is_array($this->redis)) {
+		} elseif (is_array($this->redis)) {
 			if (!isset($this->redis['class'])) {
 				$this->redis['class'] = Connection::className();
 			}
diff --git a/extensions/sphinx/ActiveQuery.php b/extensions/sphinx/ActiveQuery.php
index db56090..42391f9 100644
--- a/extensions/sphinx/ActiveQuery.php
+++ b/extensions/sphinx/ActiveQuery.php
@@ -135,7 +135,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
 			}
 			$models = $this->fillUpSnippets($models);
 			if (!$this->asArray) {
-				foreach($models as $model) {
+				foreach ($models as $model) {
 					$model->afterFind();
 				}
 			}
diff --git a/extensions/sphinx/ColumnSchema.php b/extensions/sphinx/ColumnSchema.php
index 5edca85..a7736f7 100644
--- a/extensions/sphinx/ColumnSchema.php
+++ b/extensions/sphinx/ColumnSchema.php
@@ -78,4 +78,4 @@ class ColumnSchema extends Object
 		}
 		return $value;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/sphinx/Connection.php b/extensions/sphinx/Connection.php
index b732d97..c9c67ab 100644
--- a/extensions/sphinx/Connection.php
+++ b/extensions/sphinx/Connection.php
@@ -6,6 +6,7 @@
  */
 
 namespace yii\sphinx;
+
 use yii\base\NotSupportedException;
 
 /**
diff --git a/extensions/sphinx/IndexSchema.php b/extensions/sphinx/IndexSchema.php
index b93a8f0..4e61219 100644
--- a/extensions/sphinx/IndexSchema.php
+++ b/extensions/sphinx/IndexSchema.php
@@ -59,4 +59,4 @@ class IndexSchema extends Object
 	{
 		return array_keys($this->columns);
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/sphinx/Query.php b/extensions/sphinx/Query.php
index 8ad5efc..b9b9abd 100644
--- a/extensions/sphinx/Query.php
+++ b/extensions/sphinx/Query.php
@@ -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)
diff --git a/extensions/sphinx/QueryBuilder.php b/extensions/sphinx/QueryBuilder.php
index 8e1d5c4..6f99bc8 100644
--- a/extensions/sphinx/QueryBuilder.php
+++ b/extensions/sphinx/QueryBuilder.php
@@ -422,7 +422,7 @@ class QueryBuilder extends Object
 				if (strpos($column, '(') === false) {
 					$column = $this->db->quoteColumnName($column);
 				}
-				$columns[$i] = "$column AS " . $this->db->quoteColumnName($i);;
+				$columns[$i] = "$column AS " . $this->db->quoteColumnName($i);
 			} elseif (strpos($column, '(') === false) {
 				if (preg_match('/^(.*?)(?i:\s+as\s+|\s+)([\w\-_\.]+)$/', $column, $matches)) {
 					$columns[$i] = $this->db->quoteColumnName($matches[1]) . ' AS ' . $this->db->quoteColumnName($matches[2]);
@@ -907,7 +907,8 @@ class QueryBuilder extends Object
 	 * @param array $params the binding parameters to be populated
 	 * @return string SQL expression, which represents column value
 	 */
-	protected function composeColumnValue($indexes, $columnName, $value, &$params) {
+	protected function composeColumnValue($indexes, $columnName, $value, &$params)
+	{
 		if ($value === null) {
 			return 'NULL';
 		} elseif ($value instanceof Expression) {
diff --git a/extensions/sphinx/Schema.php b/extensions/sphinx/Schema.php
index c583d2f..81a7a57 100644
--- a/extensions/sphinx/Schema.php
+++ b/extensions/sphinx/Schema.php
@@ -486,4 +486,4 @@ class Schema extends Object
 
 		return $column;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/twig/TwigSimpleFileLoader.php b/extensions/twig/TwigSimpleFileLoader.php
index 281d465..4449f0a 100644
--- a/extensions/twig/TwigSimpleFileLoader.php
+++ b/extensions/twig/TwigSimpleFileLoader.php
@@ -68,7 +68,8 @@ class TwigSimpleFileLoader implements \Twig_LoaderInterface
 	 * @param string $name file name
 	 * @return string absolute path of file
 	 */
-	protected  function getFilePath($name){
+	protected function getFilePath($name)
+	{
 		return $this->_dir . '/' . $name;
 	}
-}
\ No newline at end of file
+}
diff --git a/extensions/twig/ViewRenderer.php b/extensions/twig/ViewRenderer.php
index 5792806..325fa44 100644
--- a/extensions/twig/ViewRenderer.php
+++ b/extensions/twig/ViewRenderer.php
@@ -33,46 +33,46 @@ class ViewRenderer extends BaseViewRenderer
 	 * @see http://twig.sensiolabs.org/doc/api.html#environment-options
 	 */
 	public $options = [];
-    /**
-     * @var array Objects or static classes.
-     * Keys of the array are names to call in template, values are objects or names of static classes.
-     * Example: `['html' => '\yii\helpers\Html']`.
-     * In the template you can use it like this: `{{ html.a('Login', 'site/login') | raw }}`.
-     */
-    public $globals = [];
-    /**
-     * @var array Custom functions.
-     * Keys of the array are names to call in template, values are names of functions or static methods of some class.
-     * Example: `['rot13' => 'str_rot13', 'a' => '\yii\helpers\Html::a']`.
-     * In the template you can use it like this: `{{ rot13('test') }}` or `{{ a('Login', 'site/login') | raw }}`.
-     */
-    public $functions = [];
-    /**
-     * @var array Custom filters.
-     * Keys of the array are names to call in template, values are names of functions or static methods of some class.
-     * Example: `['rot13' => 'str_rot13', 'jsonEncode' => '\yii\helpers\Json::encode']`.
-     * In the template you can use it like this: `{{ 'test'|rot13 }}` or `{{ model|jsonEncode }}`.
-     */
-    public $filters = [];
-    /**
-     * @var array Custom extensions.
-     * Example: `['Twig_Extension_Sandbox', 'Twig_Extension_Text']`
-     */
-    public $extensions = [];
-    /**
-     * @var array Twig lexer options.
-     * Example: Smarty-like syntax:
-     * ```php
-     * [
-     *     'tag_comment'  => ['{*', '*}'],
-     *     'tag_block'    => ['{', '}'],
-     *     'tag_variable' => ['{$', '}']
-     * ]
-     * ```
-     * @see http://twig.sensiolabs.org/doc/recipes.html#customizing-the-syntax
-     */
-    public $lexerOptions = [];
-    /**
+	/**
+	 * @var array Objects or static classes.
+	 * Keys of the array are names to call in template, values are objects or names of static classes.
+	 * Example: `['html' => '\yii\helpers\Html']`.
+	 * In the template you can use it like this: `{{ html.a('Login', 'site/login') | raw }}`.
+	 */
+	public $globals = [];
+	/**
+	 * @var array Custom functions.
+	 * Keys of the array are names to call in template, values are names of functions or static methods of some class.
+	 * Example: `['rot13' => 'str_rot13', 'a' => '\yii\helpers\Html::a']`.
+	 * In the template you can use it like this: `{{ rot13('test') }}` or `{{ a('Login', 'site/login') | raw }}`.
+	 */
+	public $functions = [];
+	/**
+	 * @var array Custom filters.
+	 * Keys of the array are names to call in template, values are names of functions or static methods of some class.
+	 * Example: `['rot13' => 'str_rot13', 'jsonEncode' => '\yii\helpers\Json::encode']`.
+	 * In the template you can use it like this: `{{ 'test'|rot13 }}` or `{{ model|jsonEncode }}`.
+	 */
+	public $filters = [];
+	/**
+	 * @var array Custom extensions.
+	 * Example: `['Twig_Extension_Sandbox', 'Twig_Extension_Text']`
+	 */
+	public $extensions = [];
+	/**
+	 * @var array Twig lexer options.
+	 * Example: Smarty-like syntax:
+	 * ```php
+	 * [
+	 *     'tag_comment'  => ['{*', '*}'],
+	 *     'tag_block'    => ['{', '}'],
+	 *     'tag_variable' => ['{$', '}']
+	 * ]
+	 * ```
+	 * @see http://twig.sensiolabs.org/doc/recipes.html#customizing-the-syntax
+	 */
+	public $lexerOptions = [];
+	/**
 	 * @var \Twig_Environment twig environment object that do all rendering twig templates
 	 */
 	public $twig;
@@ -118,7 +118,7 @@ class ViewRenderer extends BaseViewRenderer
 		}
 
 		// Adding global 'void' function (usage: {{void(App.clientScript.registerScriptFile(...))}})
-		$this->twig->addFunction('void', new \Twig_Function_Function(function($argument){
+		$this->twig->addFunction('void', new \Twig_Function_Function(function ($argument) {
 		}));
 
 		$this->twig->addFunction('path', new \Twig_Function_Function(function ($path, $args = []) {
@@ -162,7 +162,7 @@ class ViewRenderer extends BaseViewRenderer
 	}
 
 	/**
- 	 * Adds custom functions
+	 * Adds custom functions
 	 * @param array $functions @see self::$functions
 	 */
 	public function addFunctions($functions)
diff --git a/extensions/twig/ViewRendererStaticClassProxy.php b/extensions/twig/ViewRendererStaticClassProxy.php
index 46a6dc2..343cdad 100644
--- a/extensions/twig/ViewRendererStaticClassProxy.php
+++ b/extensions/twig/ViewRendererStaticClassProxy.php
@@ -19,7 +19,8 @@ class ViewRendererStaticClassProxy
 {
 	private $_staticClassName;
 
-    public function __construct($staticClassName) {
+	public function __construct($staticClassName)
+	{
 		$this->_staticClassName = $staticClassName;
 	}
 
@@ -40,4 +41,4 @@ class ViewRendererStaticClassProxy
 	{
 		return call_user_func_array([$this->_staticClassName, $method], $arguments);
 	}
-}
\ No newline at end of file
+}
diff --git a/framework/assets/yii.js b/framework/assets/yii.js
index 2f99226..b85d19b 100644
--- a/framework/assets/yii.js
+++ b/framework/assets/yii.js
@@ -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]);
 			}
diff --git a/framework/base/ErrorException.php b/framework/base/ErrorException.php
index 5ab04e6..affe73b 100644
--- a/framework/base/ErrorException.php
+++ b/framework/base/ErrorException.php
@@ -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)
 	{
diff --git a/framework/db/BaseActiveRecord.php b/framework/db/BaseActiveRecord.php
index 26c23b3..fd173be 100644
--- a/framework/db/BaseActiveRecord.php
+++ b/framework/db/BaseActiveRecord.php
@@ -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)
 	{
diff --git a/framework/db/Query.php b/framework/db/Query.php
index 582e7f5..18f8c02 100644
--- a/framework/db/Query.php
+++ b/framework/db/Query.php
@@ -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)
diff --git a/framework/helpers/BaseConsole.php b/framework/helpers/BaseConsole.php
index 8d37058..458f212 100644
--- a/framework/helpers/BaseConsole.php
+++ b/framework/helpers/BaseConsole.php
@@ -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
diff --git a/framework/helpers/BaseFileHelper.php b/framework/helpers/BaseFileHelper.php
index 6da4712..52448bf 100644
--- a/framework/helpers/BaseFileHelper.php
+++ b/framework/helpers/BaseFileHelper.php
@@ -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 = [])
 	{
diff --git a/framework/helpers/BaseInflector.php b/framework/helpers/BaseInflector.php
index 3865588..1988945 100644
--- a/framework/helpers/BaseInflector.php
+++ b/framework/helpers/BaseInflector.php
@@ -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)
diff --git a/framework/i18n/MessageFormatter.php b/framework/i18n/MessageFormatter.php
index c3d8c56..022e882 100644
--- a/framework/i18n/MessageFormatter.php
+++ b/framework/i18n/MessageFormatter.php
@@ -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)
 	{
diff --git a/framework/requirements/YiiRequirementChecker.php b/framework/requirements/YiiRequirementChecker.php
index f0c7403..4b00940 100644
--- a/framework/requirements/YiiRequirementChecker.php
+++ b/framework/requirements/YiiRequirementChecker.php
@@ -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)
diff --git a/framework/requirements/views/web/index.php b/framework/requirements/views/web/index.php
index a2aa59d..7ae6aee 100644
--- a/framework/requirements/views/web/index.php
+++ b/framework/requirements/views/web/index.php
@@ -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'] ?>
diff --git a/framework/web/AssetConverter.php b/framework/web/AssetConverter.php
index 23062d9..79e5e4d 100644
--- a/framework/web/AssetConverter.php
+++ b/framework/web/AssetConverter.php
@@ -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.
 	 */
diff --git a/framework/widgets/LinkPager.php b/framework/widgets/LinkPager.php
index 22cfdf0..9f7efc0 100644
--- a/framework/widgets/LinkPager.php
+++ b/framework/widgets/LinkPager.php
@@ -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()
diff --git a/tests/unit/extensions/elasticsearch/ElasticSearchTestCase.php b/tests/unit/extensions/elasticsearch/ElasticSearchTestCase.php
index c74ad4b..2c280ed 100644
--- a/tests/unit/extensions/elasticsearch/ElasticSearchTestCase.php
+++ b/tests/unit/extensions/elasticsearch/ElasticSearchTestCase.php
@@ -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)
diff --git a/tests/unit/extensions/redis/RedisCacheTest.php b/tests/unit/extensions/redis/RedisCacheTest.php
index 78ddf06..d7a230c 100644
--- a/tests/unit/extensions/redis/RedisCacheTest.php
+++ b/tests/unit/extensions/redis/RedisCacheTest.php
@@ -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);
 		}
 
diff --git a/tests/unit/extensions/redis/RedisTestCase.php b/tests/unit/extensions/redis/RedisTestCase.php
index 265c52b..9857e8d 100644
--- a/tests/unit/extensions/redis/RedisTestCase.php
+++ b/tests/unit/extensions/redis/RedisTestCase.php
@@ -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)
diff --git a/tests/unit/extensions/sphinx/SchemaTest.php b/tests/unit/extensions/sphinx/SchemaTest.php
index b1a22ab..a6925b9 100644
--- a/tests/unit/extensions/sphinx/SchemaTest.php
+++ b/tests/unit/extensions/sphinx/SchemaTest.php
@@ -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);
diff --git a/tests/unit/extensions/sphinx/SphinxTestCase.php b/tests/unit/extensions/sphinx/SphinxTestCase.php
index 89e9692..1c756cc 100644
--- a/tests/unit/extensions/sphinx/SphinxTestCase.php
+++ b/tests/unit/extensions/sphinx/SphinxTestCase.php
@@ -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)
diff --git a/tests/unit/framework/caching/CacheTestCase.php b/tests/unit/framework/caching/CacheTestCase.php
index afd514d..0a8737d 100644
--- a/tests/unit/framework/caching/CacheTestCase.php
+++ b/tests/unit/framework/caching/CacheTestCase.php
@@ -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;
diff --git a/tests/unit/framework/caching/DbCacheTest.php b/tests/unit/framework/caching/DbCacheTest.php
index c2d03e2..bfb30fa 100644
--- a/tests/unit/framework/caching/DbCacheTest.php
+++ b/tests/unit/framework/caching/DbCacheTest.php
@@ -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)
diff --git a/tests/unit/framework/db/DatabaseTestCase.php b/tests/unit/framework/db/DatabaseTestCase.php
index 8ef1234..f751e0f 100644
--- a/tests/unit/framework/db/DatabaseTestCase.php
+++ b/tests/unit/framework/db/DatabaseTestCase.php
@@ -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)
diff --git a/tests/unit/framework/db/SchemaTest.php b/tests/unit/framework/db/SchemaTest.php
index 05a0ff2..5aeca47 100644
--- a/tests/unit/framework/db/SchemaTest.php
+++ b/tests/unit/framework/db/SchemaTest.php
@@ -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);
diff --git a/tests/unit/framework/db/cubrid/CubridSchemaTest.php b/tests/unit/framework/db/cubrid/CubridSchemaTest.php
index 41f4110..4cbf741 100644
--- a/tests/unit/framework/db/cubrid/CubridSchemaTest.php
+++ b/tests/unit/framework/db/cubrid/CubridSchemaTest.php
@@ -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);
diff --git a/tests/unit/framework/helpers/FileHelperTest.php b/tests/unit/framework/helpers/FileHelperTest.php
index d076631..872e3df 100644
--- a/tests/unit/framework/helpers/FileHelperTest.php
+++ b/tests/unit/framework/helpers/FileHelperTest.php
@@ -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;
diff --git a/tests/unit/framework/log/TargetTest.php b/tests/unit/framework/log/TargetTest.php
index fc7a0a2..2e1223e 100644
--- a/tests/unit/framework/log/TargetTest.php
+++ b/tests/unit/framework/log/TargetTest.php
@@ -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]);
 		}
 	}