Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore support of PHP <7.1 #293

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
'array_syntax' => array(
'syntax' => 'long',
),
'visibility_required' => array(
'elements' => array('property', 'method'),
),
))
->setCacheFile('.php-cs-fixer.cache')
->setFinder($finder)
Expand Down
6 changes: 3 additions & 3 deletions lib/cache/sfCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 4 additions & 4 deletions lib/cache/sfFileCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions lib/command/sfCommandArgument.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions lib/command/sfCommandOption.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions lib/i18n/sfCultureInfo.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class sfCultureInfo
*
* @var int
*/
public const ALL = 0;
const ALL = 0;

/**
* Culture type, neutral.
Expand All @@ -65,7 +65,7 @@ class sfCultureInfo
*
* @var int
*/
public const NEUTRAL = 1;
const NEUTRAL = 1;

/**
* Culture type, specific.
Expand All @@ -74,7 +74,7 @@ class sfCultureInfo
*
* @var int
*/
public const SPECIFIC = 2;
const SPECIFIC = 2;

/**
* ICU data filename extension.
Expand Down
8 changes: 4 additions & 4 deletions lib/i18n/sfNumberFormatInfo.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions lib/log/sfLogger.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions lib/mailer/sfMailer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 12 additions & 12 deletions lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
class AttachmentForm extends BaseAttachmentForm
{
public const TEST_GENERATED_FILENAME = 'test123';
const TEST_GENERATED_FILENAME = 'test123';

public function configure()
{
Expand Down
14 changes: 7 additions & 7 deletions lib/request/sfRequest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/request/sfWebRequest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions lib/response/sfWebResponse.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/task/log/sfLogRotateTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions lib/user/sfBasicSecurityUser.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions lib/user/sfUser.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion lib/validator/sfValidatorEmail.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions lib/validator/sfValidatorIp.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down
16 changes: 8 additions & 8 deletions lib/validator/sfValidatorSchemaCompare.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/validator/sfValidatorUrl.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading