diff --git a/apps/advanced/common/models/LoginForm.php b/apps/advanced/common/models/LoginForm.php
index 659f01c..70c0ffd 100644
--- a/apps/advanced/common/models/LoginForm.php
+++ b/apps/advanced/common/models/LoginForm.php
@@ -1,7 +1,6 @@
 <?php
 namespace common\models;
 
-use common\models\User;
 use yii\base\Model;
 use Yii;
 
diff --git a/apps/basic/tests/_pages/ContactPage.php b/apps/basic/tests/_pages/ContactPage.php
index f8a1236..05a0146 100644
--- a/apps/basic/tests/_pages/ContactPage.php
+++ b/apps/basic/tests/_pages/ContactPage.php
@@ -13,10 +13,10 @@ class ContactPage extends BasePage
 	 */
 	public function submit(array $contactData)
 	{
-		$data = [];
-		foreach ($contactData as $name => $value) {
-			$data["ContactForm[$name]"] = $value;
+		foreach ($contactData as $field => $value) {
+			$inputType = $field === 'body' ? 'textarea' : 'input';
+			$this->guy->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value);
 		}
-		$this->guy->submitForm('#contact-form', $data);
+		$this->guy->click('Submit', '#contact-form');
 	}
 }
diff --git a/apps/basic/tests/_pages/LoginPage.php b/apps/basic/tests/_pages/LoginPage.php
index aae5e0f..f5ace25 100644
--- a/apps/basic/tests/_pages/LoginPage.php
+++ b/apps/basic/tests/_pages/LoginPage.php
@@ -14,9 +14,8 @@ class LoginPage extends BasePage
 	 */
 	public function login($username, $password)
 	{
-		$this->guy->submitForm('#login-form', [
-			'LoginForm[username]' => $username,
-			'LoginForm[password]' => $password,
-		]);
+		$this->guy->fillField('input[name="LoginForm[username]"]',$username);
+		$this->guy->fillField('input[name="LoginForm[password]"]',$password);
+		$this->guy->click('Login','#login-form');
 	}
 }
diff --git a/extensions/apidoc/models/Context.php b/extensions/apidoc/models/Context.php
index 168bc01..c71f40d 100644
--- a/extensions/apidoc/models/Context.php
+++ b/extensions/apidoc/models/Context.php
@@ -9,7 +9,6 @@ namespace yii\apidoc\models;
 
 use phpDocumentor\Reflection\FileReflector;
 use yii\base\Component;
-use yii\base\Exception;
 
 /**
  *
diff --git a/extensions/apidoc/models/FunctionDoc.php b/extensions/apidoc/models/FunctionDoc.php
index 190efbd..2a482f1 100644
--- a/extensions/apidoc/models/FunctionDoc.php
+++ b/extensions/apidoc/models/FunctionDoc.php
@@ -11,7 +11,6 @@ use phpDocumentor\Reflection\DocBlock\Tag\ParamTag;
 use phpDocumentor\Reflection\DocBlock\Tag\PropertyTag;
 use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag;
 use phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag;
-use yii\base\Exception;
 
 /**
  * Represents API documentation information for a `function`.
diff --git a/extensions/apidoc/models/PropertyDoc.php b/extensions/apidoc/models/PropertyDoc.php
index 827b48c..85c482c 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 $i => $tag) {
+		foreach($this->tags as $tag) {
 			if ($tag instanceof VarTag) {
 				$this->type = $tag->getType();
 				$this->types = $tag->getTypes();
diff --git a/extensions/apidoc/models/TypeDoc.php b/extensions/apidoc/models/TypeDoc.php
index 739df3c..aad261d 100644
--- a/extensions/apidoc/models/TypeDoc.php
+++ b/extensions/apidoc/models/TypeDoc.php
@@ -8,7 +8,6 @@
 namespace yii\apidoc\models;
 
 use phpDocumentor\Reflection\DocBlock\Tag\AuthorTag;
-use yii\base\Exception;
 use yii\helpers\StringHelper;
 
 /**
diff --git a/extensions/apidoc/templates/bootstrap/Renderer.php b/extensions/apidoc/templates/bootstrap/Renderer.php
index 9f58619..b40f53a 100644
--- a/extensions/apidoc/templates/bootstrap/Renderer.php
+++ b/extensions/apidoc/templates/bootstrap/Renderer.php
@@ -11,7 +11,6 @@ use yii\apidoc\models\Context;
 use yii\console\Controller;
 use Yii;
 use yii\helpers\Console;
-use yii\helpers\FileHelper;
 
 /**
  *
diff --git a/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php b/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php
index 0aef5eb..1ae8021 100644
--- a/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php
+++ b/extensions/apidoc/templates/bootstrap/assets/AssetBundle.php
@@ -6,7 +6,6 @@
  */
 
 namespace yii\apidoc\templates\bootstrap\assets;
