From 35d7cacfbd8db138a1592ef39a853f042d094223 Mon Sep 17 00:00:00 2001 From: Angel Guevara Date: Sun, 1 May 2016 06:12:54 -0500 Subject: [PATCH] simplify default classes --- framework/db/Connection.php | 26 +++++++++++++------------- framework/mail/BaseMailer.php | 2 +- framework/widgets/ActiveForm.php | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/framework/db/Connection.php b/framework/db/Connection.php index 3ddcfc2..b842d7e 100644 --- a/framework/db/Connection.php +++ b/framework/db/Connection.php @@ -269,16 +269,16 @@ class Connection extends Component * [[Schema]] class to support DBMS that is not supported by Yii. */ public $schemaMap = [ - 'pgsql' => 'yii\db\pgsql\Schema', // PostgreSQL - 'mysqli' => 'yii\db\mysql\Schema', // MySQL - 'mysql' => 'yii\db\mysql\Schema', // MySQL - 'sqlite' => 'yii\db\sqlite\Schema', // sqlite 3 - 'sqlite2' => 'yii\db\sqlite\Schema', // sqlite 2 - 'sqlsrv' => 'yii\db\mssql\Schema', // newer MSSQL driver on MS Windows hosts - 'oci' => 'yii\db\oci\Schema', // Oracle driver - 'mssql' => 'yii\db\mssql\Schema', // older MSSQL driver on MS Windows hosts - 'dblib' => 'yii\db\mssql\Schema', // dblib drivers on GNU/Linux (and maybe other OSes) hosts - 'cubrid' => 'yii\db\cubrid\Schema', // CUBRID + 'pgsql' => pgsql\Schema::class, // PostgreSQL + 'mysqli' => mysql\Schema::class, // MySQL + 'mysql' => mysql\Schema::class, // MySQL + 'sqlite' => sqlite\Schema::class, // sqlite 3 + 'sqlite2' => sqlite\Schema::class, // sqlite 2 + 'sqlsrv' => mssql\Schema::class, // newer MSSQL driver on MS Windows hosts + 'oci' => oci\Schema::class, // Oracle driver + 'mssql' => mssql\Schema::class, // older MSSQL driver on MS Windows hosts + 'dblib' => mssql\Schema::class, // dblib drivers on GNU/Linux (and maybe other OSes) hosts + 'cubrid' => cubrid\Schema::class, // CUBRID ]; /** * @var string Custom PDO wrapper class. If not set, it will use [[PDO]] or [[yii\db\mssql\PDO]] when MSSQL is used. @@ -291,7 +291,7 @@ class Connection extends Component * @see createCommand * @since 2.0.7 */ - public $commandClass = 'yii\db\Command'; + public $commandClass = Command::class; /** * @var boolean whether to enable [savepoint](http://en.wikipedia.org/wiki/Savepoint). * Note that if the underlying DBMS does not support savepoint, setting this property to be true will have no effect. @@ -586,9 +586,9 @@ class Connection extends Component } if (isset($driver)) { if ($driver === 'mssql' || $driver === 'dblib') { - $pdoClass = 'yii\db\mssql\PDO'; + $pdoClass = mssql\PDO::class; } elseif ($driver === 'sqlsrv') { - $pdoClass = 'yii\db\mssql\SqlsrvPDO'; + $pdoClass = mssql\SqlsrvPDO::class; } } } diff --git a/framework/mail/BaseMailer.php b/framework/mail/BaseMailer.php index 52be574..5994bbc 100644 --- a/framework/mail/BaseMailer.php +++ b/framework/mail/BaseMailer.php @@ -73,7 +73,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont /** * @var string the default class name of the new message instances created by [[createMessage()]] */ - public $messageClass = 'yii\mail\BaseMessage'; + public $messageClass = BaseMessage::class; /** * @var boolean whether to save email messages as files under [[fileTransportPath]] instead of sending them * to the actual recipients. This is usually used during development for debugging purpose. diff --git a/framework/widgets/ActiveForm.php b/framework/widgets/ActiveForm.php index c92cbcf..137342c 100644 --- a/framework/widgets/ActiveForm.php +++ b/framework/widgets/ActiveForm.php @@ -54,7 +54,7 @@ class ActiveForm extends Widget * @var string the default field class name when calling [[field()]] to create a new field. * @see fieldConfig */ - public $fieldClass = 'yii\widgets\ActiveField'; + public $fieldClass = ActiveField::class; /** * @var array|\Closure the default configuration used by [[field()]] when creating a new field object. * This can be either a configuration array or an anonymous function returning a configuration array.