From 6d9fe671deb7a620f207c0a9b11f2a6355250733 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 2 Aug 2015 00:27:19 +0200 Subject: [PATCH] various code style and whitespace adjustments --- framework/base/Configurable.php | 1 + framework/base/ErrorException.php | 2 +- framework/base/ErrorHandler.php | 2 +- framework/base/InvalidValueException.php | 12 ++++++------ framework/base/Model.php | 2 +- framework/base/Security.php | 1 + framework/base/Theme.php | 1 + framework/console/Application.php | 1 + framework/console/controllers/CacheController.php | 4 ++-- framework/console/controllers/FixtureController.php | 4 ++-- framework/db/ActiveRecord.php | 2 +- framework/db/BaseActiveRecord.php | 2 +- framework/db/SchemaBuilder.php | 8 ++------ framework/db/SchemaBuilderTrait.php | 1 + framework/db/oci/Schema.php | 1 + framework/db/pgsql/QueryBuilder.php | 1 + framework/helpers/BaseHtml.php | 1 - framework/helpers/BaseHtmlPurifier.php | 2 +- framework/helpers/BaseStringHelper.php | 2 +- framework/i18n/Formatter.php | 4 ++-- framework/rbac/DbManager.php | 2 ++ framework/test/ArrayFixture.php | 1 + framework/validators/FileValidator.php | 2 +- framework/validators/SafeValidator.php | 4 ++-- framework/web/Application.php | 1 + framework/web/Response.php | 13 ++++++------- framework/web/Session.php | 2 +- 27 files changed, 42 insertions(+), 37 deletions(-) diff --git a/framework/base/Configurable.php b/framework/base/Configurable.php index b9a121de49..37e7f314f6 100644 --- a/framework/base/Configurable.php +++ b/framework/base/Configurable.php @@ -29,3 +29,4 @@ namespace yii\base; interface Configurable { } + diff --git a/framework/base/ErrorException.php b/framework/base/ErrorException.php index e2b55ca52f..0e4960c581 100644 --- a/framework/base/ErrorException.php +++ b/framework/base/ErrorException.php @@ -17,7 +17,6 @@ use Yii; */ class ErrorException extends \ErrorException { - /** * Zend runtime won't call the error handler on fatals, HHVM will, with an error code of 16777217 * We will handle fatal error a bit different on HHVM. @@ -25,6 +24,7 @@ class ErrorException extends \ErrorException */ const E_HHVM_FATAL_ERROR = 16777217; // E_ERROR | (1 << 24) + /** * Constructs the exception. * @link http://php.net/manual/en/errorexception.construct.php diff --git a/framework/base/ErrorHandler.php b/framework/base/ErrorHandler.php index 1ee764037e..bc41fcd29b 100644 --- a/framework/base/ErrorHandler.php +++ b/framework/base/ErrorHandler.php @@ -44,12 +44,12 @@ abstract class ErrorHandler extends Component * @var string Used to reserve memory for fatal error handler. */ private $_memoryReserve; - /** * @var \Exception from HHVM error that stores backtrace */ private $_hhvmException; + /** * Register this error handler */ diff --git a/framework/base/InvalidValueException.php b/framework/base/InvalidValueException.php index a3727ce44d..a4786e297e 100644 --- a/framework/base/InvalidValueException.php +++ b/framework/base/InvalidValueException.php @@ -16,10 +16,10 @@ namespace yii\base; class InvalidValueException extends \UnexpectedValueException { /** - * @return string the user-friendly name of this exception - */ - public function getName() - { - return 'Invalid Return Value'; - } + * @return string the user-friendly name of this exception + */ + public function getName() + { + return 'Invalid Return Value'; + } } diff --git a/framework/base/Model.php b/framework/base/Model.php index 3b8ed61136..26c73677b7 100644 --- a/framework/base/Model.php +++ b/framework/base/Model.php @@ -120,7 +120,7 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab * ~~~ * * In the above `$attribute` refers to the attribute currently being validated while `$params` contains an array of - * validator configuration options such as `max` in case of `string` validator. The value of the attribute currently being validated + * validator configuration options such as `max` in case of `string` validator. The value of the attribute currently being validated * can be accessed as `$this->$attribute`. Note the `$` before `attribute`; this is taking the value of the variable * `$attribute` and using it as the name of the property to access. * diff --git a/framework/base/Security.php b/framework/base/Security.php index af486ae843..f7ee445ad9 100644 --- a/framework/base/Security.php +++ b/framework/base/Security.php @@ -87,6 +87,7 @@ class Security extends Component */ public $passwordHashCost = 13; + /** * Encrypts data using a password. * Derives keys for encryption and authentication from the password using PBKDF2 and a random salt, diff --git a/framework/base/Theme.php b/framework/base/Theme.php index d079812d5c..bc73915c6e 100644 --- a/framework/base/Theme.php +++ b/framework/base/Theme.php @@ -81,6 +81,7 @@ class Theme extends Component private $_baseUrl; + /** * @return string the base URL (without ending slash) for this theme. All resources of this theme are considered * to be under this base URL. diff --git a/framework/console/Application.php b/framework/console/Application.php index d8d6e1ff65..0668da84ad 100644 --- a/framework/console/Application.php +++ b/framework/console/Application.php @@ -75,6 +75,7 @@ class Application extends \yii\base\Application */ public $controller; + /** * @inheritdoc */ diff --git a/framework/console/controllers/CacheController.php b/framework/console/controllers/CacheController.php index b9a57d71b3..850b489387 100644 --- a/framework/console/controllers/CacheController.php +++ b/framework/console/controllers/CacheController.php @@ -60,7 +60,7 @@ class CacheController extends Controller * # flushes caches specified by their id: "first", "second", "third" * yii cache/flush first second third * ~~~ - * + * */ public function actionFlush() { @@ -202,7 +202,7 @@ class CacheController extends Controller } /** - * + * * @param array $caches */ private function notifyFlushed($caches) diff --git a/framework/console/controllers/FixtureController.php b/framework/console/controllers/FixtureController.php index 7256d467a7..6fc9b77f0f 100644 --- a/framework/console/controllers/FixtureController.php +++ b/framework/console/controllers/FixtureController.php @@ -376,7 +376,7 @@ class FixtureController extends Controller } /** - * Finds fixtures to be loaded, for example "User", if no fixtures were specified then all of them + * Finds fixtures to be loaded, for example "User", if no fixtures were specified then all of them * will be searching by suffix "Fixture.php". * @param array $fixtures fixtures to be loaded * @return array Array of found fixtures. These may differ from input parameter as not all fixtures may exists. @@ -433,7 +433,7 @@ class FixtureController extends Controller * Filters fixtures by splitting them in two categories: one that should be applied and not. * If fixture is prefixed with "-", for example "-User", that means that fixture should not be loaded, * if it is not prefixed it is considered as one to be loaded. Returns array: - * + * * ~~~ * [ * 'apply' => [ diff --git a/framework/db/ActiveRecord.php b/framework/db/ActiveRecord.php index 01270dcaec..98778a72cc 100644 --- a/framework/db/ActiveRecord.php +++ b/framework/db/ActiveRecord.php @@ -163,7 +163,7 @@ class ActiveRecord extends BaseActiveRecord * Finds ActiveRecord instance(s) by the given condition. * This method is internally called by [[findOne()]] and [[findAll()]]. * @param mixed $condition please refer to [[findOne()]] for the explanation of this parameter - * @return ActiveQueryInterface the newly created [[ActiveQueryInterface|ActiveQuery]] instance. + * @return ActiveQueryInterface the newly created [[ActiveQueryInterface|ActiveQuery]] instance. * @throws InvalidConfigException if there is no primary key defined * @internal */ diff --git a/framework/db/BaseActiveRecord.php b/framework/db/BaseActiveRecord.php index 545a51a7a0..bbf7da3576 100644 --- a/framework/db/BaseActiveRecord.php +++ b/framework/db/BaseActiveRecord.php @@ -115,7 +115,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface * Finds ActiveRecord instance(s) by the given condition. * This method is internally called by [[findOne()]] and [[findAll()]]. * @param mixed $condition please refer to [[findOne()]] for the explanation of this parameter - * @return ActiveQueryInterface the newly created [[ActiveQueryInterface|ActiveQuery]] instance. + * @return ActiveQueryInterface the newly created [[ActiveQueryInterface|ActiveQuery]] instance. * @throws InvalidConfigException if there is no primary key defined * @internal */ diff --git a/framework/db/SchemaBuilder.php b/framework/db/SchemaBuilder.php index ab931a015d..ae9ec56397 100644 --- a/framework/db/SchemaBuilder.php +++ b/framework/db/SchemaBuilder.php @@ -24,7 +24,7 @@ use yii\base\Object; * 'data' => Schema::text(), * 'created_at' => Schema::integer(), * 'updated_at' => Schema::integer(), - *]); + * ]); * ``` * * @method SchemaBuilder default($default = null) see [[SchemaBuilder::_default()]] for more info @@ -38,32 +38,28 @@ abstract class SchemaBuilder extends Object * @var string column type */ protected $type; - /** * @var integer column size */ protected $length; - /** * @var boolean whether value is not nullable */ protected $isNotNull = false; - /** * @var boolean whether value should be unique */ protected $isUnique = false; - /** * @var string check value of column */ protected $check; - /** * @var mixed default value of column */ protected $default; + /** * Makes column a primary key * diff --git a/framework/db/SchemaBuilderTrait.php b/framework/db/SchemaBuilderTrait.php index dbb63fe1b3..65aca3b46b 100644 --- a/framework/db/SchemaBuilderTrait.php +++ b/framework/db/SchemaBuilderTrait.php @@ -59,6 +59,7 @@ trait SchemaBuilderTrait 'cubrid' => 'yii\db\cubrid\SchemaBuilder', // CUBRID ]; + /** * Set the database connection used by this class * diff --git a/framework/db/oci/Schema.php b/framework/db/oci/Schema.php index e8ef5749e0..05594a89b5 100644 --- a/framework/db/oci/Schema.php +++ b/framework/db/oci/Schema.php @@ -32,6 +32,7 @@ class Schema extends \yii\db\Schema 'ORA-00001: unique constraint' => 'yii\db\IntegrityException', ]; + /** * @inheritdoc */ diff --git a/framework/db/pgsql/QueryBuilder.php b/framework/db/pgsql/QueryBuilder.php index 5aa3cad08c..0cc0fd72fd 100644 --- a/framework/db/pgsql/QueryBuilder.php +++ b/framework/db/pgsql/QueryBuilder.php @@ -85,6 +85,7 @@ class QueryBuilder extends \yii\db\QueryBuilder 'NOT EXISTS' => 'buildExistsCondition', ]; + /** * Builds a SQL statement for creating a new index. * @param string $name the name of the index. The name will be properly quoted by the method. diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index 9ea62a182c..9b84c2f4ef 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -80,7 +80,6 @@ class BaseHtml 'rel', 'media', ]; - /** * @var array list of tag attributes that should be specially handled when their values are of array type. * In particular, if the value of the `data` attribute is `['name' => 'xyz', 'age' => 13]`, two attributes diff --git a/framework/helpers/BaseHtmlPurifier.php b/framework/helpers/BaseHtmlPurifier.php index d7ae14a695..628df83ee7 100644 --- a/framework/helpers/BaseHtmlPurifier.php +++ b/framework/helpers/BaseHtmlPurifier.php @@ -19,7 +19,7 @@ class BaseHtmlPurifier { /** * Passes markup through HTMLPurifier making it safe to output to end user - * + * * @param string $content The HTML content to purify * @param array|\Closure|null $config The config to use for HtmlPurifier. * If not specified or `null` the default config will be used. diff --git a/framework/helpers/BaseStringHelper.php b/framework/helpers/BaseStringHelper.php index a67e852489..8dd8e66ed0 100644 --- a/framework/helpers/BaseStringHelper.php +++ b/framework/helpers/BaseStringHelper.php @@ -141,7 +141,7 @@ class BaseStringHelper /** * Truncate a string while preserving the HTML. - * + * * @param string $string The string to truncate * @param integer $count * @param string $suffix String to append to the end of the truncated string. diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php index abb8bdc8ea..3a0a998133 100644 --- a/framework/i18n/Formatter.php +++ b/framework/i18n/Formatter.php @@ -1079,7 +1079,7 @@ class Formatter extends Component * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. * @return string the formatted result. - * @throws InvalidParamException if the input value is not numeric or the formatting failed. + * @throws InvalidParamException if the input value is not numeric or the formatting failed. * @see sizeFormat * @see asShortSize */ @@ -1198,7 +1198,7 @@ class Formatter extends Component * * @param integer $style the type of the number formatter. * Values: NumberFormatter::DECIMAL, ::CURRENCY, ::PERCENT, ::SCIENTIFIC, ::SPELLOUT, ::ORDINAL - * ::DURATION, ::PATTERN_RULEBASED, ::DEFAULT_STYLE, ::IGNORE + * ::DURATION, ::PATTERN_RULEBASED, ::DEFAULT_STYLE, ::IGNORE * @param integer $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. diff --git a/framework/rbac/DbManager.php b/framework/rbac/DbManager.php index 3e9f32026d..2c71919fad 100644 --- a/framework/rbac/DbManager.php +++ b/framework/rbac/DbManager.php @@ -85,6 +85,7 @@ class DbManager extends BaseManager * @since 2.0.3 */ public $cacheKey = 'rbac'; + /** * @var Item[] all auth items (name => Item) */ @@ -98,6 +99,7 @@ class DbManager extends BaseManager */ protected $parents; + /** * Initializes the application component. * This method overrides the parent implementation by establishing the database connection. diff --git a/framework/test/ArrayFixture.php b/framework/test/ArrayFixture.php index 6160571989..5109e19d69 100644 --- a/framework/test/ArrayFixture.php +++ b/framework/test/ArrayFixture.php @@ -31,6 +31,7 @@ class ArrayFixture extends Fixture implements \IteratorAggregate, \ArrayAccess, */ public $dataFile; + /** * Loads the fixture. * diff --git a/framework/validators/FileValidator.php b/framework/validators/FileValidator.php index 374890fc40..0a6960ada6 100644 --- a/framework/validators/FileValidator.php +++ b/framework/validators/FileValidator.php @@ -122,7 +122,7 @@ class FileValidator extends Validator * - {mimeTypes}: the value of [[mimeTypes]] */ public $wrongMimeType; - + /** * @inheritdoc diff --git a/framework/validators/SafeValidator.php b/framework/validators/SafeValidator.php index a7d31263ba..ed518f8eee 100644 --- a/framework/validators/SafeValidator.php +++ b/framework/validators/SafeValidator.php @@ -12,12 +12,12 @@ namespace yii\validators; * * This class is required because of the way in which Yii determines whether a property is safe for massive assignment, that is, * when a user submits form data to be loaded into a model directly from the POST data, is it ok for a property to be copied. - * In many cases, this is required but because sometimes properties are internal and you do not want the POST data to be able to + * In many cases, this is required but because sometimes properties are internal and you do not want the POST data to be able to * override these internal values (especially things like database row ids), Yii assumes all values are unsafe for massive assignment * unless a rule exists for the property, which in most cases it will. Sometimes, however, an item is safe for massive assigment but * does not have a rule associated with it - for instance, due to no validation being performed, in which case, you use this class * as a rule for that property. Although it has no functionality, it allows Yii to determine that the property is safe to copy. - * + * * @author Qiang Xue * @since 2.0 */ diff --git a/framework/web/Application.php b/framework/web/Application.php index 8f88562175..c02e30d9e0 100644 --- a/framework/web/Application.php +++ b/framework/web/Application.php @@ -50,6 +50,7 @@ class Application extends \yii\base\Application */ public $controller; + /** * @inheritdoc */ diff --git a/framework/web/Response.php b/framework/web/Response.php index 56cc0530b5..5a3ec911b8 100644 --- a/framework/web/Response.php +++ b/framework/web/Response.php @@ -72,7 +72,6 @@ class Response extends \yii\base\Response * You may respond to this event to filter the response content before it is sent to the client. */ const EVENT_AFTER_PREPARE = 'afterPrepare'; - const FORMAT_RAW = 'raw'; const FORMAT_HTML = 'html'; const FORMAT_JSON = 'json'; @@ -426,7 +425,7 @@ class Response extends \yii\base\Response * * - `mimeType`: the MIME type of the content. If not set, it will be guessed based on `$filePath` * - `inline`: boolean, whether the browser should open the file within the browser window. Defaults to false, - * meaning a download dialog will pop up. + * meaning a download dialog will pop up. * * @return $this the response object itself */ @@ -456,7 +455,7 @@ class Response extends \yii\base\Response * * - `mimeType`: the MIME type of the content. Defaults to 'application/octet-stream'. * - `inline`: boolean, whether the browser should open the file within the browser window. Defaults to false, - * meaning a download dialog will pop up. + * meaning a download dialog will pop up. * * @return $this the response object itself * @throws HttpException if the requested range is not satisfiable @@ -503,10 +502,10 @@ class Response extends \yii\base\Response * * - `mimeType`: the MIME type of the content. Defaults to 'application/octet-stream'. * - `inline`: boolean, whether the browser should open the file within the browser window. Defaults to false, - * meaning a download dialog will pop up. + * meaning a download dialog will pop up. * - `fileSize`: the size of the content to stream this is useful when size of the content is known - * and the content is not seekable. Defaults to content size using `ftell()`. - * This option is available since version 2.0.4. + * and the content is not seekable. Defaults to content size using `ftell()`. + * This option is available since version 2.0.4. * * @return $this the response object itself * @throws HttpException if the requested range cannot be satisfied. @@ -660,7 +659,7 @@ class Response extends \yii\base\Response * * - `mimeType`: the MIME type of the content. If not set, it will be guessed based on `$filePath` * - `inline`: boolean, whether the browser should open the file within the browser window. Defaults to false, - * meaning a download dialog will pop up. + * meaning a download dialog will pop up. * - xHeader: string, the name of the x-sendfile header. Defaults to "X-Sendfile". * * @return $this the response object itself diff --git a/framework/web/Session.php b/framework/web/Session.php index 9f8d5f6abe..393fb7610b 100644 --- a/framework/web/Session.php +++ b/framework/web/Session.php @@ -678,7 +678,7 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co * * With the above code you can use the [bootstrap alert][] classes such as `success`, `info`, `danger` * as the flash message key to influence the color of the div. - * + * * Note that if you use [[addFlash()]], `$message` will be an array, and you will have to adjust the above code. * * [bootstrap alert]: http://getbootstrap.com/components/#alerts