-use yii\web\JqueryAsset;
 use yii\web\View;
 
 /**
diff --git a/extensions/apidoc/templates/bootstrap/layouts/guide.php b/extensions/apidoc/templates/bootstrap/layouts/guide.php
index 56f2ecc..6673a97 100644
--- a/extensions/apidoc/templates/bootstrap/layouts/guide.php
+++ b/extensions/apidoc/templates/bootstrap/layouts/guide.php
@@ -1,6 +1,5 @@
 <?php
 use yii\apidoc\templates\bootstrap\SideNavWidget;
-use yii\helpers\StringHelper;
 
 /**
  * @var yii\web\View $this
diff --git a/extensions/apidoc/templates/bootstrap/layouts/main.php b/extensions/apidoc/templates/bootstrap/layouts/main.php
index 90708ba..1e953a6 100644
--- a/extensions/apidoc/templates/bootstrap/layouts/main.php
+++ b/extensions/apidoc/templates/bootstrap/layouts/main.php
@@ -1,10 +1,7 @@
 <?php
-use yii\apidoc\templates\bootstrap\SideNavWidget;
 use yii\bootstrap\Nav;
 use yii\bootstrap\NavBar;
 use yii\helpers\Html;
-use yii\helpers\StringHelper;
-use yii\widgets\Menu;
 
 /**
  * @var yii\web\View $this
diff --git a/extensions/apidoc/templates/offline/Renderer.php b/extensions/apidoc/templates/offline/Renderer.php
index 37bf17a..030182b 100644
--- a/extensions/apidoc/templates/offline/Renderer.php
+++ b/extensions/apidoc/templates/offline/Renderer.php
@@ -6,11 +6,7 @@
  */
 
 namespace yii\apidoc\templates\offline;
-use yii\apidoc\models\Context;
-use yii\console\Controller;
 use Yii;
-use yii\helpers\Console;
-use yii\helpers\FileHelper;
 
 /**
  *
diff --git a/extensions/apidoc/templates/offline/assets/AssetBundle.php b/extensions/apidoc/templates/offline/assets/AssetBundle.php
index e8c7024..ff3f809 100644
--- a/extensions/apidoc/templates/offline/assets/AssetBundle.php
+++ b/extensions/apidoc/templates/offline/assets/AssetBundle.php
@@ -6,7 +6,6 @@
  */
 
 namespace yii\apidoc\templates\offline\assets;
-use yii\web\JqueryAsset;
 use yii\web\View;
 
 /**
diff --git a/extensions/apidoc/templates/online/Renderer.php b/extensions/apidoc/templates/online/Renderer.php
index 327c806..b827650 100644
--- a/extensions/apidoc/templates/online/Renderer.php
+++ b/extensions/apidoc/templates/online/Renderer.php
@@ -11,8 +11,6 @@ use yii\apidoc\models\TypeDoc;
 use yii\console\Controller;
 use Yii;
 use yii\helpers\Console;
-use yii\helpers\FileHelper;
-use yii\helpers\StringHelper;
 
 /**
  *
diff --git a/extensions/authclient/AuthAction.php b/extensions/authclient/AuthAction.php
index 0edf0a5..37dd61b 100644
--- a/extensions/authclient/AuthAction.php
+++ b/extensions/authclient/AuthAction.php
@@ -315,7 +315,7 @@ class AuthAction extends Action
 			return Yii::$app->getResponse()->redirect($url);
 		} else {
 			// Upgrade to access token.
-			$accessToken = $client->fetchAccessToken();
+			$client->fetchAccessToken();
 			return $this->authSuccess($client);
 		}
 	}
diff --git a/extensions/debug/Module.php b/extensions/debug/Module.php
index a63225d..890d6ae 100644
--- a/extensions/debug/Module.php
+++ b/extensions/debug/Module.php
@@ -11,7 +11,6 @@ use Yii;
 use yii\base\Application;
 use yii\web\View;
 use yii\web\ForbiddenHttpException;
-use yii\helpers\ArrayHelper;
 
 /**
  * The Yii Debug Module provides the debug toolbar and debugger
@@ -40,7 +39,8 @@ class Module extends \yii\base\Module
 	/**
 	 * @var array list of debug panels. The array keys are the panel IDs, and values are the corresponding
 	 * panel class names or configuration arrays. This will be merged with [[corePanels()]].
-	 * You may set a panel to be false to disable a core panel.
+	 * You may reconfigure a core panel via this property by using the same panel ID.
+	 * You may also disable a core panel by setting it to be false in this property.
 	 */
 	public $panels = [];
 	/**
@@ -76,7 +76,19 @@ class Module extends \yii\base\Module
 			Yii::$app->getView()->on(View::EVENT_END_BODY, [$this, 'renderToolbar']);
 		});
 
-		$this->panels = array_filter(ArrayHelper::merge($this->corePanels(), $this->panels));
+		// merge custom panels and core panels so that they are ordered mainly by custom panels
+		if (empty($this->panels)) {
+			$this->panels = $this->corePanels();
+		} else {
+			$corePanels = $this->corePanels();
+			foreach ($corePanels as $id => $config) {
+				if (isset($this->panels[$id])) {
+					unset($corePanels[$id]);
+				}
+			}
+			$this->panels = array_filter(array_merge($corePanels, $this->panels));
+		}
+
 		foreach ($this->panels as $id => $config) {
 			$config['module'] = $this;
 			$config['id'] = $id;
diff --git a/extensions/gii/generators/model/Generator.php b/extensions/gii/generators/model/Generator.php
index 3875f3d..538637c 100644
--- a/extensions/gii/generators/model/Generator.php
+++ b/extensions/gii/generators/model/Generator.php
@@ -252,7 +252,7 @@ class Generator extends \yii\gii\Generator
 		try {
 			$db = $this->getDbConnection();
 			$uniqueIndexes = $db->getSchema()->findUniqueIndexes($table);
-			foreach ($uniqueIndexes as $indexName => $uniqueColumns) {
+			foreach ($uniqueIndexes as $uniqueColumns) {
 				// Avoid validating auto incrementable columns
 				if (!$this->isUniqueColumnAutoIncrementable($table, $uniqueColumns)) {
 					$attributesCount = count($uniqueColumns);
diff --git a/extensions/mongodb/ActiveRecord.php b/extensions/mongodb/ActiveRecord.php
index 87e7ea0..ce8ac81 100644
--- a/extensions/mongodb/ActiveRecord.php
+++ b/extensions/mongodb/ActiveRecord.php
@@ -8,9 +8,7 @@
 namespace yii\mongodb;
 
 use yii\base\InvalidConfigException;
-use yii\base\InvalidParamException;
 use yii\db\BaseActiveRecord;
-use yii\base\UnknownMethodException;
 use yii\db\StaleObjectException;
 use yii\helpers\Inflector;
 use yii\helpers\StringHelper;
diff --git a/extensions/mongodb/Session.php b/extensions/mongodb/Session.php
index 4966a01..f2ce8b3 100644
--- a/extensions/mongodb/Session.php
+++ b/extensions/mongodb/Session.php
@@ -8,8 +8,6 @@
 namespace yii\mongodb;
 
 use Yii;
-use yii\mongodb\Connection;
-use yii\mongodb\Query;
 use yii\base\InvalidConfigException;
 
 /**
diff --git a/extensions/redis/ActiveQuery.php b/extensions/redis/ActiveQuery.php
index 6ce8a4b..b5f8beb 100644
--- a/extensions/redis/ActiveQuery.php
+++ b/extensions/redis/ActiveQuery.php
@@ -288,7 +288,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
 		if (count($this->where) == 1) {
 			$pks = (array) reset($this->where);
 		} else {
-			foreach($this->where as $column => $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.');
diff --git a/extensions/redis/Connection.php b/extensions/redis/Connection.php
index b05223d..b8bbde2 100644
--- a/extensions/redis/Connection.php
+++ b/extensions/redis/Connection.php
@@ -8,7 +8,6 @@
 namespace yii\redis;
 
 use yii\base\Component;
-use yii\base\InvalidConfigException;
 use yii\db\Exception;
 use yii\helpers\Inflector;
 
diff --git a/extensions/redis/LuaScriptBuilder.php b/extensions/redis/LuaScriptBuilder.php
index f49189e..3da5d3d 100644
--- a/extensions/redis/LuaScriptBuilder.php
+++ b/extensions/redis/LuaScriptBuilder.php
@@ -336,7 +336,7 @@ EOF;
 		}
 		$columnAlias = $this->addColumn($column, $columns);
 		$parts = [];
-		foreach ($values as $i => $value) {
+		foreach ($values as $value) {
 			if (is_array($value)) {
 				$value = isset($value[$column]) ? $value[$column] : null;
 			}
diff --git a/extensions/sphinx/IndexSchema.php b/extensions/sphinx/IndexSchema.php
index 2908e82..b93a8f0 100644
--- a/extensions/sphinx/IndexSchema.php
+++ b/extensions/sphinx/IndexSchema.php
@@ -8,7 +8,6 @@
 namespace yii\sphinx;
 
 use yii\base\Object;
-use yii\base\InvalidParamException;
 
 /**
  * IndexSchema represents the metadata of a Sphinx index.
diff --git a/framework/db/ActiveQueryTrait.php b/framework/db/ActiveQueryTrait.php
index c82bd33..97eb312 100644
--- a/framework/db/ActiveQueryTrait.php
+++ b/framework/db/ActiveQueryTrait.php
@@ -6,7 +6,6 @@
  */
 
 namespace yii\db;
