From 8be4f3778afb74fdf19e60db903ce66a096999aa Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Mon, 25 Nov 2013 15:33:59 +0100 Subject: [PATCH] updated properties of extensions --- build/build | 2 ++ build/controllers/PhpDocController.php | 45 +++++++++++++++++++++++++++------- extensions/bootstrap/Nav.php | 8 +++--- extensions/redis/Cache.php | 2 -- extensions/sphinx/ActiveRecord.php | 17 ++++++++++--- extensions/sphinx/Command.php | 7 ++++-- extensions/sphinx/Connection.php | 7 ++++-- extensions/sphinx/Query.php | 2 ++ extensions/sphinx/Schema.php | 8 +++--- extensions/swiftmailer/Mailer.php | 4 +++ extensions/swiftmailer/Message.php | 3 ++- framework/yii/db/ActiveRecord.php | 14 ++++++++--- 12 files changed, 88 insertions(+), 31 deletions(-) diff --git a/build/build b/build/build index b1d6bb2..daf5e09 100755 --- a/build/build +++ b/build/build @@ -11,6 +11,8 @@ // fcgi doesn't have STDIN defined by default defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); +define('YII_DEBUG', true); + require(__DIR__ . '/../framework/yii/Yii.php'); $application = new yii\console\Application([ diff --git a/build/controllers/PhpDocController.php b/build/controllers/PhpDocController.php index c7a2fa7..0dc0f24 100644 --- a/build/controllers/PhpDocController.php +++ b/build/controllers/PhpDocController.php @@ -7,6 +7,7 @@ namespace yii\build\controllers; +use Yii; use yii\console\Controller; use yii\helpers\Console; use yii\helpers\FileHelper; @@ -38,10 +39,30 @@ class PhpDocController extends Controller * * @param null $root the directory to parse files from. Defaults to YII_PATH. */ - public function actionProperty($root=null) + public function actionProperty($root = null) { + $except = []; if ($root === null) { - $root = YII_PATH; + $root = dirname(dirname(YII_PATH)); + Yii::setAlias('@yii/bootstrap', $root . '/extensions/bootstrap'); + Yii::setAlias('@yii/debug', $root . '/extensions/debug'); + Yii::setAlias('@yii/elasticsearch', $root . '/extensions/elasticsearch'); + Yii::setAlias('@yii/gii', $root . '/extensions/gii'); + Yii::setAlias('@yii/jui', $root . '/extensions/jui'); + Yii::setAlias('@yii/redis', $root . '/extensions/redis'); + Yii::setAlias('@yii/smarty', $root . '/extensions/smarty'); + Yii::setAlias('@yii/sphinx', $root . '/extensions/sphinx'); + Yii::setAlias('@yii/swiftmailer', $root . '/extensions/swiftmailer'); + Yii::setAlias('@yii/twig', $root . '/extensions/twig'); + + $except = [ + '/apps/', + '/build/', + '/docs/', + '/extensions/composer/', + '/tests/', + '/vendor/', + ]; } $root = FileHelper::normalizePath($root); $options = [ @@ -55,14 +76,13 @@ class PhpDocController extends Controller return null; }, 'only' => ['.php'], - 'except' => [ + 'except' => array_merge($except, [ 'BaseYii.php', 'Yii.php', - '/debug/views/', + '/views/', '/requirements/', - '/gii/views/', '/gii/generators/', - ], + ]), ]; $files = FileHelper::findFiles($root, $options); $nFilesTotal = 0; @@ -216,20 +236,27 @@ class PhpDocController extends Controller $ns = $this->match('#\nnamespace (?[\w\\\\]+);\n#', $file); $namespace = reset($ns); $namespace = $namespace['name']; - $classes = $this->match('#\n(?:abstract )?class (?\w+)( |\n)(extends )?.+\{(?.*)\n\}(\n|$)#', $file); + $classes = $this->match('#\n(?:abstract )?class (?\w+)( extends .+)?( implements .+)?\n\{(?.*)\n\}(\n|$)#', $file); if (count($classes) > 1) { $this->stderr("[ERR] There should be only one class in a file: $fileName\n", Console::FG_RED); return false; } if (count($classes) < 1) { - $interfaces = $this->match('#\ninterface (?\w+)\n\{(?.+)\n\}(\n|$)#', $file); + $interfaces = $this->match('#\ninterface (?\w+)( extends .+)?\n\{(?.+)\n\}(\n|$)#', $file); if (count($interfaces) == 1) { return false; } elseif (count($interfaces) > 1) { $this->stderr("[ERR] There should be only one interface in a file: $fileName\n", Console::FG_RED); } else { - $this->stderr("[ERR] No class in file: $fileName\n", Console::FG_RED); + $traits = $this->match('#\ntrait (?\w+)\n\{(?.+)\n\}(\n|$)#', $file); + if (count($traits) == 1) { + return false; + } elseif (count($traits) > 1) { + $this->stderr("[ERR] There should be only one class/trait/interface in a file: $fileName\n", Console::FG_RED); + } else { + $this->stderr("[ERR] No class in file: $fileName\n", Console::FG_RED); + } } return false; } diff --git a/extensions/bootstrap/Nav.php b/extensions/bootstrap/Nav.php index 8f0a98d..ef45f09 100644 --- a/extensions/bootstrap/Nav.php +++ b/extensions/bootstrap/Nav.php @@ -14,7 +14,7 @@ use yii\helpers\Html; /** * Nav renders a nav HTML component. - * + * * For example: * * ```php @@ -37,12 +37,12 @@ use yii\helpers\Html; * ], * ]); * ``` - * + * * Note: Multilevel dropdowns beyond Level 1 are not supported in Bootstrap 3. - * + * * @see http://getbootstrap.com/components.html#dropdowns * @see http://getbootstrap.com/components/#nav - * + * * @author Antonio Ramirez * @since 2.0 */ diff --git a/extensions/redis/Cache.php b/extensions/redis/Cache.php index 2b7e9e1..733df26 100644 --- a/extensions/redis/Cache.php +++ b/extensions/redis/Cache.php @@ -53,8 +53,6 @@ use yii\base\InvalidConfigException; * ] * ~~~ * - * @property Connection $connection The redis connection object. This property is read-only. - * * @author Carsten Brandt * @since 2.0 */ diff --git a/extensions/sphinx/ActiveRecord.php b/extensions/sphinx/ActiveRecord.php index d83db62..2cadc69 100644 --- a/extensions/sphinx/ActiveRecord.php +++ b/extensions/sphinx/ActiveRecord.php @@ -26,11 +26,16 @@ use Yii; * read-only. * @property boolean $isNewRecord Whether the record is new and should be inserted when calling [[save()]]. * @property array $oldAttributes The old attribute values (name-value pairs). - * @property integer $oldPrimaryKey The old primary key value. This property is read-only. + * @property mixed $oldPrimaryKey The old primary key value. An array (column name => column value) is + * returned if the primary key is composite. A string is returned otherwise (null will be returned if the key + * value is null). This property is read-only. * @property array $populatedRelations An array of relation data indexed by relation names. This property is * read-only. - * @property integer $primaryKey The primary key value. This property is read-only. - * @property string $snippet current snippet value for this Active Record instance.. + * @property mixed $primaryKey The primary key value. An array (column name => column value) is returned if + * the primary key is composite. A string is returned otherwise (null will be returned if the key value is null). + * This property is read-only. + * @property string $snippet Snippet value. + * @property string $snippetSource Snippet source string. This property is read-only. * * @author Paul Klimov * @since 2.0 @@ -1237,6 +1242,9 @@ abstract class ActiveRecord extends Model * Returns the primary key value. * @param boolean $asArray whether to return the primary key value as an array. If true, * the return value will be an array with column names as keys and column values as values. + * @property mixed The primary key value. An array (column name => column value) is returned if + * the primary key is composite. A string is returned otherwise (null will be returned if + * the key value is null). * @return mixed the primary key value. An array (column name => column value) is returned * if `$asArray` is true. A string is returned otherwise (null will be returned if * the key value is null). @@ -1263,6 +1271,9 @@ abstract class ActiveRecord extends Model * @param boolean $asArray whether to return the primary key value as an array. If true, * the return value will be an array with column name as key and column value as value. * If this is false (default), a scalar value will be returned. + * @property mixed The old primary key value. An array (column name => column value) is + * returned if the primary key is composite. A string is returned otherwise (null will be + * returned if the key value is null). * @return mixed the old primary key value. An array (column name => column value) is returned if * `$asArray` is true. A string is returned otherwise (null will be returned if * the key value is null). diff --git a/extensions/sphinx/Command.php b/extensions/sphinx/Command.php index 93c02f8..400b3ed 100644 --- a/extensions/sphinx/Command.php +++ b/extensions/sphinx/Command.php @@ -39,14 +39,17 @@ use yii\base\NotSupportedException; * * To build SELECT SQL statements, please use [[Query]] and [[QueryBuilder]] instead. * - * @property \yii\sphinx\Connection $db the Sphinx connection that this command is associated with. - * * @author Paul Klimov * @since 2.0 */ class Command extends \yii\db\Command { /** + * @var \yii\sphinx\Connection the Sphinx connection that this command is associated with. + */ + public $db; + + /** * Creates a batch INSERT command. * For example, * diff --git a/extensions/sphinx/Connection.php b/extensions/sphinx/Connection.php index a43b0c2..6f3a18a 100644 --- a/extensions/sphinx/Connection.php +++ b/extensions/sphinx/Connection.php @@ -47,11 +47,14 @@ use yii\base\NotSupportedException; * * Note: while this class extends "yii\db\Connection" some of its methods are not supported. * + * @method \yii\sphinx\Schema getSchema() The schema information for this Sphinx connection + * @method \yii\sphinx\QueryBuilder getQueryBuilder() the query builder for this Sphinx connection + * + * @property string $lastInsertID The row ID of the last row inserted, or the last value retrieved from the + * sequence object. This property is read-only. * @property Schema $schema The schema information for this Sphinx connection. This property is read-only. * @property \yii\sphinx\QueryBuilder $queryBuilder The query builder for this Sphinx connection. This property is * read-only. - * @method \yii\sphinx\Schema getSchema() The schema information for this Sphinx connection - * @method \yii\sphinx\QueryBuilder getQueryBuilder() the query builder for this Sphinx connection * * @author Paul Klimov * @since 2.0 diff --git a/extensions/sphinx/Query.php b/extensions/sphinx/Query.php index ff0dcba..dd13363 100644 --- a/extensions/sphinx/Query.php +++ b/extensions/sphinx/Query.php @@ -41,6 +41,8 @@ use yii\db\QueryTrait; * * Warning: even if you do not set any query limit, implicit LIMIT 0,20 is present by default! * + * @property Connection $connection Sphinx connection instance. + * * @author Paul Klimov * @since 2.0 */ diff --git a/extensions/sphinx/Schema.php b/extensions/sphinx/Schema.php index 6c9571c..5515865 100644 --- a/extensions/sphinx/Schema.php +++ b/extensions/sphinx/Schema.php @@ -15,12 +15,12 @@ use yii\caching\GroupDependency; /** * Schema represents the Sphinx schema information. * - * @property QueryBuilder $queryBuilder The query builder for this connection. This property is read-only. * @property string[] $indexNames All index names in the Sphinx. This property is read-only. - * @property string[] $indexTypes ALL index types in the Sphinx (index name => index type). - * This property is read-only. - * @property IndexSchema[] $tableSchemas The metadata for all indexes in the Sphinx. Each array element is an + * @property IndexSchema[] $indexSchemas The metadata for all indexes in the Sphinx. Each array element is an * instance of [[IndexSchema]] or its child class. This property is read-only. + * @property array $indexTypes All index types in the Sphinx in format: index name => index type. This + * property is read-only. + * @property QueryBuilder $queryBuilder The query builder for this connection. This property is read-only. * * @author Paul Klimov * @since 2.0 diff --git a/extensions/swiftmailer/Mailer.php b/extensions/swiftmailer/Mailer.php index d19e013..891f2b5 100644 --- a/extensions/swiftmailer/Mailer.php +++ b/extensions/swiftmailer/Mailer.php @@ -66,6 +66,10 @@ use yii\mail\BaseMailer; * * @see http://swiftmailer.org * + * @property array|\Swift_Mailer $swiftMailer Swift mailer instance or array configuration. This property is + * read-only. + * @property array|\Swift_Transport $transport This property is read-only. + * * @author Paul Klimov * @since 2.0 */ diff --git a/extensions/swiftmailer/Message.php b/extensions/swiftmailer/Message.php index b0ebd63..9558d58 100644 --- a/extensions/swiftmailer/Message.php +++ b/extensions/swiftmailer/Message.php @@ -16,7 +16,8 @@ use yii\mail\BaseMessage; * @see Mailer * * @method Mailer getMailer() returns mailer instance. - * @property \Swift_Message $swiftMessage vendor message instance. + * + * @property \Swift_Message $swiftMessage Swift message instance. This property is read-only. * * @author Paul Klimov * @since 2.0 diff --git a/framework/yii/db/ActiveRecord.php b/framework/yii/db/ActiveRecord.php index ffae3d8..8d6c7ee 100644 --- a/framework/yii/db/ActiveRecord.php +++ b/framework/yii/db/ActiveRecord.php @@ -27,13 +27,13 @@ use yii\helpers\Inflector; * @property boolean $isNewRecord Whether the record is new and should be inserted when calling [[save()]]. * @property array $oldAttributes The old attribute values (name-value pairs). * @property mixed $oldPrimaryKey The old primary key value. An array (column name => column value) is - * returned if the primary key is composite or `$asArray` is true. A string is returned otherwise (null will be - * returned if the key value is null). This property is read-only. + * returned if the primary key is composite. A string is returned otherwise (null will be returned if the key + * value is null). This property is read-only. * @property array $populatedRelations An array of relation data indexed by relation names. This property is * read-only. * @property mixed $primaryKey The primary key value. An array (column name => column value) is returned if - * the primary key is composite or `$asArray` is true. A string is returned otherwise (null will be returned if - * the key value is null). This property is read-only. + * the primary key is composite. A string is returned otherwise (null will be returned if the key value is null). + * This property is read-only. * * @author Qiang Xue * @author Carsten Brandt @@ -1192,6 +1192,9 @@ class ActiveRecord extends Model * @param boolean $asArray whether to return the primary key value as an array. If true, * the return value will be an array with column names as keys and column values as values. * Note that for composite primary keys, an array will always be returned regardless of this parameter value. + * @property mixed The primary key value. An array (column name => column value) is returned if + * the primary key is composite. A string is returned otherwise (null will be returned if + * the key value is null). * @return mixed the primary key value. An array (column name => column value) is returned if the primary key * is composite or `$asArray` is true. A string is returned otherwise (null will be returned if * the key value is null). @@ -1218,6 +1221,9 @@ class ActiveRecord extends Model * @param boolean $asArray whether to return the primary key value as an array. If true, * the return value will be an array with column name as key and column value as value. * If this is false (default), a scalar value will be returned for non-composite primary key. + * @property mixed The old primary key value. An array (column name => column value) is + * returned if the primary key is composite. A string is returned otherwise (null will be + * returned if the key value is null). * @return mixed the old primary key value. An array (column name => column value) is returned if the primary key * is composite or `$asArray` is true. A string is returned otherwise (null will be returned if * the key value is null).