From 9c315a8e0a861ac4f67fa0488c742250b048406c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=A1=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2?= Date: Tue, 30 Sep 2025 10:18:24 +0400 Subject: [PATCH] Add visibility for all class elements --- build/controllers/ReleaseController.php | 4 +- framework/base/Application.php | 18 +++--- framework/base/Controller.php | 4 +- framework/base/ErrorException.php | 2 +- framework/base/ErrorHandler.php | 2 +- framework/base/Model.php | 6 +- framework/base/Module.php | 4 +- framework/base/View.php | 8 +-- framework/base/Widget.php | 6 +- .../behaviors/AttributeTypecastBehavior.php | 8 +-- framework/captcha/CaptchaAction.php | 2 +- framework/console/Application.php | 2 +- framework/console/Controller.php | 4 +- framework/console/ExitCode.php | 34 +++++------ .../controllers/BaseMigrateController.php | 2 +- .../console/controllers/MigrateController.php | 2 +- .../console/controllers/ServeController.php | 8 +-- framework/console/widgets/Table.php | 34 +++++------ framework/data/DataFilter.php | 16 +++--- framework/data/Pagination.php | 8 +-- framework/db/ActiveQuery.php | 2 +- framework/db/ActiveRecord.php | 8 +-- framework/db/BaseActiveRecord.php | 18 +++--- framework/db/BatchQueryResult.php | 6 +- framework/db/ColumnSchemaBuilder.php | 10 ++-- framework/db/Connection.php | 8 +-- framework/db/JsonExpression.php | 4 +- framework/db/PdoValueBuilder.php | 2 +- framework/db/QueryBuilder.php | 2 +- framework/db/Schema.php | 46 +++++++-------- framework/db/SqlToken.php | 16 +++--- framework/db/Transaction.php | 8 +-- framework/db/mysql/JsonExpressionBuilder.php | 2 +- framework/db/pgsql/QueryBuilder.php | 10 ++-- framework/db/pgsql/Schema.php | 2 +- framework/filters/PageCache.php | 2 +- framework/grid/GridView.php | 6 +- framework/helpers/BaseConsole.php | 56 +++++++++---------- framework/helpers/BaseFileHelper.php | 10 ++-- framework/helpers/BaseInflector.php | 6 +- framework/helpers/BaseIpHelper.php | 8 +-- framework/i18n/DbMessageSource.php | 2 +- framework/i18n/Formatter.php | 12 ++-- framework/i18n/GettextMessageSource.php | 4 +- framework/i18n/MessageSource.php | 2 +- framework/log/Logger.php | 14 ++--- framework/mail/BaseMailer.php | 4 +- framework/mutex/OracleMutex.php | 12 ++-- framework/rbac/Item.php | 4 +- .../requirements/YiiRequirementChecker.php | 32 +++++------ framework/validators/CompareValidator.php | 4 +- framework/validators/DateValidator.php | 6 +- framework/validators/IpValidator.php | 2 +- framework/web/Cookie.php | 6 +- framework/web/JsonResponseFormatter.php | 6 +- framework/web/Link.php | 2 +- framework/web/Request.php | 4 +- framework/web/Response.php | 16 +++--- framework/web/UrlNormalizer.php | 6 +- framework/web/UrlRule.php | 12 ++-- framework/web/User.php | 8 +-- framework/web/View.php | 20 +++---- framework/widgets/ActiveForm.php | 4 +- framework/widgets/MaskedInput.php | 2 +- phpcs.xml.dist | 5 +- tests/data/ar/Customer.php | 4 +- tests/data/ar/CustomerWithAlias.php | 4 +- tests/framework/base/EventTest.php | 2 +- tests/framework/base/SecurityTest.php | 2 +- .../db/mysql/connection/DeadLockTest.php | 2 +- tests/framework/db/pgsql/ActiveRecordTest.php | 6 +- .../i18n/FallbackMessageFormatterTest.php | 22 ++++---- tests/framework/i18n/MessageFormatterTest.php | 22 ++++---- 73 files changed, 328 insertions(+), 331 deletions(-) diff --git a/build/controllers/ReleaseController.php b/build/controllers/ReleaseController.php index 1e6168a186e..e15aa14d185 100644 --- a/build/controllers/ReleaseController.php +++ b/build/controllers/ReleaseController.php @@ -1032,8 +1032,8 @@ protected function getCurrentVersions(array $what) return $versions; } - const MINOR = 'minor'; - const PATCH = 'patch'; + public const MINOR = 'minor'; + public const PATCH = 'patch'; protected function getNextVersions(array $versions, $type) { diff --git a/framework/base/Application.php b/framework/base/Application.php index fa9ecb91319..7d659b735cd 100644 --- a/framework/base/Application.php +++ b/framework/base/Application.php @@ -49,39 +49,39 @@ abstract class Application extends Module /** * @event Event an event raised before the application starts to handle a request. */ - const EVENT_BEFORE_REQUEST = 'beforeRequest'; + public const EVENT_BEFORE_REQUEST = 'beforeRequest'; /** * @event Event an event raised after the application successfully handles a request (before the response is sent out). */ - const EVENT_AFTER_REQUEST = 'afterRequest'; + public const EVENT_AFTER_REQUEST = 'afterRequest'; /** * Application state used by [[state]]: application just started. */ - const STATE_BEGIN = 0; + public const STATE_BEGIN = 0; /** * Application state used by [[state]]: application is initializing. */ - const STATE_INIT = 1; + public const STATE_INIT = 1; /** * Application state used by [[state]]: application is triggering [[EVENT_BEFORE_REQUEST]]. */ - const STATE_BEFORE_REQUEST = 2; + public const STATE_BEFORE_REQUEST = 2; /** * Application state used by [[state]]: application is handling the request. */ - const STATE_HANDLING_REQUEST = 3; + public const STATE_HANDLING_REQUEST = 3; /** * Application state used by [[state]]: application is triggering [[EVENT_AFTER_REQUEST]].. */ - const STATE_AFTER_REQUEST = 4; + public const STATE_AFTER_REQUEST = 4; /** * Application state used by [[state]]: application is about to send response. */ - const STATE_SENDING_RESPONSE = 5; + public const STATE_SENDING_RESPONSE = 5; /** * Application state used by [[state]]: application has ended. */ - const STATE_END = 6; + public const STATE_END = 6; /** * @var string the namespace that controller classes are located in. diff --git a/framework/base/Controller.php b/framework/base/Controller.php index 5edc6dc9782..e9eb5fcdf28 100644 --- a/framework/base/Controller.php +++ b/framework/base/Controller.php @@ -31,11 +31,11 @@ class Controller extends Component implements ViewContextInterface * @event ActionEvent an event raised right before executing a controller action. * You may set [[ActionEvent::isValid]] to be false to cancel the action execution. */ - const EVENT_BEFORE_ACTION = 'beforeAction'; + public const EVENT_BEFORE_ACTION = 'beforeAction'; /** * @event ActionEvent an event raised right after executing a controller action. */ - const EVENT_AFTER_ACTION = 'afterAction'; + public const EVENT_AFTER_ACTION = 'afterAction'; /** * @var string the ID of this controller. diff --git a/framework/base/ErrorException.php b/framework/base/ErrorException.php index 3041ac44f6e..8685f160e16 100644 --- a/framework/base/ErrorException.php +++ b/framework/base/ErrorException.php @@ -25,7 +25,7 @@ class ErrorException extends \ErrorException * @see https://github.com/facebook/hhvm/blob/master/hphp/runtime/base/runtime-error.h#L62 * @since 2.0.6 */ - const E_HHVM_FATAL_ERROR = 16777217; // E_ERROR | (1 << 24) + public const E_HHVM_FATAL_ERROR = 16777217; // E_ERROR | (1 << 24) /** diff --git a/framework/base/ErrorHandler.php b/framework/base/ErrorHandler.php index fec60a67cac..9f31bc91e97 100644 --- a/framework/base/ErrorHandler.php +++ b/framework/base/ErrorHandler.php @@ -30,7 +30,7 @@ abstract class ErrorHandler extends Component * @event Event an event that is triggered when the handler is called by shutdown function via [[handleFatalError()]]. * @since 2.0.46 */ - const EVENT_SHUTDOWN = 'shutdown'; + public const EVENT_SHUTDOWN = 'shutdown'; /** * @var bool whether to discard any existing page output before error display. Defaults to true. diff --git a/framework/base/Model.php b/framework/base/Model.php index 9ea33a50750..dbb411044aa 100644 --- a/framework/base/Model.php +++ b/framework/base/Model.php @@ -83,16 +83,16 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg /** * The name of the default scenario. */ - const SCENARIO_DEFAULT = 'default'; + public const SCENARIO_DEFAULT = 'default'; /** * @event ModelEvent an event raised at the beginning of [[validate()]]. You may set * [[ModelEvent::isValid]] to be false to stop the validation. */ - const EVENT_BEFORE_VALIDATE = 'beforeValidate'; + public const EVENT_BEFORE_VALIDATE = 'beforeValidate'; /** * @event Event an event raised at the end of [[validate()]] */ - const EVENT_AFTER_VALIDATE = 'afterValidate'; + public const EVENT_AFTER_VALIDATE = 'afterValidate'; /** * @var array validation errors (attribute name => array of errors) diff --git a/framework/base/Module.php b/framework/base/Module.php index 8a7b0b6e642..41939f95cbe 100644 --- a/framework/base/Module.php +++ b/framework/base/Module.php @@ -44,11 +44,11 @@ class Module extends ServiceLocator * @event ActionEvent an event raised before executing a controller action. * You may set [[ActionEvent::isValid]] to be `false` to cancel the action execution. */ - const EVENT_BEFORE_ACTION = 'beforeAction'; + public const EVENT_BEFORE_ACTION = 'beforeAction'; /** * @event ActionEvent an event raised after executing a controller action. */ - const EVENT_AFTER_ACTION = 'afterAction'; + public const EVENT_AFTER_ACTION = 'afterAction'; /** * @var array custom module parameters (name => value). diff --git a/framework/base/View.php b/framework/base/View.php index 93b14a2dc60..bc23e452d56 100644 --- a/framework/base/View.php +++ b/framework/base/View.php @@ -32,19 +32,19 @@ class View extends Component implements DynamicContentAwareInterface /** * @event Event an event that is triggered by [[beginPage()]]. */ - const EVENT_BEGIN_PAGE = 'beginPage'; + public const EVENT_BEGIN_PAGE = 'beginPage'; /** * @event Event an event that is triggered by [[endPage()]]. */ - const EVENT_END_PAGE = 'endPage'; + public const EVENT_END_PAGE = 'endPage'; /** * @event ViewEvent an event that is triggered by [[renderFile()]] right before it renders a view file. */ - const EVENT_BEFORE_RENDER = 'beforeRender'; + public const EVENT_BEFORE_RENDER = 'beforeRender'; /** * @event ViewEvent an event that is triggered by [[renderFile()]] right after it renders a view file. */ - const EVENT_AFTER_RENDER = 'afterRender'; + public const EVENT_AFTER_RENDER = 'afterRender'; /** * @var ViewContextInterface the context under which the [[renderFile()]] method is being invoked. diff --git a/framework/base/Widget.php b/framework/base/Widget.php index f02d4a2b2dd..d4fcd1d456c 100644 --- a/framework/base/Widget.php +++ b/framework/base/Widget.php @@ -30,18 +30,18 @@ class Widget extends Component implements ViewContextInterface * @event Event an event that is triggered when the widget is initialized via [[init()]]. * @since 2.0.11 */ - const EVENT_INIT = 'init'; + public const EVENT_INIT = 'init'; /** * @event WidgetEvent an event raised right before executing a widget. * You may set [[WidgetEvent::isValid]] to be false to cancel the widget execution. * @since 2.0.11 */ - const EVENT_BEFORE_RUN = 'beforeRun'; + public const EVENT_BEFORE_RUN = 'beforeRun'; /** * @event WidgetEvent an event raised right after executing a widget. * @since 2.0.11 */ - const EVENT_AFTER_RUN = 'afterRun'; + public const EVENT_AFTER_RUN = 'afterRun'; /** * @var int a counter used to generate [[id]] for widgets. diff --git a/framework/behaviors/AttributeTypecastBehavior.php b/framework/behaviors/AttributeTypecastBehavior.php index c73872435b5..722d9b48af5 100644 --- a/framework/behaviors/AttributeTypecastBehavior.php +++ b/framework/behaviors/AttributeTypecastBehavior.php @@ -111,10 +111,10 @@ */ class AttributeTypecastBehavior extends Behavior { - const TYPE_INTEGER = 'integer'; - const TYPE_FLOAT = 'float'; - const TYPE_BOOLEAN = 'boolean'; - const TYPE_STRING = 'string'; + public const TYPE_INTEGER = 'integer'; + public const TYPE_FLOAT = 'float'; + public const TYPE_BOOLEAN = 'boolean'; + public const TYPE_STRING = 'string'; /** * @var Model|BaseActiveRecord the owner of this behavior. diff --git a/framework/captcha/CaptchaAction.php b/framework/captcha/CaptchaAction.php index 79086e05359..11e9391a23a 100644 --- a/framework/captcha/CaptchaAction.php +++ b/framework/captcha/CaptchaAction.php @@ -45,7 +45,7 @@ class CaptchaAction extends Action /** * The name of the GET parameter indicating whether the CAPTCHA image should be regenerated. */ - const REFRESH_GET_VAR = 'refresh'; + public const REFRESH_GET_VAR = 'refresh'; /** * @var int how many times should the same CAPTCHA be displayed. Defaults to 3. diff --git a/framework/console/Application.php b/framework/console/Application.php index 8b85d0fb4bc..a0acad9627f 100644 --- a/framework/console/Application.php +++ b/framework/console/Application.php @@ -62,7 +62,7 @@ class Application extends \yii\base\Application /** * The option name for specifying the application configuration file path. */ - const OPTION_APPCONFIG = 'appconfig'; + public const OPTION_APPCONFIG = 'appconfig'; /** * @var string the default route of this application. Defaults to 'help', diff --git a/framework/console/Controller.php b/framework/console/Controller.php index 553bcf06f8d..177a93fd902 100644 --- a/framework/console/Controller.php +++ b/framework/console/Controller.php @@ -43,11 +43,11 @@ class Controller extends \yii\base\Controller /** * @deprecated since 2.0.13. Use [[ExitCode::OK]] instead. */ - const EXIT_CODE_NORMAL = 0; + public const EXIT_CODE_NORMAL = 0; /** * @deprecated since 2.0.13. Use [[ExitCode::UNSPECIFIED_ERROR]] instead. */ - const EXIT_CODE_ERROR = 1; + public const EXIT_CODE_ERROR = 1; /** * @var bool whether to run the command interactively. diff --git a/framework/console/ExitCode.php b/framework/console/ExitCode.php index 471f5953f71..47d92ec8439 100644 --- a/framework/console/ExitCode.php +++ b/framework/console/ExitCode.php @@ -38,89 +38,89 @@ class ExitCode /** * The command completed successfully. */ - const OK = 0; + public const OK = 0; /** * The command exited with an error code that says nothing about the error. */ - const UNSPECIFIED_ERROR = 1; + public const UNSPECIFIED_ERROR = 1; /** * The command was used incorrectly, e.g., with the wrong number of * arguments, a bad flag, a bad syntax in a parameter, or whatever. */ - const USAGE = 64; + public const USAGE = 64; /** * The input data was incorrect in some way. This should only be used for * user's data and not system files. */ - const DATAERR = 65; + public const DATAERR = 65; /** * An input file (not a system file) did not exist or was not readable. * This could also include errors like ``No message'' to a mailer (if it * cared to catch it). */ - const NOINPUT = 66; + public const NOINPUT = 66; /** * The user specified did not exist. This might be used for mail addresses * or remote logins. */ - const NOUSER = 67; + public const NOUSER = 67; /** * The host specified did not exist. This is used in mail addresses or * network requests. */ - const NOHOST = 68; + public const NOHOST = 68; /** * A service is unavailable. This can occur if a support program or file * does not exist. This can also be used as a catchall message when * something you wanted to do does not work, but you do not know why. */ - const UNAVAILABLE = 69; + public const UNAVAILABLE = 69; /** * An internal software error has been detected. This should be limited to * non-operating system related errors as possible. */ - const SOFTWARE = 70; + public const SOFTWARE = 70; /** * An operating system error has been detected. This is intended to be * used for such things as ``cannot fork'', ``cannot create pipe'', or the * like. It includes things like getuid returning a user that does not * exist in the passwd file. */ - const OSERR = 71; + public const OSERR = 71; /** * Some system file (e.g., /etc/passwd, /var/run/utx.active, etc.) does not * exist, cannot be opened, or has some sort of error (e.g., syntax error). */ - const OSFILE = 72; + public const OSFILE = 72; /** * A (user specified) output file cannot be created. */ - const CANTCREAT = 73; + public const CANTCREAT = 73; /** * An error occurred while doing I/O on some file. */ - const IOERR = 74; + public const IOERR = 74; /** * Temporary failure, indicating something that is not really an error. In * sendmail, this means that a mailer (e.g.) could not create a connection, * and the request should be reattempted later. */ - const TEMPFAIL = 75; + public const TEMPFAIL = 75; /** * The remote system returned something that was ``not possible'' during a * protocol exchange. */ - const PROTOCOL = 76; + public const PROTOCOL = 76; /** * You did not have sufficient permission to perform the operation. This * is not intended for file system problems, which should use NOINPUT or * CANTCREAT, but rather for higher level permissions. */ - const NOPERM = 77; + public const NOPERM = 77; /** * Something was found in an unconfigured or misconfigured state. */ - const CONFIG = 78; + public const CONFIG = 78; /** * @var array a map of reason descriptions for exit codes. diff --git a/framework/console/controllers/BaseMigrateController.php b/framework/console/controllers/BaseMigrateController.php index 9400c04a37e..abf712c95d5 100644 --- a/framework/console/controllers/BaseMigrateController.php +++ b/framework/console/controllers/BaseMigrateController.php @@ -30,7 +30,7 @@ abstract class BaseMigrateController extends Controller /** * The name of the dummy migration that marks the beginning of the whole migration history. */ - const BASE_MIGRATION = 'm000000_000000_base'; + public const BASE_MIGRATION = 'm000000_000000_base'; /** * @var string the default command action. diff --git a/framework/console/controllers/MigrateController.php b/framework/console/controllers/MigrateController.php index e052daaa888..43206e43acf 100644 --- a/framework/console/controllers/MigrateController.php +++ b/framework/console/controllers/MigrateController.php @@ -78,7 +78,7 @@ class MigrateController extends BaseMigrateController * Maximum length of a migration name. * @since 2.0.13 */ - const MAX_NAME_LENGTH = 180; + public const MAX_NAME_LENGTH = 180; /** * @var string the name of the table for keeping applied migration information. diff --git a/framework/console/controllers/ServeController.php b/framework/console/controllers/ServeController.php index c83c5cc1a7c..0e2ede8d8f4 100644 --- a/framework/console/controllers/ServeController.php +++ b/framework/console/controllers/ServeController.php @@ -23,10 +23,10 @@ */ class ServeController extends Controller { - const EXIT_CODE_NO_DOCUMENT_ROOT = 2; - const EXIT_CODE_NO_ROUTING_FILE = 3; - const EXIT_CODE_ADDRESS_TAKEN_BY_ANOTHER_SERVER = 4; - const EXIT_CODE_ADDRESS_TAKEN_BY_ANOTHER_PROCESS = 5; + public const EXIT_CODE_NO_DOCUMENT_ROOT = 2; + public const EXIT_CODE_NO_ROUTING_FILE = 3; + public const EXIT_CODE_ADDRESS_TAKEN_BY_ANOTHER_SERVER = 4; + public const EXIT_CODE_ADDRESS_TAKEN_BY_ANOTHER_PROCESS = 5; /** * @var int port to serve on. diff --git a/framework/console/widgets/Table.php b/framework/console/widgets/Table.php index 2e4de8f8001..8b936f34cc7 100644 --- a/framework/console/widgets/Table.php +++ b/framework/console/widgets/Table.php @@ -51,23 +51,23 @@ */ class Table extends Widget { - const DEFAULT_CONSOLE_SCREEN_WIDTH = 120; - const CONSOLE_SCROLLBAR_OFFSET = 3; - const CHAR_TOP = 'top'; - const CHAR_TOP_MID = 'top-mid'; - const CHAR_TOP_LEFT = 'top-left'; - const CHAR_TOP_RIGHT = 'top-right'; - const CHAR_BOTTOM = 'bottom'; - const CHAR_BOTTOM_MID = 'bottom-mid'; - const CHAR_BOTTOM_LEFT = 'bottom-left'; - const CHAR_BOTTOM_RIGHT = 'bottom-right'; - const CHAR_LEFT = 'left'; - const CHAR_LEFT_MID = 'left-mid'; - const CHAR_MID = 'mid'; - const CHAR_MID_MID = 'mid-mid'; - const CHAR_RIGHT = 'right'; - const CHAR_RIGHT_MID = 'right-mid'; - const CHAR_MIDDLE = 'middle'; + public const DEFAULT_CONSOLE_SCREEN_WIDTH = 120; + public const CONSOLE_SCROLLBAR_OFFSET = 3; + public const CHAR_TOP = 'top'; + public const CHAR_TOP_MID = 'top-mid'; + public const CHAR_TOP_LEFT = 'top-left'; + public const CHAR_TOP_RIGHT = 'top-right'; + public const CHAR_BOTTOM = 'bottom'; + public const CHAR_BOTTOM_MID = 'bottom-mid'; + public const CHAR_BOTTOM_LEFT = 'bottom-left'; + public const CHAR_BOTTOM_RIGHT = 'bottom-right'; + public const CHAR_LEFT = 'left'; + public const CHAR_LEFT_MID = 'left-mid'; + public const CHAR_MID = 'mid'; + public const CHAR_MID_MID = 'mid-mid'; + public const CHAR_RIGHT = 'right'; + public const CHAR_RIGHT_MID = 'right-mid'; + public const CHAR_MIDDLE = 'middle'; /** * @var array table headers diff --git a/framework/data/DataFilter.php b/framework/data/DataFilter.php index d9265f7a477..002543cbd37 100644 --- a/framework/data/DataFilter.php +++ b/framework/data/DataFilter.php @@ -125,14 +125,14 @@ */ class DataFilter extends Model { - const TYPE_INTEGER = 'integer'; - const TYPE_FLOAT = 'float'; - const TYPE_BOOLEAN = 'boolean'; - const TYPE_STRING = 'string'; - const TYPE_ARRAY = 'array'; - const TYPE_DATETIME = 'datetime'; - const TYPE_DATE = 'date'; - const TYPE_TIME = 'time'; + public const TYPE_INTEGER = 'integer'; + public const TYPE_FLOAT = 'float'; + public const TYPE_BOOLEAN = 'boolean'; + public const TYPE_STRING = 'string'; + public const TYPE_ARRAY = 'array'; + public const TYPE_DATETIME = 'datetime'; + public const TYPE_DATE = 'date'; + public const TYPE_TIME = 'time'; /** * @var string name of the attribute that handles filter value. diff --git a/framework/data/Pagination.php b/framework/data/Pagination.php index d4e76a2a76c..1524f367a8b 100644 --- a/framework/data/Pagination.php +++ b/framework/data/Pagination.php @@ -75,10 +75,10 @@ */ class Pagination extends BaseObject implements Linkable { - const LINK_NEXT = 'next'; - const LINK_PREV = 'prev'; - const LINK_FIRST = 'first'; - const LINK_LAST = 'last'; + public const LINK_NEXT = 'next'; + public const LINK_PREV = 'prev'; + public const LINK_FIRST = 'first'; + public const LINK_LAST = 'last'; /** * @var string name of the parameter storing the current page index. diff --git a/framework/db/ActiveQuery.php b/framework/db/ActiveQuery.php index 1bebd99863d..fa56a600f4a 100644 --- a/framework/db/ActiveQuery.php +++ b/framework/db/ActiveQuery.php @@ -95,7 +95,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface /** * @event Event an event that is triggered when the query is initialized via [[init()]]. */ - const EVENT_INIT = 'init'; + public const EVENT_INIT = 'init'; /** * @var string|null the SQL statement to be executed for retrieving AR records. diff --git a/framework/db/ActiveRecord.php b/framework/db/ActiveRecord.php index 16499e0e950..bff89e2c6c5 100644 --- a/framework/db/ActiveRecord.php +++ b/framework/db/ActiveRecord.php @@ -79,20 +79,20 @@ class ActiveRecord extends BaseActiveRecord /** * The insert operation. This is mainly used when overriding [[transactions()]] to specify which operations are transactional. */ - const OP_INSERT = 0x01; + public const OP_INSERT = 0x01; /** * The update operation. This is mainly used when overriding [[transactions()]] to specify which operations are transactional. */ - const OP_UPDATE = 0x02; + public const OP_UPDATE = 0x02; /** * The delete operation. This is mainly used when overriding [[transactions()]] to specify which operations are transactional. */ - const OP_DELETE = 0x04; + public const OP_DELETE = 0x04; /** * All three operations: insert, update, delete. * This is a shortcut of the expression: OP_INSERT | OP_UPDATE | OP_DELETE. */ - const OP_ALL = 0x07; + public const OP_ALL = 0x07; /** diff --git a/framework/db/BaseActiveRecord.php b/framework/db/BaseActiveRecord.php index 05e2bb5727b..1c1b1c8b2a5 100644 --- a/framework/db/BaseActiveRecord.php +++ b/framework/db/BaseActiveRecord.php @@ -44,43 +44,43 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface /** * @event Event an event that is triggered when the record is initialized via [[init()]]. */ - const EVENT_INIT = 'init'; + public const EVENT_INIT = 'init'; /** * @event Event an event that is triggered after the record is created and populated with query result. */ - const EVENT_AFTER_FIND = 'afterFind'; + public const EVENT_AFTER_FIND = 'afterFind'; /** * @event ModelEvent an event that is triggered before inserting a record. * You may set [[ModelEvent::isValid]] to be `false` to stop the insertion. */ - const EVENT_BEFORE_INSERT = 'beforeInsert'; + public const EVENT_BEFORE_INSERT = 'beforeInsert'; /** * @event AfterSaveEvent an event that is triggered after a record is inserted. */ - const EVENT_AFTER_INSERT = 'afterInsert'; + public const EVENT_AFTER_INSERT = 'afterInsert'; /** * @event ModelEvent an event that is triggered before updating a record. * You may set [[ModelEvent::isValid]] to be `false` to stop the update. */ - const EVENT_BEFORE_UPDATE = 'beforeUpdate'; + public const EVENT_BEFORE_UPDATE = 'beforeUpdate'; /** * @event AfterSaveEvent an event that is triggered after a record is updated. */ - const EVENT_AFTER_UPDATE = 'afterUpdate'; + public const EVENT_AFTER_UPDATE = 'afterUpdate'; /** * @event ModelEvent an event that is triggered before deleting a record. * You may set [[ModelEvent::isValid]] to be `false` to stop the deletion. */ - const EVENT_BEFORE_DELETE = 'beforeDelete'; + public const EVENT_BEFORE_DELETE = 'beforeDelete'; /** * @event Event an event that is triggered after a record is deleted. */ - const EVENT_AFTER_DELETE = 'afterDelete'; + public const EVENT_AFTER_DELETE = 'afterDelete'; /** * @event Event an event that is triggered after a record is refreshed. * @since 2.0.8 */ - const EVENT_AFTER_REFRESH = 'afterRefresh'; + public const EVENT_AFTER_REFRESH = 'afterRefresh'; /** * @var array attribute values indexed by attribute names diff --git a/framework/db/BatchQueryResult.php b/framework/db/BatchQueryResult.php index 260324a0033..da0e9cf6441 100644 --- a/framework/db/BatchQueryResult.php +++ b/framework/db/BatchQueryResult.php @@ -35,17 +35,17 @@ class BatchQueryResult extends Component implements \Iterator * @see reset() * @since 2.0.41 */ - const EVENT_RESET = 'reset'; + public const EVENT_RESET = 'reset'; /** * @event Event an event that is triggered when the last batch has been fetched. * @since 2.0.41 */ - const EVENT_FINISH = 'finish'; + public const EVENT_FINISH = 'finish'; /** * MSSQL error code for exception that is thrown when last batch is size less than specified batch size * @see https://github.com/yiisoft/yii2/issues/10023 */ - const MSSQL_NO_MORE_ROWS_ERROR_CODE = -13; + public const MSSQL_NO_MORE_ROWS_ERROR_CODE = -13; /** * @var Connection|null the DB connection to be used when performing batch query. diff --git a/framework/db/ColumnSchemaBuilder.php b/framework/db/ColumnSchemaBuilder.php index 02ca9f2fee9..029a403b866 100644 --- a/framework/db/ColumnSchemaBuilder.php +++ b/framework/db/ColumnSchemaBuilder.php @@ -25,11 +25,11 @@ class ColumnSchemaBuilder extends BaseObject // Internally used constants representing categories that abstract column types fall under. // See [[$categoryMap]] for mappings of abstract column types to category. // @since 2.0.8 - const CATEGORY_PK = 'pk'; - const CATEGORY_STRING = 'string'; - const CATEGORY_NUMERIC = 'numeric'; - const CATEGORY_TIME = 'time'; - const CATEGORY_OTHER = 'other'; + public const CATEGORY_PK = 'pk'; + public const CATEGORY_STRING = 'string'; + public const CATEGORY_NUMERIC = 'numeric'; + public const CATEGORY_TIME = 'time'; + public const CATEGORY_OTHER = 'other'; /** * @var string the column type definition such as INTEGER, VARCHAR, DATETIME, etc. diff --git a/framework/db/Connection.php b/framework/db/Connection.php index a3e227bd4c3..123577efb44 100644 --- a/framework/db/Connection.php +++ b/framework/db/Connection.php @@ -137,19 +137,19 @@ class Connection extends Component /** * @event \yii\base\Event an event that is triggered after a DB connection is established */ - const EVENT_AFTER_OPEN = 'afterOpen'; + public const EVENT_AFTER_OPEN = 'afterOpen'; /** * @event \yii\base\Event an event that is triggered right before a top-level transaction is started */ - const EVENT_BEGIN_TRANSACTION = 'beginTransaction'; + public const EVENT_BEGIN_TRANSACTION = 'beginTransaction'; /** * @event \yii\base\Event an event that is triggered right after a top-level transaction is committed */ - const EVENT_COMMIT_TRANSACTION = 'commitTransaction'; + public const EVENT_COMMIT_TRANSACTION = 'commitTransaction'; /** * @event \yii\base\Event an event that is triggered right after a top-level transaction is rolled back */ - const EVENT_ROLLBACK_TRANSACTION = 'rollbackTransaction'; + public const EVENT_ROLLBACK_TRANSACTION = 'rollbackTransaction'; /** * @var string the Data Source Name, or DSN, contains the information required to connect to the database. diff --git a/framework/db/JsonExpression.php b/framework/db/JsonExpression.php index 7c7e3bd8559..35aef9a15e5 100644 --- a/framework/db/JsonExpression.php +++ b/framework/db/JsonExpression.php @@ -23,8 +23,8 @@ */ class JsonExpression implements ExpressionInterface, \JsonSerializable { - const TYPE_JSON = 'json'; - const TYPE_JSONB = 'jsonb'; + public const TYPE_JSON = 'json'; + public const TYPE_JSONB = 'jsonb'; /** * @var mixed the value to be encoded to JSON. diff --git a/framework/db/PdoValueBuilder.php b/framework/db/PdoValueBuilder.php index 6bec24c94bd..9f6e5375429 100644 --- a/framework/db/PdoValueBuilder.php +++ b/framework/db/PdoValueBuilder.php @@ -15,7 +15,7 @@ */ class PdoValueBuilder implements ExpressionBuilderInterface { - const PARAM_PREFIX = ':pv'; + public const PARAM_PREFIX = ':pv'; /** diff --git a/framework/db/QueryBuilder.php b/framework/db/QueryBuilder.php index d62e82a1930..a83c2b3a14a 100644 --- a/framework/db/QueryBuilder.php +++ b/framework/db/QueryBuilder.php @@ -38,7 +38,7 @@ class QueryBuilder extends \yii\base\BaseObject /** * The prefix for automatically generated query binding parameters. */ - const PARAM_PREFIX = ':qp'; + public const PARAM_PREFIX = ':qp'; /** * @var Connection the database connection. diff --git a/framework/db/Schema.php b/framework/db/Schema.php index 81448b95d5b..c8b276c3d6a 100644 --- a/framework/db/Schema.php +++ b/framework/db/Schema.php @@ -41,33 +41,33 @@ abstract class Schema extends BaseObject { // The following are the supported abstract column data types. - const TYPE_PK = 'pk'; - const TYPE_UPK = 'upk'; - const TYPE_BIGPK = 'bigpk'; - const TYPE_UBIGPK = 'ubigpk'; - const TYPE_CHAR = 'char'; - const TYPE_STRING = 'string'; - const TYPE_TEXT = 'text'; - const TYPE_TINYINT = 'tinyint'; - const TYPE_SMALLINT = 'smallint'; - const TYPE_INTEGER = 'integer'; - const TYPE_BIGINT = 'bigint'; - const TYPE_FLOAT = 'float'; - const TYPE_DOUBLE = 'double'; - const TYPE_DECIMAL = 'decimal'; - const TYPE_DATETIME = 'datetime'; - const TYPE_TIMESTAMP = 'timestamp'; - const TYPE_TIME = 'time'; - const TYPE_DATE = 'date'; - const TYPE_BINARY = 'binary'; - const TYPE_BOOLEAN = 'boolean'; - const TYPE_MONEY = 'money'; - const TYPE_JSON = 'json'; + public const TYPE_PK = 'pk'; + public const TYPE_UPK = 'upk'; + public const TYPE_BIGPK = 'bigpk'; + public const TYPE_UBIGPK = 'ubigpk'; + public const TYPE_CHAR = 'char'; + public const TYPE_STRING = 'string'; + public const TYPE_TEXT = 'text'; + public const TYPE_TINYINT = 'tinyint'; + public const TYPE_SMALLINT = 'smallint'; + public const TYPE_INTEGER = 'integer'; + public const TYPE_BIGINT = 'bigint'; + public const TYPE_FLOAT = 'float'; + public const TYPE_DOUBLE = 'double'; + public const TYPE_DECIMAL = 'decimal'; + public const TYPE_DATETIME = 'datetime'; + public const TYPE_TIMESTAMP = 'timestamp'; + public const TYPE_TIME = 'time'; + public const TYPE_DATE = 'date'; + public const TYPE_BINARY = 'binary'; + public const TYPE_BOOLEAN = 'boolean'; + public const TYPE_MONEY = 'money'; + public const TYPE_JSON = 'json'; /** * Schema cache version, to detect incompatibilities in cached values when the * data format of the cache changes. */ - const SCHEMA_CACHE_VERSION = 1; + public const SCHEMA_CACHE_VERSION = 1; /** * @var Connection the database connection diff --git a/framework/db/SqlToken.php b/framework/db/SqlToken.php index 64730151aee..c1cdb7faea4 100644 --- a/framework/db/SqlToken.php +++ b/framework/db/SqlToken.php @@ -22,14 +22,14 @@ */ class SqlToken extends BaseObject implements \ArrayAccess { - const TYPE_CODE = 0; - const TYPE_STATEMENT = 1; - const TYPE_TOKEN = 2; - const TYPE_PARENTHESIS = 3; - const TYPE_KEYWORD = 4; - const TYPE_OPERATOR = 5; - const TYPE_IDENTIFIER = 6; - const TYPE_STRING_LITERAL = 7; + public const TYPE_CODE = 0; + public const TYPE_STATEMENT = 1; + public const TYPE_TOKEN = 2; + public const TYPE_PARENTHESIS = 3; + public const TYPE_KEYWORD = 4; + public const TYPE_OPERATOR = 5; + public const TYPE_IDENTIFIER = 6; + public const TYPE_STRING_LITERAL = 7; /** * @var int token type. It has to be one of the following constants: diff --git a/framework/db/Transaction.php b/framework/db/Transaction.php index 9e86b633b4f..54accfb218a 100644 --- a/framework/db/Transaction.php +++ b/framework/db/Transaction.php @@ -55,22 +55,22 @@ class Transaction extends \yii\base\BaseObject * A constant representing the transaction isolation level `READ UNCOMMITTED`. * @see https://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels */ - const READ_UNCOMMITTED = 'READ UNCOMMITTED'; + public const READ_UNCOMMITTED = 'READ UNCOMMITTED'; /** * A constant representing the transaction isolation level `READ COMMITTED`. * @see https://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels */ - const READ_COMMITTED = 'READ COMMITTED'; + public const READ_COMMITTED = 'READ COMMITTED'; /** * A constant representing the transaction isolation level `REPEATABLE READ`. * @see https://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels */ - const REPEATABLE_READ = 'REPEATABLE READ'; + public const REPEATABLE_READ = 'REPEATABLE READ'; /** * A constant representing the transaction isolation level `SERIALIZABLE`. * @see https://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels */ - const SERIALIZABLE = 'SERIALIZABLE'; + public const SERIALIZABLE = 'SERIALIZABLE'; /** * @var Connection the database connection that this transaction is associated with. diff --git a/framework/db/mysql/JsonExpressionBuilder.php b/framework/db/mysql/JsonExpressionBuilder.php index 3eb568d4464..6ddb3ce8086 100644 --- a/framework/db/mysql/JsonExpressionBuilder.php +++ b/framework/db/mysql/JsonExpressionBuilder.php @@ -24,7 +24,7 @@ class JsonExpressionBuilder implements ExpressionBuilderInterface { use ExpressionBuilderTrait; - const PARAM_PREFIX = ':qp'; + public const PARAM_PREFIX = ':qp'; /** diff --git a/framework/db/pgsql/QueryBuilder.php b/framework/db/pgsql/QueryBuilder.php index ada018c2099..5b21faebaa4 100644 --- a/framework/db/pgsql/QueryBuilder.php +++ b/framework/db/pgsql/QueryBuilder.php @@ -26,27 +26,27 @@ class QueryBuilder extends \yii\db\QueryBuilder * Defines a UNIQUE index for [[createIndex()]]. * @since 2.0.6 */ - const INDEX_UNIQUE = 'unique'; + public const INDEX_UNIQUE = 'unique'; /** * Defines a B-tree index for [[createIndex()]]. * @since 2.0.6 */ - const INDEX_B_TREE = 'btree'; + public const INDEX_B_TREE = 'btree'; /** * Defines a hash index for [[createIndex()]]. * @since 2.0.6 */ - const INDEX_HASH = 'hash'; + public const INDEX_HASH = 'hash'; /** * Defines a GiST index for [[createIndex()]]. * @since 2.0.6 */ - const INDEX_GIST = 'gist'; + public const INDEX_GIST = 'gist'; /** * Defines a GIN index for [[createIndex()]]. * @since 2.0.6 */ - const INDEX_GIN = 'gin'; + public const INDEX_GIN = 'gin'; /** * @var array mapping from abstract column types (keys) to physical column types (values). diff --git a/framework/db/pgsql/Schema.php b/framework/db/pgsql/Schema.php index 2a102c6cbc6..04940206438 100644 --- a/framework/db/pgsql/Schema.php +++ b/framework/db/pgsql/Schema.php @@ -32,7 +32,7 @@ class Schema extends \yii\db\Schema implements ConstraintFinderInterface use ViewFinderTrait; use ConstraintFinderTrait; - const TYPE_JSONB = 'jsonb'; + public const TYPE_JSONB = 'jsonb'; /** * @var string the default schema used for the current session. diff --git a/framework/filters/PageCache.php b/framework/filters/PageCache.php index 71a4ef1a02d..aafb0401d4b 100644 --- a/framework/filters/PageCache.php +++ b/framework/filters/PageCache.php @@ -60,7 +60,7 @@ class PageCache extends ActionFilter implements DynamicContentAwareInterface * Page cache version, to detect incompatibilities in cached values when the * data format of the cache changes. */ - const PAGE_CACHE_VERSION = 1; + public const PAGE_CACHE_VERSION = 1; /** * @var bool whether the content being cached should be differentiated according to the route. diff --git a/framework/grid/GridView.php b/framework/grid/GridView.php index f2ca1e2628f..7dd74eb4dc1 100644 --- a/framework/grid/GridView.php +++ b/framework/grid/GridView.php @@ -48,9 +48,9 @@ */ class GridView extends BaseListView { - const FILTER_POS_HEADER = 'header'; - const FILTER_POS_FOOTER = 'footer'; - const FILTER_POS_BODY = 'body'; + public const FILTER_POS_HEADER = 'header'; + public const FILTER_POS_FOOTER = 'footer'; + public const FILTER_POS_BODY = 'body'; /** * @var string the default data column class if the class name is not explicitly specified when configuring a data column. diff --git a/framework/helpers/BaseConsole.php b/framework/helpers/BaseConsole.php index 59e6749840e..a7dfa1e4ba3 100644 --- a/framework/helpers/BaseConsole.php +++ b/framework/helpers/BaseConsole.php @@ -22,36 +22,36 @@ class BaseConsole { // foreground color control codes - const FG_BLACK = 30; - const FG_RED = 31; - const FG_GREEN = 32; - const FG_YELLOW = 33; - const FG_BLUE = 34; - const FG_PURPLE = 35; - const FG_CYAN = 36; - const FG_GREY = 37; + public const FG_BLACK = 30; + public const FG_RED = 31; + public const FG_GREEN = 32; + public const FG_YELLOW = 33; + public const FG_BLUE = 34; + public const FG_PURPLE = 35; + public const FG_CYAN = 36; + public const FG_GREY = 37; // background color control codes - const BG_BLACK = 40; - const BG_RED = 41; - const BG_GREEN = 42; - const BG_YELLOW = 43; - const BG_BLUE = 44; - const BG_PURPLE = 45; - const BG_CYAN = 46; - const BG_GREY = 47; + public const BG_BLACK = 40; + public const BG_RED = 41; + public const BG_GREEN = 42; + public const BG_YELLOW = 43; + public const BG_BLUE = 44; + public const BG_PURPLE = 45; + public const BG_CYAN = 46; + public const BG_GREY = 47; // fonts style control codes - const RESET = 0; - const NORMAL = 0; - const BOLD = 1; - const ITALIC = 3; - const UNDERLINE = 4; - const BLINK = 5; - const NEGATIVE = 7; - const CONCEALED = 8; - const CROSSED_OUT = 9; - const FRAMED = 51; - const ENCIRCLED = 52; - const OVERLINED = 53; + public const RESET = 0; + public const NORMAL = 0; + public const BOLD = 1; + public const ITALIC = 3; + public const UNDERLINE = 4; + public const BLINK = 5; + public const NEGATIVE = 7; + public const CONCEALED = 8; + public const CROSSED_OUT = 9; + public const FRAMED = 51; + public const ENCIRCLED = 52; + public const OVERLINED = 53; /** diff --git a/framework/helpers/BaseFileHelper.php b/framework/helpers/BaseFileHelper.php index 8ec2761daef..556a28b39d1 100644 --- a/framework/helpers/BaseFileHelper.php +++ b/framework/helpers/BaseFileHelper.php @@ -24,11 +24,11 @@ */ class BaseFileHelper { - const PATTERN_NODIR = 1; - const PATTERN_ENDSWITH = 4; - const PATTERN_MUSTBEDIR = 8; - const PATTERN_NEGATIVE = 16; - const PATTERN_CASE_INSENSITIVE = 32; + public const PATTERN_NODIR = 1; + public const PATTERN_ENDSWITH = 4; + public const PATTERN_MUSTBEDIR = 8; + public const PATTERN_NEGATIVE = 16; + public const PATTERN_CASE_INSENSITIVE = 32; /** * @var string the path (or alias) of a PHP file containing MIME type information. diff --git a/framework/helpers/BaseInflector.php b/framework/helpers/BaseInflector.php index 08bd059131a..80b2c2a8939 100644 --- a/framework/helpers/BaseInflector.php +++ b/framework/helpers/BaseInflector.php @@ -251,7 +251,7 @@ class BaseInflector * @see transliterate() * @since 2.0.7 */ - const TRANSLITERATE_STRICT = 'Any-Latin; NFKD'; + public const TRANSLITERATE_STRICT = 'Any-Latin; NFKD'; /** * Shortcut for `Any-Latin; Latin-ASCII` transliteration rule. * @@ -266,7 +266,7 @@ class BaseInflector * @see transliterate() * @since 2.0.7 */ - const TRANSLITERATE_MEDIUM = 'Any-Latin; Latin-ASCII'; + public const TRANSLITERATE_MEDIUM = 'Any-Latin; Latin-ASCII'; /** * Shortcut for `Any-Latin; Latin-ASCII; [\u0080-\uffff] remove` transliteration rule. * @@ -282,7 +282,7 @@ class BaseInflector * @see transliterate() * @since 2.0.7 */ - const TRANSLITERATE_LOOSE = 'Any-Latin; Latin-ASCII; [\u0080-\uffff] remove'; + public const TRANSLITERATE_LOOSE = 'Any-Latin; Latin-ASCII; [\u0080-\uffff] remove'; /** * @var mixed Either a [[\Transliterator]], or a string from which a [[\Transliterator]] can be built diff --git a/framework/helpers/BaseIpHelper.php b/framework/helpers/BaseIpHelper.php index cf90cd32d50..ce803c71e3f 100644 --- a/framework/helpers/BaseIpHelper.php +++ b/framework/helpers/BaseIpHelper.php @@ -19,16 +19,16 @@ */ class BaseIpHelper { - const IPV4 = 4; - const IPV6 = 6; + public const IPV4 = 4; + public const IPV6 = 6; /** * The length of IPv6 address in bits */ - const IPV6_ADDRESS_LENGTH = 128; + public const IPV6_ADDRESS_LENGTH = 128; /** * The length of IPv4 address in bits */ - const IPV4_ADDRESS_LENGTH = 32; + public const IPV4_ADDRESS_LENGTH = 32; /** diff --git a/framework/i18n/DbMessageSource.php b/framework/i18n/DbMessageSource.php index e7934be3564..7e1270f886a 100644 --- a/framework/i18n/DbMessageSource.php +++ b/framework/i18n/DbMessageSource.php @@ -42,7 +42,7 @@ class DbMessageSource extends MessageSource * Prefix which would be used when generating cache key. * @deprecated This constant has never been used and will be removed in 2.1.0. */ - const CACHE_KEY_PREFIX = 'DbMessageSource'; + public const CACHE_KEY_PREFIX = 'DbMessageSource'; /** * @var Connection|array|string the DB connection object or the application component ID of the DB connection. diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php index 31efbc22f7b..273a45a4e6d 100644 --- a/framework/i18n/Formatter.php +++ b/framework/i18n/Formatter.php @@ -56,27 +56,27 @@ class Formatter extends Component /** * @since 2.0.13 */ - const UNIT_SYSTEM_METRIC = 'metric'; + public const UNIT_SYSTEM_METRIC = 'metric'; /** * @since 2.0.13 */ - const UNIT_SYSTEM_IMPERIAL = 'imperial'; + public const UNIT_SYSTEM_IMPERIAL = 'imperial'; /** * @since 2.0.13 */ - const FORMAT_WIDTH_LONG = 'long'; + public const FORMAT_WIDTH_LONG = 'long'; /** * @since 2.0.13 */ - const FORMAT_WIDTH_SHORT = 'short'; + public const FORMAT_WIDTH_SHORT = 'short'; /** * @since 2.0.13 */ - const UNIT_LENGTH = 'length'; + public const UNIT_LENGTH = 'length'; /** * @since 2.0.13 */ - const UNIT_WEIGHT = 'mass'; + public const UNIT_WEIGHT = 'mass'; /** * @var string|null the text to be displayed when formatting a `null` value. diff --git a/framework/i18n/GettextMessageSource.php b/framework/i18n/GettextMessageSource.php index b3cb6acd207..a9acce74116 100644 --- a/framework/i18n/GettextMessageSource.php +++ b/framework/i18n/GettextMessageSource.php @@ -29,8 +29,8 @@ */ class GettextMessageSource extends MessageSource { - const MO_FILE_EXT = '.mo'; - const PO_FILE_EXT = '.po'; + public const MO_FILE_EXT = '.mo'; + public const PO_FILE_EXT = '.po'; /** * @var string base directory of messages files diff --git a/framework/i18n/MessageSource.php b/framework/i18n/MessageSource.php index 9725158636f..b2c4d129740 100644 --- a/framework/i18n/MessageSource.php +++ b/framework/i18n/MessageSource.php @@ -25,7 +25,7 @@ class MessageSource extends Component /** * @event MissingTranslationEvent an event that is triggered when a message translation is not found. */ - const EVENT_MISSING_TRANSLATION = 'missingTranslation'; + public const EVENT_MISSING_TRANSLATION = 'missingTranslation'; /** * @var bool whether to force message translation when the source and target languages are the same. diff --git a/framework/log/Logger.php b/framework/log/Logger.php index 62294c31f93..c2aa21f41cf 100644 --- a/framework/log/Logger.php +++ b/framework/log/Logger.php @@ -45,35 +45,35 @@ class Logger extends Component * Error message level. An error message is one that indicates the abnormal termination of the * application and may require developer's handling. */ - const LEVEL_ERROR = 0x01; + public const LEVEL_ERROR = 0x01; /** * Warning message level. A warning message is one that indicates some abnormal happens but * the application is able to continue to run. Developers should pay attention to this message. */ - const LEVEL_WARNING = 0x02; + public const LEVEL_WARNING = 0x02; /** * Informational message level. An informational message is one that includes certain information * for developers to review. */ - const LEVEL_INFO = 0x04; + public const LEVEL_INFO = 0x04; /** * Tracing message level. A tracing message is one that reveals the code execution flow. */ - const LEVEL_TRACE = 0x08; + public const LEVEL_TRACE = 0x08; /** * Profiling message level. This indicates the message is for profiling purpose. */ - const LEVEL_PROFILE = 0x40; + public const LEVEL_PROFILE = 0x40; /** * Profiling message level. This indicates the message is for profiling purpose. It marks the beginning * of a profiling block. */ - const LEVEL_PROFILE_BEGIN = 0x50; + public const LEVEL_PROFILE_BEGIN = 0x50; /** * Profiling message level. This indicates the message is for profiling purpose. It marks the end * of a profiling block. */ - const LEVEL_PROFILE_END = 0x60; + public const LEVEL_PROFILE_END = 0x60; /** * @var array logged messages. This property is managed by [[log()]] and [[flush()]]. diff --git a/framework/mail/BaseMailer.php b/framework/mail/BaseMailer.php index e6ce1a2f15d..1703b76fa1e 100644 --- a/framework/mail/BaseMailer.php +++ b/framework/mail/BaseMailer.php @@ -36,11 +36,11 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont * @event MailEvent an event raised right before send. * You may set [[MailEvent::isValid]] to be false to cancel the send. */ - const EVENT_BEFORE_SEND = 'beforeSend'; + public const EVENT_BEFORE_SEND = 'beforeSend'; /** * @event MailEvent an event raised right after send. */ - const EVENT_AFTER_SEND = 'afterSend'; + public const EVENT_AFTER_SEND = 'afterSend'; /** * @var string|bool HTML layout view name. This is the layout used to render HTML mail body. diff --git a/framework/mutex/OracleMutex.php b/framework/mutex/OracleMutex.php index 1e15876edd8..c8c32efe99f 100644 --- a/framework/mutex/OracleMutex.php +++ b/framework/mutex/OracleMutex.php @@ -42,12 +42,12 @@ class OracleMutex extends DbMutex { /** available lock modes */ - const MODE_X = 'X_MODE'; - const MODE_NL = 'NL_MODE'; - const MODE_S = 'S_MODE'; - const MODE_SX = 'SX_MODE'; - const MODE_SS = 'SS_MODE'; - const MODE_SSX = 'SSX_MODE'; + public const MODE_X = 'X_MODE'; + public const MODE_NL = 'NL_MODE'; + public const MODE_S = 'S_MODE'; + public const MODE_SX = 'SX_MODE'; + public const MODE_SS = 'SS_MODE'; + public const MODE_SSX = 'SSX_MODE'; /** * @var string lock mode to be used. diff --git a/framework/rbac/Item.php b/framework/rbac/Item.php index 69738026d98..36abdbe4122 100644 --- a/framework/rbac/Item.php +++ b/framework/rbac/Item.php @@ -17,8 +17,8 @@ */ class Item extends BaseObject { - const TYPE_ROLE = 1; - const TYPE_PERMISSION = 2; + public const TYPE_ROLE = 1; + public const TYPE_PERMISSION = 2; /** * @var int the type of the item. This should be either [[TYPE_ROLE]] or [[TYPE_PERMISSION]]. diff --git a/framework/requirements/YiiRequirementChecker.php b/framework/requirements/YiiRequirementChecker.php index 0982a66ffe9..1fa443d1aef 100644 --- a/framework/requirements/YiiRequirementChecker.php +++ b/framework/requirements/YiiRequirementChecker.php @@ -68,7 +68,7 @@ class YiiRequirementChecker * If a string, it is treated as the path of the file, which contains the requirements; * @return $this self instance. */ - function check($requirements) + public function check($requirements) { if (is_string($requirements)) { $requirements = require $requirements; @@ -113,7 +113,7 @@ function check($requirements) * Performs the check for the Yii core requirements. * @return YiiRequirementChecker self instance. */ - function checkYii() + public function checkYii() { return $this->check(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'requirements.php'); } @@ -140,7 +140,7 @@ function checkYii() * ) * ``` */ - function getResult() + public function getResult() { if (isset($this->result)) { return $this->result; @@ -153,7 +153,7 @@ function getResult() * Renders the requirements check result. * The output will vary depending is a script running from web or from console. */ - function render() + public function render() { if (!isset($this->result)) { $this->usageError('Nothing to render!'); @@ -174,7 +174,7 @@ function render() * @param string $compare comparison operator, by default '>=' * @return bool if PHP extension version matches. */ - function checkPhpExtensionVersion($extensionName, $version, $compare = '>=') + public function checkPhpExtensionVersion($extensionName, $version, $compare = '>=') { if (!extension_loaded($extensionName)) { return false; @@ -195,7 +195,7 @@ function checkPhpExtensionVersion($extensionName, $version, $compare = '>=') * @param string $name configuration option name. * @return bool option is on. */ - function checkPhpIniOn($name) + public function checkPhpIniOn($name) { $value = ini_get($name); if (empty($value)) { @@ -210,7 +210,7 @@ function checkPhpIniOn($name) * @param string $name configuration option name. * @return bool option is off. */ - function checkPhpIniOff($name) + public function checkPhpIniOff($name) { $value = ini_get($name); if (empty($value)) { @@ -228,7 +228,7 @@ function checkPhpIniOff($name) * @param string $compare comparison operator, by default '>='. * @return bool comparison result. */ - function compareByteSize($a, $b, $compare = '>=') + public function compareByteSize($a, $b, $compare = '>=') { $compareExpression = '(' . $this->getByteSize($a) . $compare . $this->getByteSize($b) . ')'; @@ -241,7 +241,7 @@ function compareByteSize($a, $b, $compare = '>=') * @param string $verboseSize verbose size representation. * @return int actual size in bytes. */ - function getByteSize($verboseSize) + public function getByteSize($verboseSize) { if (empty($verboseSize)) { return 0; @@ -275,7 +275,7 @@ function getByteSize($verboseSize) * @param string|null $max verbose file size maximum required value, pass null to skip maximum check. * @return bool success. */ - function checkUploadMaxFileSize($min = null, $max = null) + public function checkUploadMaxFileSize($min = null, $max = null) { $postMaxSize = ini_get('post_max_size'); $uploadMaxFileSize = ini_get('upload_max_filesize'); @@ -302,7 +302,7 @@ function checkUploadMaxFileSize($min = null, $max = null) * @param bool $_return_ whether the rendering result should be returned as a string * @return string|null the rendering result. Null if the rendering result is not required. */ - function renderViewFile($_viewFile_, $_data_ = null, $_return_ = false) + public function renderViewFile($_viewFile_, $_data_ = null, $_return_ = false) { // we use special variable names here to avoid conflict when extracting data if (is_array($_data_)) { @@ -329,7 +329,7 @@ function renderViewFile($_viewFile_, $_data_ = null, $_return_ = false) * @param int $requirementKey requirement key in the list. * @return array normalized requirement. */ - function normalizeRequirement($requirement, $requirementKey = 0) + public function normalizeRequirement($requirement, $requirementKey = 0) { if (!is_array($requirement)) { $this->usageError('Requirement must be an array!'); @@ -368,7 +368,7 @@ function normalizeRequirement($requirement, $requirementKey = 0) * This method will then terminate the execution of the current application. * @param string $message the error message */ - function usageError($message) + public function usageError($message) { echo "Error: $message\n\n"; exit(1); @@ -379,7 +379,7 @@ function usageError($message) * @param string $expression a PHP expression to be evaluated. * @return mixed the expression result. */ - function evaluateExpression($expression) + public function evaluateExpression($expression) { return eval('return ' . $expression . ';'); } @@ -388,7 +388,7 @@ function evaluateExpression($expression) * Returns the server information. * @return string server information. */ - function getServerInfo() + public function getServerInfo() { return isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : ''; } @@ -397,7 +397,7 @@ function getServerInfo() * Returns the now date if possible in string representation. * @return string now date. */ - function getNowDate() + public function getNowDate() { return date('Y-m-d H:i'); } diff --git a/framework/validators/CompareValidator.php b/framework/validators/CompareValidator.php index 4c786c4e551..c893387f258 100644 --- a/framework/validators/CompareValidator.php +++ b/framework/validators/CompareValidator.php @@ -39,13 +39,13 @@ class CompareValidator extends Validator * @since 2.0.11 * @see type */ - const TYPE_STRING = 'string'; + public const TYPE_STRING = 'string'; /** * Constant for specifying the comparison [[type]] by numeric values. * @since 2.0.11 * @see type */ - const TYPE_NUMBER = 'number'; + public const TYPE_NUMBER = 'number'; /** * @var string the name of the attribute to be compared with. When both this property diff --git a/framework/validators/DateValidator.php b/framework/validators/DateValidator.php index 9ea6bbf4d01..16c0daef601 100644 --- a/framework/validators/DateValidator.php +++ b/framework/validators/DateValidator.php @@ -41,19 +41,19 @@ class DateValidator extends Validator * @since 2.0.8 * @see type */ - const TYPE_DATE = 'date'; + public const TYPE_DATE = 'date'; /** * Constant for specifying the validation [[type]] as a datetime value, used for validation with intl short format. * @since 2.0.8 * @see type */ - const TYPE_DATETIME = 'datetime'; + public const TYPE_DATETIME = 'datetime'; /** * Constant for specifying the validation [[type]] as a time value, used for validation with intl short format. * @since 2.0.8 * @see type */ - const TYPE_TIME = 'time'; + public const TYPE_TIME = 'time'; /** * @var string the type of the validator. Indicates, whether a date, time or datetime value should be validated. diff --git a/framework/validators/IpValidator.php b/framework/validators/IpValidator.php index d94ca6a2195..ec14cc40e27 100644 --- a/framework/validators/IpValidator.php +++ b/framework/validators/IpValidator.php @@ -48,7 +48,7 @@ class IpValidator extends Validator * @see networks * @see ranges */ - const NEGATION_CHAR = '!'; + public const NEGATION_CHAR = '!'; /** * @var array The network aliases, that can be used in [[ranges]]. diff --git a/framework/web/Cookie.php b/framework/web/Cookie.php index 598a6b75549..963668ead3a 100644 --- a/framework/web/Cookie.php +++ b/framework/web/Cookie.php @@ -24,7 +24,7 @@ class Cookie extends \yii\base\BaseObject * When a user follows a link from https://otherdomain.com to https://yourdomain.com it will include the cookie * @see sameSite */ - const SAME_SITE_LAX = 'Lax'; + public const SAME_SITE_LAX = 'Lax'; /** * SameSite policy Strict will prevent the cookie from being sent by the browser in all cross-site browsing context * regardless of the request method and even when following a regular link. @@ -32,7 +32,7 @@ class Cookie extends \yii\base\BaseObject * https://otherdomain.com to https://yourdomain.com will not include the cookie. * @see sameSite */ - const SAME_SITE_STRICT = 'Strict'; + public const SAME_SITE_STRICT = 'Strict'; /** * SameSite policy None disables the SameSite policy so cookies will be sent in all contexts, * i.e in responses to both first-party and cross-origin requests. @@ -42,7 +42,7 @@ class Cookie extends \yii\base\BaseObject * @see secure * @since 2.0.43 */ - const SAME_SITE_NONE = 'None'; + public const SAME_SITE_NONE = 'None'; /** * @var string name of the cookie diff --git a/framework/web/JsonResponseFormatter.php b/framework/web/JsonResponseFormatter.php index d26545283a6..cbacc1448fe 100644 --- a/framework/web/JsonResponseFormatter.php +++ b/framework/web/JsonResponseFormatter.php @@ -42,17 +42,17 @@ class JsonResponseFormatter extends Component implements ResponseFormatterInterf * JSON Content Type * @since 2.0.14 */ - const CONTENT_TYPE_JSONP = 'application/javascript; charset=UTF-8'; + public const CONTENT_TYPE_JSONP = 'application/javascript; charset=UTF-8'; /** * JSONP Content Type * @since 2.0.14 */ - const CONTENT_TYPE_JSON = 'application/json; charset=UTF-8'; + public const CONTENT_TYPE_JSON = 'application/json; charset=UTF-8'; /** * HAL JSON Content Type * @since 2.0.14 */ - const CONTENT_TYPE_HAL_JSON = 'application/hal+json; charset=UTF-8'; + public const CONTENT_TYPE_HAL_JSON = 'application/hal+json; charset=UTF-8'; /** * @var string|null custom value of the `Content-Type` header of the response. diff --git a/framework/web/Link.php b/framework/web/Link.php index 3f90fc66a28..8d5d20d3935 100644 --- a/framework/web/Link.php +++ b/framework/web/Link.php @@ -20,7 +20,7 @@ class Link extends BaseObject /** * The self link. */ - const REL_SELF = 'self'; + public const REL_SELF = 'self'; /** * @var string a URI [RFC3986](https://tools.ietf.org/html/rfc3986) or diff --git a/framework/web/Request.php b/framework/web/Request.php index 0fa5044e005..292bc95205f 100644 --- a/framework/web/Request.php +++ b/framework/web/Request.php @@ -94,12 +94,12 @@ class Request extends \yii\base\Request /** * Default name of the HTTP header for sending CSRF token. */ - const CSRF_HEADER = 'X-CSRF-Token'; + public const CSRF_HEADER = 'X-CSRF-Token'; /** * The length of the CSRF token mask. * @deprecated since 2.0.12. The mask length is now equal to the token length. */ - const CSRF_MASK_LENGTH = 8; + public const CSRF_MASK_LENGTH = 8; /** * @var bool whether to enable CSRF (Cross-Site Request Forgery) validation. Defaults to true. diff --git a/framework/web/Response.php b/framework/web/Response.php index f36c9e9a7ba..e30fc8856ae 100644 --- a/framework/web/Response.php +++ b/framework/web/Response.php @@ -64,21 +64,21 @@ class Response extends \yii\base\Response /** * @event \yii\base\Event an event that is triggered at the beginning of [[send()]]. */ - const EVENT_BEFORE_SEND = 'beforeSend'; + public const EVENT_BEFORE_SEND = 'beforeSend'; /** * @event \yii\base\Event an event that is triggered at the end of [[send()]]. */ - const EVENT_AFTER_SEND = 'afterSend'; + public const EVENT_AFTER_SEND = 'afterSend'; /** * @event \yii\base\Event an event that is triggered right after [[prepare()]] is called in [[send()]]. * 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'; - const FORMAT_JSONP = 'jsonp'; - const FORMAT_XML = 'xml'; + public const EVENT_AFTER_PREPARE = 'afterPrepare'; + public const FORMAT_RAW = 'raw'; + public const FORMAT_HTML = 'html'; + public const FORMAT_JSON = 'json'; + public const FORMAT_JSONP = 'jsonp'; + public const FORMAT_XML = 'xml'; /** * @var string the response format. This determines how to convert [[data]] into [[content]] diff --git a/framework/web/UrlNormalizer.php b/framework/web/UrlNormalizer.php index f356f740379..d16d49c628f 100644 --- a/framework/web/UrlNormalizer.php +++ b/framework/web/UrlNormalizer.php @@ -24,17 +24,17 @@ class UrlNormalizer extends BaseObject * Represents permament redirection during route normalization. * @see https://en.wikipedia.org/wiki/HTTP_301 */ - const ACTION_REDIRECT_PERMANENT = 301; + public const ACTION_REDIRECT_PERMANENT = 301; /** * Represents temporary redirection during route normalization. * @see https://en.wikipedia.org/wiki/HTTP_302 */ - const ACTION_REDIRECT_TEMPORARY = 302; + public const ACTION_REDIRECT_TEMPORARY = 302; /** * Represents showing 404 error page during route normalization. * @see https://en.wikipedia.org/wiki/HTTP_404 */ - const ACTION_NOT_FOUND = 404; + public const ACTION_NOT_FOUND = 404; /** * @var bool whether slashes should be collapsed, for example `site///index` will be diff --git a/framework/web/UrlRule.php b/framework/web/UrlRule.php index 72715fd0d40..3979b3ad814 100644 --- a/framework/web/UrlRule.php +++ b/framework/web/UrlRule.php @@ -35,37 +35,37 @@ class UrlRule extends BaseObject implements UrlRuleInterface /** * Set [[mode]] with this value to mark that this rule is for URL parsing only. */ - const PARSING_ONLY = 1; + public const PARSING_ONLY = 1; /** * Set [[mode]] with this value to mark that this rule is for URL creation only. */ - const CREATION_ONLY = 2; + public const CREATION_ONLY = 2; /** * Represents the successful URL generation by last [[createUrl()]] call. * @see createStatus * @since 2.0.12 */ - const CREATE_STATUS_SUCCESS = 0; + public const CREATE_STATUS_SUCCESS = 0; /** * Represents the unsuccessful URL generation by last [[createUrl()]] call, because rule does not support * creating URLs. * @see createStatus * @since 2.0.12 */ - const CREATE_STATUS_PARSING_ONLY = 1; + public const CREATE_STATUS_PARSING_ONLY = 1; /** * Represents the unsuccessful URL generation by last [[createUrl()]] call, because of mismatched route. * @see createStatus * @since 2.0.12 */ - const CREATE_STATUS_ROUTE_MISMATCH = 2; + public const CREATE_STATUS_ROUTE_MISMATCH = 2; /** * Represents the unsuccessful URL generation by last [[createUrl()]] call, because of mismatched * or missing parameters. * @see createStatus * @since 2.0.12 */ - const CREATE_STATUS_PARAMS_MISMATCH = 4; + public const CREATE_STATUS_PARAMS_MISMATCH = 4; /** * @var string|null the name of this rule. If not set, it will use [[pattern]] as the name. diff --git a/framework/web/User.php b/framework/web/User.php index 5a113158ade..3189dfce29d 100644 --- a/framework/web/User.php +++ b/framework/web/User.php @@ -64,10 +64,10 @@ */ class User extends Component { - const EVENT_BEFORE_LOGIN = 'beforeLogin'; - const EVENT_AFTER_LOGIN = 'afterLogin'; - const EVENT_BEFORE_LOGOUT = 'beforeLogout'; - const EVENT_AFTER_LOGOUT = 'afterLogout'; + public const EVENT_BEFORE_LOGIN = 'beforeLogin'; + public const EVENT_AFTER_LOGIN = 'afterLogin'; + public const EVENT_BEFORE_LOGOUT = 'beforeLogout'; + public const EVENT_AFTER_LOGOUT = 'afterLogout'; /** * @var string the class name of the [[identity]] object. diff --git a/framework/web/View.php b/framework/web/View.php index 90a42ca0063..9619ef93dfe 100644 --- a/framework/web/View.php +++ b/framework/web/View.php @@ -73,48 +73,48 @@ class View extends \yii\base\View /** * @event Event an event that is triggered by [[beginBody()]]. */ - const EVENT_BEGIN_BODY = 'beginBody'; + public const EVENT_BEGIN_BODY = 'beginBody'; /** * @event Event an event that is triggered by [[endBody()]]. */ - const EVENT_END_BODY = 'endBody'; + public const EVENT_END_BODY = 'endBody'; /** * The location of registered JavaScript code block or files. * This means the location is in the head section. */ - const POS_HEAD = 1; + public const POS_HEAD = 1; /** * The location of registered JavaScript code block or files. * This means the location is at the beginning of the body section. */ - const POS_BEGIN = 2; + public const POS_BEGIN = 2; /** * The location of registered JavaScript code block or files. * This means the location is at the end of the body section. */ - const POS_END = 3; + public const POS_END = 3; /** * The location of registered JavaScript code block. * This means the JavaScript code block will be enclosed within `jQuery(document).ready()`. */ - const POS_READY = 4; + public const POS_READY = 4; /** * The location of registered JavaScript code block. * This means the JavaScript code block will be enclosed within `jQuery(window).load()`. */ - const POS_LOAD = 5; + public const POS_LOAD = 5; /** * This is internally used as the placeholder for receiving the content registered for the head section. */ - const PH_HEAD = ''; + public const PH_HEAD = ''; /** * This is internally used as the placeholder for receiving the content registered for the beginning of the body section. */ - const PH_BODY_BEGIN = ''; + public const PH_BODY_BEGIN = ''; /** * This is internally used as the placeholder for receiving the content registered for the end of the body section. */ - const PH_BODY_END = ''; + public const PH_BODY_END = ''; /** * @var AssetBundle[] list of the registered asset bundles. The keys are the bundle names, and the values diff --git a/framework/widgets/ActiveForm.php b/framework/widgets/ActiveForm.php index a9d72de06a4..d19bab9bc40 100644 --- a/framework/widgets/ActiveForm.php +++ b/framework/widgets/ActiveForm.php @@ -30,12 +30,12 @@ class ActiveForm extends Widget * Add validation state class to container tag * @since 2.0.14 */ - const VALIDATION_STATE_ON_CONTAINER = 'container'; + public const VALIDATION_STATE_ON_CONTAINER = 'container'; /** * Add validation state class to input tag * @since 2.0.14 */ - const VALIDATION_STATE_ON_INPUT = 'input'; + public const VALIDATION_STATE_ON_INPUT = 'input'; /** * @var array|string the form action URL. This parameter will be processed by [[\yii\helpers\Url::to()]]. diff --git a/framework/widgets/MaskedInput.php b/framework/widgets/MaskedInput.php index 104dec71b26..65aabb24b13 100644 --- a/framework/widgets/MaskedInput.php +++ b/framework/widgets/MaskedInput.php @@ -48,7 +48,7 @@ class MaskedInput extends InputWidget /** * The name of the jQuery plugin to use for this widget. */ - const PLUGIN_NAME = 'inputmask'; + public const PLUGIN_NAME = 'inputmask'; /** * @var string|array|JsExpression the input mask (e.g. '99/99/9999' for date input). The following characters diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 7462f8e658b..a11d2a0d337 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,9 +1,6 @@ - - - - + diff --git a/tests/data/ar/Customer.php b/tests/data/ar/Customer.php index 1accbfbaf84..a46d6973a14 100644 --- a/tests/data/ar/Customer.php +++ b/tests/data/ar/Customer.php @@ -26,8 +26,8 @@ */ class Customer extends ActiveRecord { - const STATUS_ACTIVE = 1; - const STATUS_INACTIVE = 2; + public const STATUS_ACTIVE = 1; + public const STATUS_INACTIVE = 2; public $status2; diff --git a/tests/data/ar/CustomerWithAlias.php b/tests/data/ar/CustomerWithAlias.php index 359a33647be..43c824b9126 100644 --- a/tests/data/ar/CustomerWithAlias.php +++ b/tests/data/ar/CustomerWithAlias.php @@ -15,8 +15,8 @@ */ class CustomerWithAlias extends ActiveRecord { - const STATUS_ACTIVE = 1; - const STATUS_INACTIVE = 2; + public const STATUS_ACTIVE = 1; + public const STATUS_INACTIVE = 2; public $status2; diff --git a/tests/framework/base/EventTest.php b/tests/framework/base/EventTest.php index f7bd56ca19e..5140e6cb7de 100644 --- a/tests/framework/base/EventTest.php +++ b/tests/framework/base/EventTest.php @@ -207,7 +207,7 @@ class User extends ActiveRecord interface SomeInterface { - const EVENT_SUPER_EVENT = 'superEvent'; + public const EVENT_SUPER_EVENT = 'superEvent'; } class SomeClass extends Component implements SomeInterface diff --git a/tests/framework/base/SecurityTest.php b/tests/framework/base/SecurityTest.php index 1dbbc1d7136..c8b50b48a88 100644 --- a/tests/framework/base/SecurityTest.php +++ b/tests/framework/base/SecurityTest.php @@ -19,7 +19,7 @@ */ class SecurityTest extends TestCase { - const CRYPT_VECTORS = 'old'; + public const CRYPT_VECTORS = 'old'; /** * @var ExposedSecurity diff --git a/tests/framework/db/mysql/connection/DeadLockTest.php b/tests/framework/db/mysql/connection/DeadLockTest.php index 550b2852a69..874caeaa597 100644 --- a/tests/framework/db/mysql/connection/DeadLockTest.php +++ b/tests/framework/db/mysql/connection/DeadLockTest.php @@ -20,7 +20,7 @@ class DeadLockTest extends \yiiunit\framework\db\mysql\ConnectionTest /** @var string Shared log filename for children */ private $logFile; - const CHILD_EXIT_CODE_DEADLOCK = 15; + public const CHILD_EXIT_CODE_DEADLOCK = 15; /** * Test deadlock exception. diff --git a/tests/framework/db/pgsql/ActiveRecordTest.php b/tests/framework/db/pgsql/ActiveRecordTest.php index f40cc595e85..b639b40ecaa 100644 --- a/tests/framework/db/pgsql/ActiveRecordTest.php +++ b/tests/framework/db/pgsql/ActiveRecordTest.php @@ -315,9 +315,9 @@ public static function tableName() class UserAR extends ActiveRecord { - const STATUS_DELETED = 0; - const STATUS_ACTIVE = 10; - const ROLE_USER = 10; + public const STATUS_DELETED = 0; + public const STATUS_ACTIVE = 10; + public const ROLE_USER = 10; public static function tableName() { diff --git a/tests/framework/i18n/FallbackMessageFormatterTest.php b/tests/framework/i18n/FallbackMessageFormatterTest.php index 5faab06d67e..a42b69a5971 100644 --- a/tests/framework/i18n/FallbackMessageFormatterTest.php +++ b/tests/framework/i18n/FallbackMessageFormatterTest.php @@ -17,17 +17,17 @@ */ class FallbackMessageFormatterTest extends TestCase { - const N = 'n'; - const N_VALUE = 42; - const F = 'f'; - const F_VALUE = 2e+8; - const F_VALUE_FORMATTED = '200,000,000'; - const D = 'd'; - const D_VALUE = 200000000.101; - const D_VALUE_FORMATTED = '200,000,000.101'; - const D_VALUE_FORMATTED_INTEGER = '200,000,000'; - const SUBJECT = 'сабж'; - const SUBJECT_VALUE = 'Answer to the Ultimate Question of Life, the Universe, and Everything'; + public const N = 'n'; + public const N_VALUE = 42; + public const F = 'f'; + public const F_VALUE = 2e+8; + public const F_VALUE_FORMATTED = '200,000,000'; + public const D = 'd'; + public const D_VALUE = 200000000.101; + public const D_VALUE_FORMATTED = '200,000,000.101'; + public const D_VALUE_FORMATTED_INTEGER = '200,000,000'; + public const SUBJECT = 'сабж'; + public const SUBJECT_VALUE = 'Answer to the Ultimate Question of Life, the Universe, and Everything'; public function patterns() { diff --git a/tests/framework/i18n/MessageFormatterTest.php b/tests/framework/i18n/MessageFormatterTest.php index 164ed7e2fe1..320fb53e51d 100644 --- a/tests/framework/i18n/MessageFormatterTest.php +++ b/tests/framework/i18n/MessageFormatterTest.php @@ -17,17 +17,17 @@ */ class MessageFormatterTest extends TestCase { - const N = 'n'; - const N_VALUE = 42; - const F = 'f'; - const F_VALUE = 2e+8; - const F_VALUE_FORMATTED = '200,000,000'; - const D = 'd'; - const D_VALUE = 200000000.101; - const D_VALUE_FORMATTED = '200,000,000.101'; - const D_VALUE_FORMATTED_INTEGER = '200,000,000'; - const SUBJECT = 'сабж'; - const SUBJECT_VALUE = 'Answer to the Ultimate Question of Life, the Universe, and Everything'; + public const N = 'n'; + public const N_VALUE = 42; + public const F = 'f'; + public const F_VALUE = 2e+8; + public const F_VALUE_FORMATTED = '200,000,000'; + public const D = 'd'; + public const D_VALUE = 200000000.101; + public const D_VALUE_FORMATTED = '200,000,000.101'; + public const D_VALUE_FORMATTED_INTEGER = '200,000,000'; + public const SUBJECT = 'сабж'; + public const SUBJECT_VALUE = 'Answer to the Ultimate Question of Life, the Universe, and Everything'; public function patterns() {