-use yii\base\InvalidCallException;
 
 /**
  * ActiveQueryTrait implements the common methods and properties for active record query classes.
diff --git a/framework/helpers/BaseConsole.php b/framework/helpers/BaseConsole.php
index 880fd25..8d37058 100644
--- a/framework/helpers/BaseConsole.php
+++ b/framework/helpers/BaseConsole.php
@@ -414,7 +414,7 @@ class BaseConsole
 							break;
 						case 0: // ansi reset
 							$return = '';
-							for ($n = $tags; $tags > 0; $tags--) {
+							for (; $tags > 0; $tags--) {
 								$return .= '</span>';
 							}
 							return $return;
diff --git a/framework/helpers/BaseStringHelper.php b/framework/helpers/BaseStringHelper.php
index e99d5a3..06fbed6 100644
--- a/framework/helpers/BaseStringHelper.php
+++ b/framework/helpers/BaseStringHelper.php
@@ -7,8 +7,6 @@
 
 namespace yii\helpers;
 
-use yii\base\InvalidParamException;
-
 /**
  * BaseStringHelper provides concrete implementation for [[StringHelper]].
  *
diff --git a/tests/unit/data/ar/Customer.php b/tests/unit/data/ar/Customer.php
index 0891b15..869d905 100644
--- a/tests/unit/data/ar/Customer.php
+++ b/tests/unit/data/ar/Customer.php
@@ -1,7 +1,6 @@
 <?php
 namespace yiiunit\data\ar;
 
-use yii\db\ActiveQuery;
 use yiiunit\framework\db\ActiveRecordTest;
 
 /**
diff --git a/tests/unit/data/ar/mongodb/Customer.php b/tests/unit/data/ar/mongodb/Customer.php
index 01f545f..01bcb3d 100644
--- a/tests/unit/data/ar/mongodb/Customer.php
+++ b/tests/unit/data/ar/mongodb/Customer.php
@@ -2,8 +2,6 @@
 
 namespace yiiunit\data\ar\mongodb;
 
-use yii\mongodb\ActiveQuery;
-
 class Customer extends ActiveRecord
 {
 	public static function collectionName()
diff --git a/tests/unit/data/ar/redis/ActiveRecord.php b/tests/unit/data/ar/redis/ActiveRecord.php
index 9f6d526..9d5caf0 100644
--- a/tests/unit/data/ar/redis/ActiveRecord.php
+++ b/tests/unit/data/ar/redis/ActiveRecord.php
@@ -7,8 +7,6 @@
 
 namespace yiiunit\data\ar\redis;
 
-use yii\redis\Connection;
-
 /**
  * ActiveRecord is ...
  *
diff --git a/tests/unit/data/ar/redis/Customer.php b/tests/unit/data/ar/redis/Customer.php
index 8e5a1b8..da5d275 100644
--- a/tests/unit/data/ar/redis/Customer.php
+++ b/tests/unit/data/ar/redis/Customer.php
@@ -2,7 +2,6 @@
 
 namespace yiiunit\data\ar\redis;
 
-use yii\redis\ActiveQuery;
 use yiiunit\extensions\redis\ActiveRecordTest;
 
 class Customer extends ActiveRecord
diff --git a/tests/unit/data/ar/sphinx/ArticleIndex.php b/tests/unit/data/ar/sphinx/ArticleIndex.php
index 66d6beb..fa8939b 100644
--- a/tests/unit/data/ar/sphinx/ArticleIndex.php
+++ b/tests/unit/data/ar/sphinx/ArticleIndex.php
@@ -1,8 +1,6 @@
 <?php
 namespace yiiunit\data\ar\sphinx;
 
-use yii\sphinx\ActiveQuery;
-
 class ArticleIndex extends ActiveRecord
 {
 	public $custom_column;
diff --git a/tests/unit/extensions/authclient/BaseOAuthTest.php b/tests/unit/extensions/authclient/BaseOAuthTest.php
index aa5f6b1..025432c 100644
--- a/tests/unit/extensions/authclient/BaseOAuthTest.php
+++ b/tests/unit/extensions/authclient/BaseOAuthTest.php
@@ -4,7 +4,6 @@ namespace yiiunit\extensions\authclient;
 
 use yii\authclient\signature\PlainText;
 use yii\authclient\OAuthToken;
-use yiiunit\extensions\authclient\TestCase;
 use yii\authclient\BaseOAuth;
 
 class BaseOAuthTest extends TestCase
diff --git a/tests/unit/extensions/authclient/CollectionTest.php b/tests/unit/extensions/authclient/CollectionTest.php
index 3e0f5d0..3c7b336 100644
--- a/tests/unit/extensions/authclient/CollectionTest.php
+++ b/tests/unit/extensions/authclient/CollectionTest.php
@@ -4,7 +4,6 @@ namespace yiiunit\extensions\authclient;
 
 use yii\authclient\Collection;
 use yii\authclient\BaseClient;
-use yiiunit\extensions\authclient\TestCase;
 
 class CollectionTest extends TestCase
 {
diff --git a/tests/unit/extensions/elasticsearch/ActiveRecordTest.php b/tests/unit/extensions/elasticsearch/ActiveRecordTest.php
index 2eb59d1..9aaf25e 100644
--- a/tests/unit/extensions/elasticsearch/ActiveRecordTest.php
+++ b/tests/unit/extensions/elasticsearch/ActiveRecordTest.php
@@ -3,10 +3,8 @@
 namespace yiiunit\extensions\elasticsearch;
 
 use yii\base\Event;
-use yii\base\Exception;
 use yii\db\BaseActiveRecord;
 use yii\elasticsearch\Connection;
-use yii\helpers\Json;
 use yiiunit\framework\ar\ActiveRecordTestTrait;
 use yiiunit\data\ar\elasticsearch\ActiveRecord;
 use yiiunit\data\ar\elasticsearch\Customer;
@@ -381,7 +379,6 @@ class ActiveRecordTest extends ElasticSearchTestCase
 
 	public function testFindAsArrayFields()
 	{
-		$customerClass = $this->getCustomerClass();
 		/** @var TestCase|ActiveRecordTestTrait $this */
 		// indexBy + asArray
 		$customers = $this->callCustomerFind()->asArray()->fields(['id', 'name'])->all();
