Skip to content

Commit

Permalink
Merge pull request #898 from webdevsHub/php-cs-fixer-increments
Browse files Browse the repository at this point in the history
php-cs-fixer PreIncrementFixer
  • Loading branch information
ruflin committed Jul 28, 2015
2 parents 72c9f7d + e44523b commit 704cf6c
Show file tree
Hide file tree
Showing 23 changed files with 36 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file based on the

### Improvements
- Update Elasticsearch dependency to 1.7.0 and update plugin dependencies
- Update php-cs-fixer to 1.10 [#898](https://github.com/ruflin/Elastica/pull/898)

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN composer global require "mayflower/php-codebrowser=~1.1"
RUN composer global require "sebastian/phpcpd=~2.0"
RUN composer global require "squizlabs/php_codesniffer=~2.3"
RUN composer global require "phploc/phploc=~2.1"
RUN composer global require "fabpot/php-cs-fixer=1.8.1"
RUN composer global require "fabpot/php-cs-fixer=1.10.*"


# Documentor dependencies
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
elastica:
#build: . # In case the image must be built locally
image: ruflin/elastica
image: ruflin/elastica # comment out to build locally
ports:
- "9200:9200"
volumes:
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Aggregation/ReverseNested.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function setPath($path)
}

/**
* {@inheritDoc}
* {@inheritdoc}
*/
public function toArray()
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Bulk/ResponseSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function current()
*/
public function next()
{
$this->_position++;
++$this->_position;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/Elastica/Facet/Range.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ public function toArray()
*/
$fieldTypesSet = 0;
if (isset($this->_params['field'])) {
$fieldTypesSet++;
++$fieldTypesSet;
}
if (isset($this->_params['key_field'])) {
$fieldTypesSet++;
++$fieldTypesSet;
}
if (isset($this->_params['key_script'])) {
$fieldTypesSet++;
++$fieldTypesSet;
}

if ($fieldTypesSet === 0) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/Multi/ResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function current()
*/
public function next()
{
$this->_position++;
++$this->_position;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Elastica/ResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public function current()
*/
public function next()
{
$this->_position++;
++$this->_position;

return $this->current();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected function _getIndexForTest()
$colors = array('blue', 'blue', 'red', 'red', 'green', 'yellow', 'white', 'cyan', 'magenta');
$temperatures = array(1500, 1500, 1500, 1500, 2500, 3500, 4500, 5500, 6500, 7500, 7500, 8500, 9500);
$docs = array();
for ($i = 0;$i < 250;$i++) {
for ($i = 0;$i < 250;++$i) {
$docs[] = new Document($i, array('color' => $colors[$i % count($colors)], 'temperature' => $temperatures[$i % count($temperatures)]));
}
$index->getType('test')->addDocuments($docs);
Expand Down
4 changes: 2 additions & 2 deletions test/lib/Elastica/Test/BulkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,10 @@ public function testMemoryUsage()

$startMemory = memory_get_usage();

for ($n = 1; $n < 10; $n++) {
for ($n = 1; $n < 10; ++$n) {
$docs = array();

for ($i = 1; $i <= 3000; $i++) {
for ($i = 1; $i <= 3000; ++$i) {
$docs[] = new Document(uniqid(), $data);
}

Expand Down
4 changes: 2 additions & 2 deletions test/lib/Elastica/Test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public function testCallback()
$object->assertInstanceOf('Elastica\Exception\ConnectionException', $exception);
$object->assertInstanceOf('Elastica\Client', $client);
$object->assertFalse($connection->isEnabled());
$count++;
++$count;
};

$client = $this->_getClient(array(), $callback);
Expand Down Expand Up @@ -993,7 +993,7 @@ public function testUpdateDocumentPopulateFields()
public function testAddDocumentsWithoutIds()
{
$docs = array();
for ($i = 0; $i < 10; $i++) {
for ($i = 0; $i < 10; ++$i) {
$docs[] = new Document(null, array('pos' => $i));
}

Expand Down
2 changes: 1 addition & 1 deletion test/lib/Elastica/Test/Connection/ConnectionPoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function getConnections($quantity = 1)
$params = array();
$connections = array();

for ($i = 0; $i < $quantity; $i++) {
for ($i = 0; $i < $quantity; ++$i) {
$connections[] = new Connection($params);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testInvoke()
$count = 0;

$callback = function ($connections) use (&$count) {
$count++;
++$count;
};

$strategy = new CallbackStrategy($callback);
Expand Down
4 changes: 2 additions & 2 deletions test/lib/Elastica/Test/Filter/IdsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ protected function _getIndexForTest()

// Add documents to first type
$docs = array();
for ($i = 1; $i < 100; $i++) {
for ($i = 1; $i < 100; ++$i) {
$docs[] = new Document($i, array('name' => 'ruflin'));
}
$index->getType('helloworld1')->addDocuments($docs);

// Add documents to second type
$docs = array();
for ($i = 1; $i < 100; $i++) {
for ($i = 1; $i < 100; ++$i) {
$docs[] = new Document($i, array('name' => 'ruflin'));
}
// This is a special id that will only be in the second type
Expand Down
4 changes: 2 additions & 2 deletions test/lib/Elastica/Test/Query/BoolQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function testEmptyBoolQuery()
$type = new Type($index, 'test');

$docNumber = 3;
for ($i = 0; $i < $docNumber; $i++) {
for ($i = 0; $i < $docNumber; ++$i) {
$doc = new Document($i, array('email' => '[email protected]'));
$type->addDocument($doc);
}
Expand All @@ -155,7 +155,7 @@ public function testOldObject()
$type = new Type($index, 'test');

$docNumber = 3;
for ($i = 0; $i < $docNumber; $i++) {
for ($i = 0; $i < $docNumber; ++$i) {
$doc = new Document($i, array('email' => '[email protected]'));
$type->addDocument($doc);
}
Expand Down
2 changes: 1 addition & 1 deletion test/lib/Elastica/Test/Query/CommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testQuery()
new Document(3, array('body' => 'foo bar baz bat')),
);
//add documents to create common terms
for ($i = 4; $i < 24; $i++) {
for ($i = 4; $i < 24; ++$i) {
$docs[] = new Document($i, array('body' => 'foo bar'));
}
$type->addDocuments($docs);
Expand Down
2 changes: 1 addition & 1 deletion test/lib/Elastica/Test/Query/QueryStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testSearchMultipleFields()

$fields = array();
$max = rand() % 10 + 1;
for ($i = 0; $i < $max; $i++) {
for ($i = 0; $i < $max; ++$i) {
$fields[] = md5(rand());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function _assertParametersEquals($left, $right)
{
$this->assertEquals(count($left), count($right), 'Parameters count mismatch');

for ($i = 0; $i < count($left); $i++) {
for ($i = 0; $i < count($left); ++$i) {
$this->assertEquals($left[$i]->getName(), $right[$i]->getName(), 'Parameters names mismatch');
$this->assertEquals($left[$i]->isOptional(), $right[$i]->isOptional(), 'Parameters optionality mismatch');
$this->assertEquals($this->_getHintName($left[$i]), $this->_getHintName($right[$i]), 'Parameters typehints mismatch');
Expand Down
2 changes: 1 addition & 1 deletion test/lib/Elastica/Test/ScanAndScrollTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function _prepareSearch()
$index->refresh();

$docs = array();
for ($x = 1; $x <= 12; $x++) {
for ($x = 1; $x <= 12; ++$x) {
$docs[] = new Document($x, array('id' => $x, 'key' => 'value'));
}

Expand Down
4 changes: 2 additions & 2 deletions test/lib/Elastica/Test/ScrollTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testForeach()
$this->fail('too many iterations');
}

$count++;
++$count;
}
}

Expand Down Expand Up @@ -88,7 +88,7 @@ private function _prepareSearch()
$index->refresh();

$docs = array();
for ($x = 1; $x <= 11; $x++) {
for ($x = 1; $x <= 11; ++$x) {
$docs[] = new Document($x, array('id' => $x, 'key' => 'value'));
}

Expand Down
4 changes: 2 additions & 2 deletions test/lib/Elastica/Test/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function testSearchScrollRequest()
$type = $index->getType('scrolltest');

$docs = array();
for ($x = 1; $x <= 10; $x++) {
for ($x = 1; $x <= 10; ++$x) {
$docs[] = new Document($x, array('id' => $x, 'testscroll' => 'jbafford'));
}

Expand Down Expand Up @@ -355,7 +355,7 @@ public function testArrayConfigSearch()
$index->create(array('index' => array('number_of_shards' => 1, 'number_of_replicas' => 0)), true);

$docs = array();
for ($i = 0; $i < 11; $i++) {
for ($i = 0; $i < 11; ++$i) {
$docs[] = new Document($i, array('id' => 1, 'email' => '[email protected]', 'username' => 'test'));
}

Expand Down
2 changes: 1 addition & 1 deletion test/lib/Elastica/Test/Tool/CrossIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function testCopy()
private function _addDocs(Type $type, $docs)
{
$insert = array();
for ($i = 1; $i <= $docs; $i++) {
for ($i = 1; $i <= $docs; ++$i) {
$insert[] = new Document($i, array('_id' => $i, 'key' => 'value'));
}

Expand Down
12 changes: 6 additions & 6 deletions test/lib/Elastica/Test/Transport/TransportBenchmarkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testAddDocument(array $config, $transport)
$index->create(array(), true);

$times = array();
for ($i = 0; $i < $this->_max; $i++) {
for ($i = 0; $i < $this->_max; ++$i) {
$data = $this->getData($i);
$doc = new Document($i, $data);
$result = $type->addDocument($doc);
Expand All @@ -73,7 +73,7 @@ public function testRandomRead(array $config, $transport)
$type->search('test');

$times = array();
for ($i = 0; $i < $this->_max; $i++) {
for ($i = 0; $i < $this->_max; ++$i) {
$test = rand(1, $this->_max);
$query = new Query();
$query->setQuery(new \Elastica\Query\MatchAll());
Expand All @@ -95,9 +95,9 @@ public function testBulk(array $config, $transport)
$type = $this->getType($config);

$times = array();
for ($i = 0; $i < $this->_max; $i++) {
for ($i = 0; $i < $this->_max; ++$i) {
$docs = array();
for ($j = 0; $j < 10; $j++) {
for ($j = 0; $j < 10; ++$j) {
$data = $this->getData($i.$j);
$docs[] = new Document($i, $data);
}
Expand Down Expand Up @@ -142,7 +142,7 @@ public function testGetMapping(array $config, $transport)
$index->refresh();

$times = array();
for ($i = 0; $i < $this->_max; $i++) {
for ($i = 0; $i < $this->_max; ++$i) {
$response = $type->request('_mapping', \Elastica\Request::GET);
$times[] = $response->getQueryTime();
}
Expand Down Expand Up @@ -195,7 +195,7 @@ protected function getData($test)
'test' => $test,
'name' => array(),
);
for ($i = 0; $i < $this->_maxData; $i++) {
for ($i = 0; $i < $this->_maxData; ++$i) {
$data['name'][] = uniqid();
}

Expand Down

0 comments on commit 704cf6c

Please sign in to comment.