Skip to content

Commit b478559

Browse files
Base PHP-cs-fixer migration to version 2 plus style fix
1 parent 76e868a commit b478559

File tree

419 files changed

+995
-555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

419 files changed

+995
-555
lines changed

.php_cs

+19-25
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
11
<?php
22

3-
$finder = Symfony\CS\Finder\DefaultFinder::create()
4-
->in(['lib', 'test']);
3+
$finder = PhpCsFixer\Finder::create()
4+
->exclude(['vendor', 'var'])
5+
->in([__DIR__])
6+
;
57

6-
$config = Symfony\CS\Config\Config::create()
7-
->setUsingCache(true)
8-
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
9-
->fixers([
10-
// [contrib] Multi-line whitespace before closing semicolon are prohibited.
11-
'multiline_spaces_before_semicolon',
12-
// [contrib] There should be no blank lines before a namespace declaration.
13-
'no_blank_lines_before_namespace',
14-
// [contrib] Ordering use statements.
15-
'ordered_use',
16-
// [contrib] Annotations should be ordered so that param annotations come first, then throws annotations, then return annotations.
17-
'phpdoc_order',
18-
// [contrib] Arrays should use the short syntax.
19-
'short_array_syntax',
20-
// [contrib] Ensure there is no code on the same line as the PHP open tag.
21-
'newline_after_open_tag',
22-
// [contrib] Use null coalescing operator ?? where possible
23-
'ternary_to_null_coalescing',
24-
// [contrib] There should not be useless else cases.
25-
'no_useless_else',
26-
// [contrib] Use dedicated PHPUnit assertions for better error messages.
8+
$config = PhpCsFixer\Config::create()
9+
->setFinder($finder)
10+
->setRules([
11+
'@PSR2' => true,
12+
'@Symfony' => true,
13+
'psr0' => false,
14+
'single_blank_line_before_namespace' => false,
15+
'ordered_imports' => true,
16+
'array_syntax' => ['syntax' => 'short'],
17+
'phpdoc_order' => true,
18+
'blank_line_after_namespace' => true,
19+
'ternary_to_null_coalescing' => true,
20+
'no_useless_else' => true,
2721
'@PHPUnit60Migration:risky' => true,
28-
//'php_unit_dedicate_assert' => ['target' => 'newest'],
22+
'php_unit_dedicate_assert' => ['target' => 'newest'],
2923
])
30-
->finder($finder);
24+
;
3125

3226
return $config;

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ gource:
140140

141141
## DOCKER IMAGES
142142

143-
.PHONY: elastica-image
143+
.PHONY: elastica-image
144144
elastica-image:
145145
docker build -t ruflin/elastica-dev-base -f env/elastica/Docker${TARGET} env/elastica/
146146
docker build -t ruflin/elastica .

env/elastica/composer.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
],
1414
"require": {
1515
"php": "^7.0",
16-
"phpdocumentor/phpdocumentor":"~2.8",
17-
"fabpot/php-cs-fixer":"1.11.*",
18-
"mayflower/php-codebrowser":"~1.1",
19-
"pdepend/pdepend":"~2.2",
20-
"phploc/phploc":"~2.1",
21-
"phpmd/phpmd":"~2.3",
22-
"phpunit/phpunit":"~5.6",
23-
"sebastian/phpcpd":"~2.0",
24-
"squizlabs/php_codesniffer":"~2.5"
16+
"phpdocumentor/phpdocumentor": "~2.8",
17+
"friendsofphp/php-cs-fixer": "^2.0",
18+
"mayflower/php-codebrowser": "~1.1",
19+
"pdepend/pdepend": "~2.2",
20+
"phploc/phploc": "~2.1",
21+
"phpmd/phpmd": "~2.3",
22+
"phpunit/phpunit": "~5.6",
23+
"sebastian/phpcpd": "~2.0",
24+
"squizlabs/php_codesniffer": "~2.5"
2525
}
2626
}

lib/Elastica/AbstractUpdateAction.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Elastica;
34

