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 656e3fc71..edd8d2d9d 100644 --- a/lib/cache/sfCache.class.php +++ b/lib/cache/sfCache.class.php @@ -17,9 +17,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 11d2d3c84..903ed5455 100644 --- a/lib/cache/sfFileCache.class.php +++ b/lib/cache/sfFileCache.class.php @@ -17,11 +17,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 380590e80..1509490af 100644 --- a/lib/command/sfCommandArgument.class.php +++ b/lib/command/sfCommandArgument.class.php @@ -17,10 +17,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 43e1f91d3..a6fb819b0 100644 --- a/lib/command/sfCommandOption.class.php +++ b/lib/command/sfCommandOption.class.php @@ -17,11 +17,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 faaa70a24..93b5017be 100644 --- a/lib/log/sfLogger.class.php +++ b/lib/log/sfLogger.class.php @@ -27,14 +27,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 bb55247f4..036bd00c0 100755 --- a/lib/mailer/sfMailer.class.php +++ b/lib/mailer/sfMailer.class.php @@ -19,10 +19,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 618d353ae..61b96fcae 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php @@ -20,22 +20,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 904de2898..2dcd667fa 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 @@ -9,7 +9,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 354c3f430..9c2e18677 100644 --- a/lib/request/sfRequest.class.php +++ b/lib/request/sfRequest.class.php @@ -21,13 +21,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 554c04c54..9f0bf345d 100644 --- a/lib/request/sfWebRequest.class.php +++ b/lib/request/sfWebRequest.class.php @@ -21,8 +21,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 e1a78c9a3..209c0d92f 100644 --- a/lib/response/sfWebResponse.class.php +++ b/lib/response/sfWebResponse.class.php @@ -19,11 +19,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 db8edd525..16606d249 100644 --- a/lib/task/log/sfLogRotateTask.class.php +++ b/lib/task/log/sfLogRotateTask.class.php @@ -18,10 +18,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 4a82bfa0a..78b4305c5 100644 --- a/lib/user/sfBasicSecurityUser.class.php +++ b/lib/user/sfBasicSecurityUser.class.php @@ -19,9 +19,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 45e6881dd..70c6fecb5 100644 --- a/lib/user/sfUser.class.php +++ b/lib/user/sfUser.class.php @@ -25,9 +25,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 39b218164..53f54331d 100644 --- a/lib/validator/sfValidatorEmail.class.php +++ b/lib/validator/sfValidatorEmail.class.php @@ -17,7 +17,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 9bf2cdb24..fa08105f2 100644 --- a/lib/validator/sfValidatorIp.class.php +++ b/lib/validator/sfValidatorIp.class.php @@ -17,24 +17,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 3572aa1cb..351facd02 100644 --- a/lib/validator/sfValidatorSchemaCompare.class.php +++ b/lib/validator/sfValidatorSchemaCompare.class.php @@ -17,14 +17,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 d63cf3a88..1c9caa86f 100644 --- a/lib/validator/sfValidatorUrl.class.php +++ b/lib/validator/sfValidatorUrl.class.php @@ -17,7 +17,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 3efbf0f8a..8f1f69814 100644 --- a/lib/view/sfView.class.php +++ b/lib/view/sfView.class.php @@ -24,47 +24,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 20126c1e6..0c790936c 100644 --- a/lib/widget/sfWidgetFormSchema.class.php +++ b/lib/widget/sfWidgetFormSchema.class.php @@ -19,10 +19,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 d1028416f..e18a33d4e 100644 --- a/lib/yaml/sfYamlInline.class.php +++ b/lib/yaml/sfYamlInline.class.php @@ -17,7 +17,7 @@ */ class sfYamlInline { - public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; + const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; /** * Convert a YAML string to a PHP array.