@@ -456,7 +453,6 @@ class ActiveRecordTest extends ElasticSearchTestCase
 
 	public function testFindIndexByAsArrayFields()
 	{
-		$customerClass = $this->getCustomerClass();
 		/** @var TestCase|ActiveRecordTestTrait $this */
 		// indexBy + asArray
 		$customers = $this->callCustomerFind()->indexBy('name')->asArray()->fields('id', 'name')->all();
diff --git a/tests/unit/extensions/redis/ActiveRecordTest.php b/tests/unit/extensions/redis/ActiveRecordTest.php
index 294276c..5a2102f 100644
--- a/tests/unit/extensions/redis/ActiveRecordTest.php
+++ b/tests/unit/extensions/redis/ActiveRecordTest.php
@@ -2,7 +2,6 @@
 
 namespace yiiunit\extensions\redis;
 
-use yii\redis\ActiveQuery;
 use yiiunit\data\ar\redis\ActiveRecord;
 use yiiunit\data\ar\redis\Customer;
 use yiiunit\data\ar\redis\OrderItem;
diff --git a/tests/unit/extensions/redis/RedisConnectionTest.php b/tests/unit/extensions/redis/RedisConnectionTest.php
index 23ca512..fbc94e3 100644
--- a/tests/unit/extensions/redis/RedisConnectionTest.php
+++ b/tests/unit/extensions/redis/RedisConnectionTest.php
@@ -2,8 +2,6 @@
 
 namespace yiiunit\extensions\redis;
 
-use yii\redis\Connection;
-
 /**
  * @group redis
  */
diff --git a/tests/unit/extensions/sphinx/ExternalActiveRelationTest.php b/tests/unit/extensions/sphinx/ExternalActiveRelationTest.php
index 1740c42..3977b26 100644
--- a/tests/unit/extensions/sphinx/ExternalActiveRelationTest.php
+++ b/tests/unit/extensions/sphinx/ExternalActiveRelationTest.php
@@ -6,7 +6,6 @@ use yiiunit\data\ar\sphinx\ActiveRecord;
 use yiiunit\data\ar\ActiveRecord as ActiveRecordDb;
 use yiiunit\data\ar\sphinx\ArticleIndex;
 use yiiunit\data\ar\sphinx\ArticleDb;
-use yiiunit\data\ar\sphinx\TagDb;
 
 /**
  * @group sphinx
diff --git a/tests/unit/extensions/sphinx/SchemaTest.php b/tests/unit/extensions/sphinx/SchemaTest.php
index 2cc3ff9..b1a22ab 100644
--- a/tests/unit/extensions/sphinx/SchemaTest.php
+++ b/tests/unit/extensions/sphinx/SchemaTest.php
@@ -3,7 +3,6 @@
 namespace yiiunit\extensions\sphinx;
 
 use yii\caching\FileCache;
-use yii\sphinx\Schema;
 
 /**
  * @group sphinx
diff --git a/tests/unit/framework/ar/ActiveRecordTestTrait.php b/tests/unit/framework/ar/ActiveRecordTestTrait.php
index 03f899d..e915bd7 100644
--- a/tests/unit/framework/ar/ActiveRecordTestTrait.php
+++ b/tests/unit/framework/ar/ActiveRecordTestTrait.php
@@ -206,7 +206,6 @@ trait ActiveRecordTestTrait
 
 	public function testfindIndexByAsArray()
 	{
-		$customerClass = $this->getCustomerClass();
 		/** @var TestCase|ActiveRecordTestTrait $this */
 		// indexBy + asArray
 		$customers = $this->callCustomerFind()->asArray()->indexBy('name')->all();
diff --git a/tests/unit/framework/db/ActiveRecordTest.php b/tests/unit/framework/db/ActiveRecordTest.php
index bf13d2f..1eab260 100644
--- a/tests/unit/framework/db/ActiveRecordTest.php
+++ b/tests/unit/framework/db/ActiveRecordTest.php
@@ -1,7 +1,6 @@
 <?php
 namespace yiiunit\framework\db;
 
-use yii\db\ActiveQuery;
 use yiiunit\data\ar\ActiveRecord;
 use yiiunit\data\ar\Customer;
 use yiiunit\data\ar\NullValues;
diff --git a/tests/unit/framework/db/QueryBuilderTest.php b/tests/unit/framework/db/QueryBuilderTest.php
index d9f9960..c278cc0 100644
--- a/tests/unit/framework/db/QueryBuilderTest.php
+++ b/tests/unit/framework/db/QueryBuilderTest.php
@@ -2,7 +2,6 @@
 
 namespace yiiunit\framework\db;
 
-use yii\db\Query;
 use yii\db\QueryBuilder;
 use yii\db\Schema;
 use yii\db\mysql\QueryBuilder as MysqlQueryBuilder;
diff --git a/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php b/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php
index 3949ba2..dd48f44 100644
--- a/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php
+++ b/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php
@@ -1,7 +1,6 @@
 <?php
 namespace yiiunit\framework\db\cubrid;
 
-use yiiunit\data\ar\Customer;
 use yiiunit\framework\db\ActiveRecordTest;
 
 /**
diff --git a/tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php b/tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php
index 26ac0e0..6ba6103 100644
--- a/tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php
+++ b/tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php
@@ -13,7 +13,7 @@ class PostgreSQLConnectionTest extends ConnectionTest
 
 	public function testConnection()
 	{
-		$connection = $this->getConnection(true);
+		$this->getConnection(true);
 	}
 
 	public function testQuoteValue()
diff --git a/tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php b/tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php
index 88e950a..a689e5d 100644
--- a/tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php
+++ b/tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php
@@ -1,7 +1,6 @@
 <?php
 namespace yiiunit\framework\db\sqlite;
 
-use yiiunit\data\ar\Customer;
 use yiiunit\framework\db\ActiveRecordTest;
 
 /**
diff --git a/tests/unit/framework/log/LoggerTest.php b/tests/unit/framework/log/LoggerTest.php
index 31a4c3b..97eea7f 100644
--- a/tests/unit/framework/log/LoggerTest.php
+++ b/tests/unit/framework/log/LoggerTest.php
@@ -6,8 +6,6 @@
 namespace yiiunit\framework\log;
 
 
-use yii\debug\LogTarget;
-use yii\log\FileTarget;
 use yii\log\Logger;
 use yiiunit\TestCase;
 
diff --git a/tests/unit/framework/log/TargetTest.php b/tests/unit/framework/log/TargetTest.php
index b4ceb4c..fc7a0a2 100644
--- a/tests/unit/framework/log/TargetTest.php
+++ b/tests/unit/framework/log/TargetTest.php
@@ -6,8 +6,6 @@
 namespace yiiunit\framework\log;
 
 
-use yii\debug\LogTarget;
-use yii\log\FileTarget;
 use yii\log\Logger;
 use yii\log\Target;
 use yiiunit\TestCase;
diff --git a/tests/unit/framework/validators/CompareValidatorTest.php b/tests/unit/framework/validators/CompareValidatorTest.php
index 1e18faf..8419220 100644
--- a/tests/unit/framework/validators/CompareValidatorTest.php
+++ b/tests/unit/framework/validators/CompareValidatorTest.php
@@ -162,7 +162,7 @@ class CompareValidatorTest extends TestCase
 			$this->assertTrue(strlen($val->message) > 1);
 		}
 		try {
-			$val = new CompareValidator(['operator' => '<>']);
+			new CompareValidator(['operator' => '<>']);
 		} catch (InvalidConfigException $e) {
 			return;
 		}
diff --git a/tests/unit/framework/validators/ExistValidatorTest.php b/tests/unit/framework/validators/ExistValidatorTest.php
index 7180a2e..727d1a5 100644
--- a/tests/unit/framework/validators/ExistValidatorTest.php
+++ b/tests/unit/framework/validators/ExistValidatorTest.php
@@ -28,7 +28,7 @@ class ExistValidatorTest extends DatabaseTestCase
 	{
 		try {
 			$val = new ExistValidator();
-			$result = $val->validate('ref');
+			$val->validate('ref');
 			$this->fail('Exception should have been thrown at this time');
 		} catch (Exception $e) {
 			$this->assertInstanceOf('yii\base\InvalidConfigException', $e);
diff --git a/tests/unit/framework/validators/FilterValidatorTest.php b/tests/unit/framework/validators/FilterValidatorTest.php
index ec96f21..b57f649 100644
--- a/tests/unit/framework/validators/FilterValidatorTest.php
+++ b/tests/unit/framework/validators/FilterValidatorTest.php
@@ -18,7 +18,7 @@ class FilterValidatorTest extends TestCase
 	public function testAssureExceptionOnInit()
 	{
 		$this->setExpectedException('yii\base\InvalidConfigException');
-		$val = new FilterValidator();
+		new FilterValidator();
 	}
 
 	public function testValidateAttribute()
diff --git a/tests/unit/framework/validators/RangeValidatorTest.php b/tests/unit/framework/validators/RangeValidatorTest.php
index 583eeca..ddbadb5 100644
--- a/tests/unit/framework/validators/RangeValidatorTest.php
+++ b/tests/unit/framework/validators/RangeValidatorTest.php
@@ -18,7 +18,7 @@ class RangeValidatorTest extends TestCase
 	public function testInitException()
 	{
 		$this->setExpectedException('yii\base\InvalidConfigException', 'The "range" property must be set.');
-		$val = new RangeValidator(['range' => 'not an array']);
+		new RangeValidator(['range' => 'not an array']);
 	}
 
 	public function testAssureMessageSetOnInit()
diff --git a/tests/unit/framework/web/CacheSessionTest.php b/tests/unit/framework/web/CacheSessionTest.php
index ae73868..c593691 100644
--- a/tests/unit/framework/web/CacheSessionTest.php
+++ b/tests/unit/framework/web/CacheSessionTest.php
@@ -31,6 +31,6 @@ class CacheSessionTest extends \yiiunit\TestCase
 	public function testInvalidCache()
 	{
 		$this->setExpectedException('yii\base\InvalidConfigException');
-		$session = new CacheSession(['cache' => 'invalid']);
+		new CacheSession(['cache' => 'invalid']);
 	}
 }