45
/**
@@ -108,7 +109,7 @@ public function getIndex()
108109
*
109110
* @return $this
110111
*
111-
* @link https://www.elastic.co/blog/versioning
112+
* @see https://www.elastic.co/blog/versioning
112113
*/
113114
public function setVersion($version)
114115
{
@@ -171,7 +172,7 @@ public function hasVersionType()
171172
*
172173
* @return $this
173174
*
174-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-parent-field.html
175+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-parent-field.html
175176
*/
176177
public function setParent($parent)
177178
{

lib/Elastica/Aggregation/AbstractAggregation.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
use Elastica\Exception\InvalidException;

lib/Elastica/Aggregation/AbstractSimpleAggregation.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
use Elastica\Exception\InvalidException;

lib/Elastica/Aggregation/AbstractTermsAggregation.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
@@ -61,7 +62,7 @@ public function setExclude($pattern, $flags = null)
6162
/**
6263
* Sets the amount of terms to be returned.
6364
*
64-
* @param int $size The amount of terms to be returned.
65+
* @param int $size the amount of terms to be returned
6566
*
6667
* @return $this
6768
*/
@@ -73,7 +74,7 @@ public function setSize($size)
7374
/**
7475
* Sets how many terms the coordinating node will request from each shard.
7576
*
76-
* @param int $shard_size The amount of terms to be returned.
77+
* @param int $shard_size the amount of terms to be returned
7778
*
7879
* @return $this
7980
*/

lib/Elastica/Aggregation/Avg.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
56
* Class Avg.
67
*
7-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-avg-aggregation.html
8+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-avg-aggregation.html
89
*/
910
class Avg extends AbstractSimpleAggregation
1011
{

lib/Elastica/Aggregation/AvgBucket.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
use Elastica\Exception\InvalidException;
56

67
/**
78
* Class AvgBucket.
89
*
9-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-avg-bucket-aggregation.html
10+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-avg-bucket-aggregation.html
1011
*/
1112
class AvgBucket extends AbstractAggregation
1213
{
@@ -18,7 +19,7 @@ public function __construct($name, $bucketsPath = null)
1819
{
1920
parent::__construct($name);
2021

21-
if ($bucketsPath !== null) {
22+
if (null !== $bucketsPath) {
2223
$this->setBucketsPath($bucketsPath);
2324
}
2425
}

lib/Elastica/Aggregation/BucketScript.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
use Elastica\Exception\InvalidException;
56

67
/**
78
* Class BucketScript.
89
*
9-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html
10+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html
1011
*/
1112
class BucketScript extends AbstractAggregation
1213
{
@@ -19,11 +20,11 @@ public function __construct($name, $bucketsPath = null, $script = null)
1920
{
2021
parent::__construct($name);
2122

22-
if ($bucketsPath !== null) {
23+
if (null !== $bucketsPath) {
2324
$this->setBucketsPath($bucketsPath);
2425
}
2526

26-
if ($script !== null) {
27+
if (null !== $script) {
2728
$this->setScript($script);
2829
}
2930
}

lib/Elastica/Aggregation/Cardinality.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
56
* Class Cardinality.
67
*
7-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html
8+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html
89
*/
910
class Cardinality extends AbstractSimpleAggregation
1011
{

lib/Elastica/Aggregation/Children.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
56
* Class Children.
67
*
7-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/1.7/search-aggregations-bucket-children-aggregation.html
8+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/1.7/search-aggregations-bucket-children-aggregation.html
89
*/
910
class Children extends AbstractAggregation
1011
{

lib/Elastica/Aggregation/DateHistogram.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
56
* Class DateHistogram.
67
*
7-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html
8+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html
89
*/
910
class DateHistogram extends Histogram
1011
{
@@ -47,7 +48,7 @@ public function setOffset($offset)
4748
/**
4849
* Set the format for returned bucket key_as_string values.
4950
*
50-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-bucket-daterange-aggregation.html#date-format-pattern
51+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-bucket-daterange-aggregation.html#date-format-pattern
5152
*
5253
* @param string $format see link for formatting options
5354
*
@@ -61,7 +62,7 @@ public function setFormat($format)
6162
/**
6263
* Set extended bounds option.
6364
*
64-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html#search-aggregations-bucket-histogram-aggregation-extended-bounds
65+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html#search-aggregations-bucket-histogram-aggregation-extended-bounds
6566
*
6667
* @param string $min see link for formatting options
6768
* @param string $max see link for formatting options

lib/Elastica/Aggregation/DateRange.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
56
* Class DateRange.
67
*
7-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-daterange-aggregation.html
8+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-daterange-aggregation.html
89
*/
910
class DateRange extends Range
1011
{

lib/Elastica/Aggregation/ExtendedStats.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
56
* Class ExtendedStats.
67
*
7-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-extendedstats-aggregation.html
8+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-extendedstats-aggregation.html
89
*/
910
class ExtendedStats extends AbstractSimpleAggregation
1011
{

lib/Elastica/Aggregation/Filter.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
use Elastica\Exception\InvalidException;
@@ -7,7 +8,7 @@
78
/**
89
* Class Filter.
910
*
10-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html
11+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html
1112
*/
1213
class Filter extends AbstractAggregation
1314
{
@@ -19,7 +20,7 @@ public function __construct($name, AbstractQuery $filter = null)
1920
{
2021
parent::__construct($name);
2122

22-
if ($filter !== null) {
23+
if (null !== $filter) {
2324
$this->setFilter($filter);
2425
}
2526
}

lib/Elastica/Aggregation/Filters.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
use Elastica\Exception\InvalidException;
@@ -7,7 +8,7 @@
78
/**
89
* Class Filters.
910
*
10-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filters-aggregation.html
11+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filters-aggregation.html
1112
*/
1213
class Filters extends AbstractAggregation
1314
{

lib/Elastica/Aggregation/GeoBounds.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
56
* A metric aggregation that computes the bounding box containing all geo_point values for a field.
67
*
7-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-geobounds-aggregation.html
8+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-geobounds-aggregation.html
89
*/
910
class GeoBounds extends AbstractAggregation
1011
{

lib/Elastica/Aggregation/GeoCentroid.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
56
* Class GeoCentroid.
67
*
7-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-geocentroid-aggregation.html
8+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-geocentroid-aggregation.html
89
*/
910
class GeoCentroid extends AbstractAggregation
1011
{

lib/Elastica/Aggregation/GeoDistance.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
use Elastica\Exception\InvalidException;
56

67
/**
78
* Class GeoDistance.
89
*
9-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geodistance-aggregation.html
10+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geodistance-aggregation.html
1011
*/
1112
class GeoDistance extends AbstractAggregation
1213
{

lib/Elastica/Aggregation/GeohashGrid.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
56
* Class GeohashGrid.
67
*
7-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohashgrid-aggregation.html
8+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohashgrid-aggregation.html
89
*/
910
class GeohashGrid extends AbstractAggregation
1011
{

lib/Elastica/Aggregation/GlobalAggregation.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
namespace Elastica\Aggregation;
34

45
/**
56
* Class GlobalAggregation.
67
*
7-
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-global-aggregation.html
8+
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-global-aggregation.html
89
*/
910
class GlobalAggregation extends AbstractAggregation
1011
{

0 commit comments

Comments
 (0)