Skip to content

Commit

Permalink
Configure visibility_required CS rule for constants (#1723)
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif authored and ruflin committed Dec 4, 2019
1 parent bfd9e79 commit e09439b
Show file tree
Hide file tree
Showing 47 changed files with 198 additions and 196 deletions.
1 change: 1 addition & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ $config = PhpCsFixer\Config::create()
'native_function_invocation' => true,
'no_alias_functions' => true,
'nullable_type_declaration_for_default_null_value' => true,
'visibility_required' => ['property', 'method', 'const'],
])
;

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file based on the

* Launch tests with PHP 7.4
* Added `nullable_type_declaration_for_default_null_value`, `no_alias_functions` CS rules [#1706](https://github.com/ruflin/Elastica/pull/1706)
* Configured `visibility_required` CS rule for constants [#1723](https://github.com/ruflin/Elastica/pull/1723)

### Deprecated

Expand Down
4 changes: 2 additions & 2 deletions lib/Elastica/Aggregation/AvgBucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/
class AvgBucket extends AbstractAggregation
{
const DEFAULT_GAP_POLICY_VALUE = 'skip';
const DEFAULT_FORMAT_VALUE = null;
public const DEFAULT_GAP_POLICY_VALUE = 'skip';
public const DEFAULT_FORMAT_VALUE = null;

public function __construct(string $name, ?string $bucketsPath = null)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Aggregation/Cardinality.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class Cardinality extends AbstractSimpleAggregation
{
const DEFAULT_PRECISION_THRESHOLD_VALUE = 3000;
public const DEFAULT_PRECISION_THRESHOLD_VALUE = 3000;

/**
* @return $this
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Aggregation/DateHistogram.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class DateHistogram extends Histogram
{
const DEFAULT_TIMEZONE_VALUE = 'UTC';
public const DEFAULT_TIMEZONE_VALUE = 'UTC';

/**
* Set time_zone option.
Expand Down
4 changes: 2 additions & 2 deletions lib/Elastica/Aggregation/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*/
class Filters extends AbstractAggregation
{
const NAMED_TYPE = 1;
const ANONYMOUS_TYPE = 2;
public const NAMED_TYPE = 1;
public const ANONYMOUS_TYPE = 2;

/**
* @var int Type of bucket keys - named, or anonymous
Expand Down
8 changes: 4 additions & 4 deletions lib/Elastica/Aggregation/GeoDistance.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
*/
class GeoDistance extends AbstractAggregation
{
const DISTANCE_TYPE_ARC = 'arc';
const DISTANCE_TYPE_PLANE = 'plane';
public const DISTANCE_TYPE_ARC = 'arc';
public const DISTANCE_TYPE_PLANE = 'plane';

const DEFAULT_DISTANCE_TYPE_VALUE = self::DISTANCE_TYPE_ARC;
const DEFAULT_UNIT_VALUE = 'm';
public const DEFAULT_DISTANCE_TYPE_VALUE = self::DISTANCE_TYPE_ARC;
public const DEFAULT_UNIT_VALUE = 'm';

/**
* @param string $name the name if this aggregation
Expand Down
4 changes: 2 additions & 2 deletions lib/Elastica/Aggregation/GeohashGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/
class GeohashGrid extends AbstractAggregation
{
const DEFAULT_PRECISION_VALUE = 5;
const DEFAULT_SIZE_VALUE = 10000;
public const DEFAULT_PRECISION_VALUE = 5;
public const DEFAULT_SIZE_VALUE = 10000;

/**
* @param string $name the name of this aggregation
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Aggregation/SerialDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class SerialDiff extends AbstractAggregation
{
const DEFAULT_GAP_POLICY_VALUE = 'insert_zero';
public const DEFAULT_GAP_POLICY_VALUE = 'insert_zero';

public function __construct(string $name, ?string $bucketsPath = null)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Bulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class Bulk
{
const DELIMITER = "\n";
public const DELIMITER = "\n";

/**
* @var Client
Expand Down
8 changes: 4 additions & 4 deletions lib/Elastica/Bulk/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

class Action
{
const OP_TYPE_CREATE = 'create';
const OP_TYPE_INDEX = 'index';
const OP_TYPE_DELETE = 'delete';
const OP_TYPE_UPDATE = 'update';
public const OP_TYPE_CREATE = 'create';
public const OP_TYPE_INDEX = 'index';
public const OP_TYPE_DELETE = 'delete';
public const OP_TYPE_UPDATE = 'update';

/**
* @var array
Expand Down
12 changes: 6 additions & 6 deletions lib/Elastica/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,39 @@ class Connection extends Param
/**
* Default elastic search port.
*/
const DEFAULT_PORT = 9200;
public const DEFAULT_PORT = 9200;

/**
* Default host.
*/
const DEFAULT_HOST = 'localhost';
public const DEFAULT_HOST = 'localhost';

/**
* Default transport.
*
* @var string
*/
const DEFAULT_TRANSPORT = 'Http';
public const DEFAULT_TRANSPORT = 'Http';

/**
* Default compression.
*
* @var string
*/
const DEFAULT_COMPRESSION = false;
public const DEFAULT_COMPRESSION = false;

/**
* Number of seconds after a timeout occurs for every request
* If using indexing of file large value necessary.
*/
const TIMEOUT = 300;
public const TIMEOUT = 300;

/**
* Number of seconds after a connection timeout occurs for every request during the connection phase.
*
* @see Connection::setConnectTimeout();
*/
const CONNECT_TIMEOUT = 0;
public const CONNECT_TIMEOUT = 0;

/**
* Creates a new connection object. A connection is enabled by default.
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Exception/ElasticsearchException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class ElasticsearchException extends \Exception implements ExceptionInterface
{
const REMOTE_TRANSPORT_EXCEPTION = 'RemoteTransportException';
public const REMOTE_TRANSPORT_EXCEPTION = 'RemoteTransportException';

/**
* @var string|null Elasticsearch exception name
Expand Down
6 changes: 3 additions & 3 deletions lib/Elastica/Index/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
*/
class Settings
{
const DEFAULT_REFRESH_INTERVAL = '1s';
public const DEFAULT_REFRESH_INTERVAL = '1s';

const DEFAULT_NUMBER_OF_REPLICAS = 1;
public const DEFAULT_NUMBER_OF_REPLICAS = 1;

const DEFAULT_NUMBER_OF_SHARDS = 1;
public const DEFAULT_NUMBER_OF_SHARDS = 1;

/**
* Response.
Expand Down
6 changes: 3 additions & 3 deletions lib/Elastica/Processor/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
class Attachment extends AbstractProcessor
{
const DEFAULT_TARGET_FIELD_VALUE = 'attachment';
const DEFAULT_INDEXED_CHARS_VALUE = 100000;
const DEFAULT_IGNORE_MISSING_VALUE = false;
public const DEFAULT_TARGET_FIELD_VALUE = 'attachment';
public const DEFAULT_INDEXED_CHARS_VALUE = 100000;
public const DEFAULT_IGNORE_MISSING_VALUE = false;

/**
* Attachment constructor.
Expand Down
4 changes: 2 additions & 2 deletions lib/Elastica/Processor/Convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/
class Convert extends AbstractProcessor
{
const DEFAULT_TARGET_FIELD_VALUE = 'field';
const DEFAULT_IGNORE_MISSING_VALUE = false;
public const DEFAULT_TARGET_FIELD_VALUE = 'field';
public const DEFAULT_IGNORE_MISSING_VALUE = false;

/**
* Convert constructor.
Expand Down
6 changes: 3 additions & 3 deletions lib/Elastica/Processor/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
class Date extends AbstractProcessor
{
const DEFAULT_TARGET_FIELD_VALUE = '@timestamp';
const DEFAULT_TIMEZONE_VALUE = 'UTC';
const DEFAULT_LOCALE_VALUE = 'ENGLISH';
public const DEFAULT_TARGET_FIELD_VALUE = '@timestamp';
public const DEFAULT_TIMEZONE_VALUE = 'UTC';
public const DEFAULT_LOCALE_VALUE = 'ENGLISH';

/**
* Date constructor.
Expand Down
8 changes: 4 additions & 4 deletions lib/Elastica/Processor/DateIndexName.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
*/
class DateIndexName extends AbstractProcessor
{
const DEFAULT_DATE_FORMATS_VALUE = ['ISO8601'];
const DEFAULT_INDEX_NAME_FORMAT_VALUE = 'yyyy-MM-dd';
const DEFAULT_TIMEZONE_VALUE = 'UTC';
const DEFAULT_LOCALE_VALUE = 'ENGLISH';
public const DEFAULT_DATE_FORMATS_VALUE = ['ISO8601'];
public const DEFAULT_INDEX_NAME_FORMAT_VALUE = 'yyyy-MM-dd';
public const DEFAULT_TIMEZONE_VALUE = 'UTC';
public const DEFAULT_LOCALE_VALUE = 'ENGLISH';

/**
* DateIndexName constructor.
Expand Down
4 changes: 2 additions & 2 deletions lib/Elastica/Processor/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/
class Json extends AbstractProcessor
{
const DEFAULT_TARGET_FIELD_VALUE = 'field';
const DEFAULT_ADD_TO_ROOT_VALUE = false;
public const DEFAULT_TARGET_FIELD_VALUE = 'field';
public const DEFAULT_ADD_TO_ROOT_VALUE = false;

/**
* Json constructor.
Expand Down
4 changes: 2 additions & 2 deletions lib/Elastica/Processor/Kv.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/
class Kv extends AbstractProcessor
{
const DEFAULT_TARGET_FIELD_VALUE = null;
const DEFAULT_IGNORE_MISSING_VALUE = false;
public const DEFAULT_TARGET_FIELD_VALUE = null;
public const DEFAULT_IGNORE_MISSING_VALUE = false;

/**
* Kv constructor.
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Processor/Rename.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class Rename extends AbstractProcessor
{
const DEFAULT_IGNORE_MISSING_VALUE = false;
public const DEFAULT_IGNORE_MISSING_VALUE = false;

/**
* Rename constructor.
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Processor/Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class Set extends AbstractProcessor
{
const DEFAULT_OVERRIDE_VALUE = true;
public const DEFAULT_OVERRIDE_VALUE = true;

/**
* Set constructor.
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Processor/Sort.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class Sort extends AbstractProcessor
{
const DEFAULT_ORDER_VALUE = 'asc';
public const DEFAULT_ORDER_VALUE = 'asc';

/**
* Sort constructor.
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Processor/Split.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class Split extends AbstractProcessor
{
const DEFAULT_IGNORE_MISSING_VALUE = false;
public const DEFAULT_IGNORE_MISSING_VALUE = false;

/**
* Split constructor.
Expand Down
4 changes: 2 additions & 2 deletions lib/Elastica/Query/AbstractGeoDistance.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*/
abstract class AbstractGeoDistance extends AbstractQuery
{
const LOCATION_TYPE_GEOHASH = 'geohash';
const LOCATION_TYPE_LATLON = 'latlon';
public const LOCATION_TYPE_GEOHASH = 'geohash';
public const LOCATION_TYPE_LATLON = 'latlon';

/**
* Location type.
Expand Down
8 changes: 4 additions & 4 deletions lib/Elastica/Query/AbstractGeoShape.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
abstract class AbstractGeoShape extends AbstractQuery
{
/** Return all documents whose geo_shape field intersects the query geometry. (default behavior) */
const RELATION_INTERSECT = 'intersects';
public const RELATION_INTERSECT = 'intersects';

/** Return all documents whose geo_shape field has nothing in common with the query geometry. */
const RELATION_DISJOINT = 'disjoint';
public const RELATION_DISJOINT = 'disjoint';

/** Return all documents whose geo_shape field is within the query geometry. */
const RELATION_WITHIN = 'within';
public const RELATION_WITHIN = 'within';

/** Return all documents whose geo_shape field contains the query geometry. */
const RELATION_CONTAINS = 'contains';
public const RELATION_CONTAINS = 'contains';

/**
* Elasticsearch path of the geo_shape field.
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Query/Boosting.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class Boosting extends AbstractQuery
{
const NEGATIVE_BOOST = 0.2;
public const NEGATIVE_BOOST = 0.2;

/**
* Set the positive query for this Boosting Query.
Expand Down
4 changes: 2 additions & 2 deletions lib/Elastica/Query/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/
class Common extends AbstractQuery
{
const OPERATOR_AND = 'and';
const OPERATOR_OR = 'or';
public const OPERATOR_AND = 'and';
public const OPERATOR_OR = 'or';

/**
* @var string
Expand Down
Loading

0 comments on commit e09439b

Please sign in to comment.