diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index f5e11f987..d6a1b50a8 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -21,6 +21,9 @@ 'array_syntax' => array( 'syntax' => 'long', ), + 'visibility_required' => array( + 'elements' => array('property', 'method'), + ), )) ->setCacheFile('.php-cs-fixer.cache') ->setFinder($finder) diff --git a/lib/cache/sfCache.class.php b/lib/cache/sfCache.class.php index 4f0c022ac..556b32b0d 100644 --- a/lib/cache/sfCache.class.php +++ b/lib/cache/sfCache.class.php @@ -15,9 +15,9 @@ */ abstract class sfCache { - public const OLD = 1; - public const ALL = 2; - public const SEPARATOR = ':'; + const OLD = 1; + const ALL = 2; + const SEPARATOR = ':'; protected $options = array(); diff --git a/lib/cache/sfFileCache.class.php b/lib/cache/sfFileCache.class.php index 4807a493b..bd0c2de02 100644 --- a/lib/cache/sfFileCache.class.php +++ b/lib/cache/sfFileCache.class.php @@ -15,11 +15,11 @@ */ class sfFileCache extends sfCache { - public const READ_DATA = 1; - public const READ_TIMEOUT = 2; - public const READ_LAST_MODIFIED = 4; + const READ_DATA = 1; + const READ_TIMEOUT = 2; + const READ_LAST_MODIFIED = 4; - public const EXTENSION = '.cache'; + const EXTENSION = '.cache'; /** * Initializes this sfCache instance. diff --git a/lib/command/sfCommandArgument.class.php b/lib/command/sfCommandArgument.class.php index 470a9e707..37b5e3d7b 100644 --- a/lib/command/sfCommandArgument.class.php +++ b/lib/command/sfCommandArgument.class.php @@ -15,10 +15,10 @@ */ class sfCommandArgument { - public const REQUIRED = 1; - public const OPTIONAL = 2; + const REQUIRED = 1; + const OPTIONAL = 2; - public const IS_ARRAY = 4; + const IS_ARRAY = 4; protected $name; protected $mode; diff --git a/lib/command/sfCommandOption.class.php b/lib/command/sfCommandOption.class.php index 6cdf8f6c7..da9cd36a0 100644 --- a/lib/command/sfCommandOption.class.php +++ b/lib/command/sfCommandOption.class.php @@ -15,11 +15,11 @@ */ class sfCommandOption { - public const PARAMETER_NONE = 1; - public const PARAMETER_REQUIRED = 2; - public const PARAMETER_OPTIONAL = 4; + const PARAMETER_NONE = 1; + const PARAMETER_REQUIRED = 2; + const PARAMETER_OPTIONAL = 4; - public const IS_ARRAY = 8; + const IS_ARRAY = 8; protected $name; protected $shortcut; diff --git a/lib/i18n/sfCultureInfo.class.php b/lib/i18n/sfCultureInfo.class.php index da0a30c23..5dcf6ab44 100644 --- a/lib/i18n/sfCultureInfo.class.php +++ b/lib/i18n/sfCultureInfo.class.php @@ -56,7 +56,7 @@ class sfCultureInfo * * @var int */ - public const ALL = 0; + const ALL = 0; /** * Culture type, neutral. @@ -65,7 +65,7 @@ class sfCultureInfo * * @var int */ - public const NEUTRAL = 1; + const NEUTRAL = 1; /** * Culture type, specific. @@ -74,7 +74,7 @@ class sfCultureInfo * * @var int */ - public const SPECIFIC = 2; + const SPECIFIC = 2; /** * ICU data filename extension. diff --git a/lib/i18n/sfNumberFormatInfo.class.php b/lib/i18n/sfNumberFormatInfo.class.php index e047be56f..bc80e953c 100644 --- a/lib/i18n/sfNumberFormatInfo.class.php +++ b/lib/i18n/sfNumberFormatInfo.class.php @@ -41,10 +41,10 @@ */ class sfNumberFormatInfo { - public const DECIMAL = 0; - public const CURRENCY = 1; - public const PERCENTAGE = 2; - public const SCIENTIFIC = 3; + const DECIMAL = 0; + const CURRENCY = 1; + const PERCENTAGE = 2; + const SCIENTIFIC = 3; /** * ICU number formatting data. diff --git a/lib/log/sfLogger.class.php b/lib/log/sfLogger.class.php index 11eec8bc2..773819d4a 100644 --- a/lib/log/sfLogger.class.php +++ b/lib/log/sfLogger.class.php @@ -25,14 +25,14 @@ */ abstract class sfLogger implements sfLoggerInterface { - public const EMERG = 0; // System is unusable - public const ALERT = 1; // Immediate action required - public const CRIT = 2; // Critical conditions - public const ERR = 3; // Error conditions - public const WARNING = 4; // Warning conditions - public const NOTICE = 5; // Normal but significant - public const INFO = 6; // Informational - public const DEBUG = 7; // Debug-level messages + const EMERG = 0; // System is unusable + const ALERT = 1; // Immediate action required + const CRIT = 2; // Critical conditions + const ERR = 3; // Error conditions + const WARNING = 4; // Warning conditions + const NOTICE = 5; // Normal but significant + const INFO = 6; // Informational + const DEBUG = 7; // Debug-level messages /** @var sfEventDispatcher */ protected $dispatcher; diff --git a/lib/mailer/sfMailer.class.php b/lib/mailer/sfMailer.class.php index a99aa58a8..9b0edcb6a 100755 --- a/lib/mailer/sfMailer.class.php +++ b/lib/mailer/sfMailer.class.php @@ -17,10 +17,10 @@ */ class sfMailer extends Swift_Mailer { - public const REALTIME = 'realtime'; - public const SPOOL = 'spool'; - public const SINGLE_ADDRESS = 'single_address'; - public const NONE = 'none'; + const REALTIME = 'realtime'; + const SPOOL = 'spool'; + const SINGLE_ADDRESS = 'single_address'; + const NONE = 'none'; protected $spool; protected $logger; diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php index 53a9cbbd8..ec84d16f1 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php @@ -18,22 +18,22 @@ */ class sfDoctrineBuildTask extends sfDoctrineBaseTask { - public const BUILD_MODEL = 1; - public const BUILD_FORMS = 2; - public const BUILD_FILTERS = 4; - public const BUILD_SQL = 8; - public const BUILD_DB = 16; - public const OPTION_MODEL = 1; - public const OPTION_FORMS = 3; - public const // model, forms + const BUILD_MODEL = 1; + const BUILD_FORMS = 2; + const BUILD_FILTERS = 4; + const BUILD_SQL = 8; + const BUILD_DB = 16; + const OPTION_MODEL = 1; + const OPTION_FORMS = 3; + const // model, forms OPTION_FILTERS = 5; - public const // model, filters + const // model, filters OPTION_SQL = 9; - public const // model, sql + const // model, sql OPTION_DB = 25; - public const // model, sql, db + const // model, sql, db OPTION_ALL_CLASSES = 7; - public const // model, forms, filters + const // model, forms, filters OPTION_ALL = 31; // model, forms, filters, sql, db /** diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/form/doctrine/AttachmentForm.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/form/doctrine/AttachmentForm.class.php index a0db28014..c8b9fc517 100644 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/form/doctrine/AttachmentForm.class.php +++ b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/form/doctrine/AttachmentForm.class.php @@ -7,7 +7,7 @@ */ class AttachmentForm extends BaseAttachmentForm { - public const TEST_GENERATED_FILENAME = 'test123'; + const TEST_GENERATED_FILENAME = 'test123'; public function configure() { diff --git a/lib/request/sfRequest.class.php b/lib/request/sfRequest.class.php index 27fadb7ba..544afcfa2 100644 --- a/lib/request/sfRequest.class.php +++ b/lib/request/sfRequest.class.php @@ -19,13 +19,13 @@ */ abstract class sfRequest implements ArrayAccess { - public const GET = 'GET'; - public const POST = 'POST'; - public const PUT = 'PUT'; - public const PATCH = 'PATCH'; - public const DELETE = 'DELETE'; - public const HEAD = 'HEAD'; - public const OPTIONS = 'OPTIONS'; + const GET = 'GET'; + const POST = 'POST'; + const PUT = 'PUT'; + const PATCH = 'PATCH'; + const DELETE = 'DELETE'; + const HEAD = 'HEAD'; + const OPTIONS = 'OPTIONS'; /** @var sfEventDispatcher */ protected $dispatcher; diff --git a/lib/request/sfWebRequest.class.php b/lib/request/sfWebRequest.class.php index c098c3e69..ccaba90e8 100644 --- a/lib/request/sfWebRequest.class.php +++ b/lib/request/sfWebRequest.class.php @@ -19,8 +19,8 @@ */ class sfWebRequest extends sfRequest { - public const PORT_HTTP = 80; - public const PORT_HTTPS = 443; + const PORT_HTTP = 80; + const PORT_HTTPS = 443; protected $languages; protected $charsets; diff --git a/lib/response/sfWebResponse.class.php b/lib/response/sfWebResponse.class.php index 4984b970c..f59a16dea 100644 --- a/lib/response/sfWebResponse.class.php +++ b/lib/response/sfWebResponse.class.php @@ -17,11 +17,11 @@ */ class sfWebResponse extends sfResponse { - public const FIRST = 'first'; - public const MIDDLE = ''; - public const LAST = 'last'; - public const ALL = 'ALL'; - public const RAW = 'RAW'; + const FIRST = 'first'; + const MIDDLE = ''; + const LAST = 'last'; + const ALL = 'ALL'; + const RAW = 'RAW'; protected $cookies = array(); protected $statusCode = 200; diff --git a/lib/task/log/sfLogRotateTask.class.php b/lib/task/log/sfLogRotateTask.class.php index 5068e7a4d..688c3b5cf 100644 --- a/lib/task/log/sfLogRotateTask.class.php +++ b/lib/task/log/sfLogRotateTask.class.php @@ -16,10 +16,10 @@ class sfLogRotateTask extends sfBaseTask { /** the default period to rotate logs in days */ - public const DEF_PERIOD = 7; + const DEF_PERIOD = 7; /** the default number of log historys to store, one history is created for every period */ - public const DEF_HISTORY = 10; + const DEF_HISTORY = 10; /** * Rotates log file. diff --git a/lib/user/sfBasicSecurityUser.class.php b/lib/user/sfBasicSecurityUser.class.php index 80fdf6426..00b29b78c 100644 --- a/lib/user/sfBasicSecurityUser.class.php +++ b/lib/user/sfBasicSecurityUser.class.php @@ -17,9 +17,9 @@ */ class sfBasicSecurityUser extends sfUser implements sfSecurityUser { - public const LAST_REQUEST_NAMESPACE = 'symfony/user/sfUser/lastRequest'; - public const AUTH_NAMESPACE = 'symfony/user/sfUser/authenticated'; - public const CREDENTIAL_NAMESPACE = 'symfony/user/sfUser/credentials'; + const LAST_REQUEST_NAMESPACE = 'symfony/user/sfUser/lastRequest'; + const AUTH_NAMESPACE = 'symfony/user/sfUser/authenticated'; + const CREDENTIAL_NAMESPACE = 'symfony/user/sfUser/credentials'; protected $lastRequest; diff --git a/lib/user/sfUser.class.php b/lib/user/sfUser.class.php index 1ef4c6b5a..3a57c624e 100644 --- a/lib/user/sfUser.class.php +++ b/lib/user/sfUser.class.php @@ -23,9 +23,9 @@ class sfUser implements ArrayAccess /** * The namespace under which attributes will be stored. */ - public const ATTRIBUTE_NAMESPACE = 'symfony/user/sfUser/attributes'; + const ATTRIBUTE_NAMESPACE = 'symfony/user/sfUser/attributes'; - public const CULTURE_NAMESPACE = 'symfony/user/sfUser/culture'; + const CULTURE_NAMESPACE = 'symfony/user/sfUser/culture'; protected $options = array(); diff --git a/lib/validator/sfValidatorEmail.class.php b/lib/validator/sfValidatorEmail.class.php index e8434db38..29b4118be 100644 --- a/lib/validator/sfValidatorEmail.class.php +++ b/lib/validator/sfValidatorEmail.class.php @@ -15,7 +15,7 @@ */ class sfValidatorEmail extends sfValidatorRegex { - public const REGEX_EMAIL = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i'; + const REGEX_EMAIL = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i'; /** * @see sfValidatorRegex diff --git a/lib/validator/sfValidatorIp.class.php b/lib/validator/sfValidatorIp.class.php index eb1dd89c7..a0b69ae48 100644 --- a/lib/validator/sfValidatorIp.class.php +++ b/lib/validator/sfValidatorIp.class.php @@ -15,24 +15,24 @@ */ class sfValidatorIp extends sfValidatorString { - public const IP_V4 = '4'; - public const IP_V6 = '6'; - public const IP_ALL = 'all'; + const IP_V4 = '4'; + const IP_V6 = '6'; + const IP_ALL = 'all'; // adds FILTER_FLAG_NO_PRIV_RANGE flag (skip private ranges) - public const IP_V4_NO_PRIV = '4_no_priv'; - public const IP_V6_NO_PRIV = '6_no_priv'; - public const IP_ALL_NO_PRIV = 'all_no_priv'; + const IP_V4_NO_PRIV = '4_no_priv'; + const IP_V6_NO_PRIV = '6_no_priv'; + const IP_ALL_NO_PRIV = 'all_no_priv'; // adds FILTER_FLAG_NO_RES_RANGE flag (skip reserved ranges) - public const IP_V4_NO_RES = '4_no_res'; - public const IP_V6_NO_RES = '6_no_res'; - public const IP_ALL_NO_RES = 'all_no_res'; + const IP_V4_NO_RES = '4_no_res'; + const IP_V6_NO_RES = '6_no_res'; + const IP_ALL_NO_RES = 'all_no_res'; // adds FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE flags (skip both) - public const IP_V4_ONLY_PUBLIC = '4_public'; - public const IP_V6_ONLY_PUBLIC = '6_public'; - public const IP_ALL_ONLY_PUBLIC = 'all_public'; + const IP_V4_ONLY_PUBLIC = '4_public'; + const IP_V6_ONLY_PUBLIC = '6_public'; + const IP_ALL_ONLY_PUBLIC = 'all_public'; public function configure($options = array(), $messages = array()) { diff --git a/lib/validator/sfValidatorSchemaCompare.class.php b/lib/validator/sfValidatorSchemaCompare.class.php index d0cbef887..4b567af84 100644 --- a/lib/validator/sfValidatorSchemaCompare.class.php +++ b/lib/validator/sfValidatorSchemaCompare.class.php @@ -15,14 +15,14 @@ */ class sfValidatorSchemaCompare extends sfValidatorSchema { - public const EQUAL = '=='; - public const NOT_EQUAL = '!='; - public const IDENTICAL = '==='; - public const NOT_IDENTICAL = '!=='; - public const LESS_THAN = '<'; - public const LESS_THAN_EQUAL = '<='; - public const GREATER_THAN = '>'; - public const GREATER_THAN_EQUAL = '>='; + const EQUAL = '=='; + const NOT_EQUAL = '!='; + const IDENTICAL = '==='; + const NOT_IDENTICAL = '!=='; + const LESS_THAN = '<'; + const LESS_THAN_EQUAL = '<='; + const GREATER_THAN = '>'; + const GREATER_THAN_EQUAL = '>='; /** * Constructor. diff --git a/lib/validator/sfValidatorUrl.class.php b/lib/validator/sfValidatorUrl.class.php index 05bfadf47..5fcfc5a87 100644 --- a/lib/validator/sfValidatorUrl.class.php +++ b/lib/validator/sfValidatorUrl.class.php @@ -15,7 +15,7 @@ */ class sfValidatorUrl extends sfValidatorRegex { - public const REGEX_URL_FORMAT = '~^ + const REGEX_URL_FORMAT = '~^ (%s):// # protocol ( ([a-z0-9-]+\.)+[a-z]{2,6} # a domain name diff --git a/lib/view/sfView.class.php b/lib/view/sfView.class.php index 9aaf9710d..6ebd73f50 100644 --- a/lib/view/sfView.class.php +++ b/lib/view/sfView.class.php @@ -22,47 +22,47 @@ abstract class sfView /** * Show an alert view. */ - public const ALERT = 'Alert'; + const ALERT = 'Alert'; /** * Show an error view. */ - public const ERROR = 'Error'; + const ERROR = 'Error'; /** * Show a form input view. */ - public const INPUT = 'Input'; + const INPUT = 'Input'; /** * Skip view execution. */ - public const NONE = 'None'; + const NONE = 'None'; /** * Show a success view. */ - public const SUCCESS = 'Success'; + const SUCCESS = 'Success'; /** * Do not render the presentation. */ - public const RENDER_NONE = 1; + const RENDER_NONE = 1; /** * Render the presentation to the client. */ - public const RENDER_CLIENT = 2; + const RENDER_CLIENT = 2; /** * Render the presentation to a variable. */ - public const RENDER_VAR = 4; + const RENDER_VAR = 4; /** * Skip view rendering but output http headers. */ - public const HEADER_ONLY = 8; + const HEADER_ONLY = 8; protected $context; protected $dispatcher; diff --git a/lib/widget/sfWidgetFormSchema.class.php b/lib/widget/sfWidgetFormSchema.class.php index 32a80aa1c..803f6cd22 100644 --- a/lib/widget/sfWidgetFormSchema.class.php +++ b/lib/widget/sfWidgetFormSchema.class.php @@ -17,10 +17,10 @@ */ class sfWidgetFormSchema extends sfWidgetForm implements ArrayAccess { - public const FIRST = 'first'; - public const LAST = 'last'; - public const BEFORE = 'before'; - public const AFTER = 'after'; + const FIRST = 'first'; + const LAST = 'last'; + const BEFORE = 'before'; + const AFTER = 'after'; protected static $defaultFormatterName = 'table'; diff --git a/lib/yaml/sfYamlInline.class.php b/lib/yaml/sfYamlInline.class.php index e466a6014..2af3f91e5 100644 --- a/lib/yaml/sfYamlInline.class.php +++ b/lib/yaml/sfYamlInline.class.php @@ -15,7 +15,7 @@ */ class sfYamlInline { - public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; + const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; /** * Convert a YAML string to a PHP array.