Skip to content

Commit 801398b

Browse files
authored
Merge pull request #290 from FriendsOfSymfony/cs-fixes
Normalize coding style to the whole project
2 parents cdfee5e + 96cefae commit 801398b

File tree

95 files changed

+904
-594
lines changed

Some content is hidden

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

95 files changed

+904
-594
lines changed

Diff for: .php_cs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
$finder = Symfony\CS\Finder::create()
4+
->exclude('Resources')
5+
->in(__DIR__)
6+
;
7+
8+
return Symfony\CS\Config::create()
9+
->finder($finder)
10+
;

Diff for: .travis.yml

+33-18
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,45 @@
11
language: php
22

3-
php:
4-
- 5.3
5-
- 5.4
6-
- 5.5
7-
- 5.6
8-
- hhvm
3+
sudo: false
94

10-
env:
11-
- SYMFONY_VERSION=2.1.*
12-
- SYMFONY_VERSION=2.2.*
13-
- SYMFONY_VERSION=2.3.*
14-
- SYMFONY_VERSION=dev-master
5+
branches:
6+
only:
7+
- master
8+
9+
matrix:
10+
include:
11+
- php: 5.3
12+
env:
13+
- deps=low
14+
- SYMFONY_VERSION=2.7.*
15+
- php: 5.4
16+
env:
17+
- deps=high
18+
- SYMFONY_VERSION=2.7.*
19+
- php: 5.5
20+
env:
21+
- deps=low
22+
- SYMFONY_VERSION=2.8.*
23+
- php: 5.6
24+
env:
25+
- deps=high
26+
- SYMFONY_VERSION=3.0.*
27+
- php: 7.0
28+
env:
29+
- deps=low
30+
- SYMFONY_VERSION=3.1.*
31+
- php: 7.1
32+
env:
33+
- deps=high
34+
- SYMFONY_VERSION=3.1.*
1535

1636
before_script:
1737
- composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update
18-
- composer update --dev
38+
- if [[ $deps = high ]]; then composer update --no-progress --ansi; fi
39+
- if [[ $deps = low ]]; then composer update --no-progress --ansi --prefer-lowest --prefer-stable; fi
1940

2041
script: phpunit --coverage-text
2142

2243
notifications:
2344
email:
2445
25-
26-
matrix:
27-
allow_failures:
28-
- env: SYMFONY_VERSION=dev-master
29-
- php: 5.6
30-
- php: hhvm

Diff for: Command/MongoDBMigrateMetadataCommand.php

+16-9
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ protected function initialize(InputInterface $input, OutputInterface $output)
110110
'fsync' => $input->getOption('fsync'),
111111
);
112112

113-
$this->printStatusCallback = function() {};
113+
$this->printStatusCallback = function () {
114+
};
114115
register_tick_function(array($this, 'printStatus'));
115116
}
116117

@@ -128,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
128129
}
129130

130131
/**
131-
* Migrate message documents
132+
* Migrate message documents.
132133
*/
133134
private function migrateMessages(OutputInterface $output)
134135
{
@@ -145,10 +146,11 @@ private function migrateMessages(OutputInterface $output)
145146

146147
if (!$numTotal = $cursor->count()) {
147148
$output->writeln('There are no message documents to migrate.');
149+
148150
return;
149151
}
150152

151-
$this->printStatusCallback = function() use ($output, &$numProcessed, $numTotal) {
153+
$this->printStatusCallback = function () use ($output, &$numProcessed, $numTotal) {
152154
$output->write(sprintf("Processed: <info>%d</info> / Complete: <info>%d%%</info>\r", $numProcessed, round(100 * ($numProcessed / $numTotal))));
153155
};
154156

@@ -169,12 +171,12 @@ private function migrateMessages(OutputInterface $output)
169171
}
170172
}
171173

172-
$output->write(str_repeat(' ', 28 + ceil(log10($numProcessed))) . "\r");
174+
$output->write(str_repeat(' ', 28 + ceil(log10($numProcessed)))."\r");
173175
$output->writeln(sprintf('Migrated <info>%d</info> message documents.', $numProcessed));
174176
}
175177

176178
/**
177-
* Migrate thread documents
179+
* Migrate thread documents.
178180
*/
179181
private function migrateThreads(OutputInterface $output)
180182
{
@@ -194,10 +196,11 @@ private function migrateThreads(OutputInterface $output)
194196

195197
if (!$numTotal = $cursor->count()) {
196198
$output->writeln('There are no thread documents to migrate.');
199+
197200
return;
198201
}
199202

200-
$this->printStatusCallback = function() use ($output, &$numProcessed, $numTotal) {
203+
$this->printStatusCallback = function () use ($output, &$numProcessed, $numTotal) {
201204
$output->write(sprintf("Processed: <info>%d</info> / Complete: <info>%d%%</info>\r", $numProcessed, round(100 * ($numProcessed / $numTotal))));
202205
};
203206

@@ -222,7 +225,7 @@ private function migrateThreads(OutputInterface $output)
222225
}
223226
}
224227

225-
$output->write(str_repeat(' ', 28 + ceil(log10($numProcessed))) . "\r");
228+
$output->write(str_repeat(' ', 28 + ceil(log10($numProcessed)))."\r");
226229
$output->writeln(sprintf('Migrated <info>%d</info> thread documents.', $numProcessed));
227230
}
228231

@@ -250,6 +253,7 @@ private function createMessageMetadata(array &$message)
250253
* Sets the unreadForParticipants array on the message.
251254
*
252255
* @see Message::doEnsureUnreadForParticipantsArray()
256+
*
253257
* @param array &$message
254258
*/
255259
private function createMessageUnreadForParticipants(array &$message)
@@ -328,6 +332,7 @@ private function createThreadLastMessageDate(array &$thread)
328332
* Sets the active participant arrays on the thread.
329333
*
330334
* @see Thread::doEnsureActiveParticipantArrays()
335+
*
331336
* @param array $thread
332337
*/
333338
private function createThreadActiveParticipantArrays(array &$thread)
@@ -386,11 +391,13 @@ private function createThreadActiveParticipantArrays(array &$thread)
386391
}
387392

388393
/**
389-
* Get the MongoCollection for the given class
394+
* Get the MongoCollection for the given class.
390395
*
391396
* @param ManagerRegistry $registry
392397
* @param string $class
398+
*
393399
* @return \MongoCollection
400+
*
394401
* @throws \RuntimeException if the class has no DocumentManager
395402
*/
396403
private function getMongoCollectionForClass(ManagerRegistry $registry, $class)
@@ -403,7 +410,7 @@ private function getMongoCollectionForClass(ManagerRegistry $registry, $class)
403410
}
404411

405412
/**
406-
* Invokes the print status callback
413+
* Invokes the print status callback.
407414
*
408415
* Since unregister_tick_function() does not support anonymous functions, it
409416
* is easier to register one method (this) and invoke a dynamic callback.

Diff for: Composer/Composer.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,27 @@
33
namespace FOS\MessageBundle\Composer;
44

55
use FOS\MessageBundle\ModelManager\MessageManagerInterface;
6-
use FOS\MessageBundle\Sender\SenderInterface;
76
use FOS\MessageBundle\Model\ThreadInterface;
87
use FOS\MessageBundle\ModelManager\ThreadManagerInterface;
98
use FOS\MessageBundle\MessageBuilder\NewThreadMessageBuilder;
109
use FOS\MessageBundle\MessageBuilder\ReplyMessageBuilder;
1110

1211
/**
13-
* Factory for message builders
12+
* Factory for message builders.
1413
*
1514
* @author Thibault Duplessis <[email protected]>
1615
*/
1716
class Composer implements ComposerInterface
1817
{
1918
/**
20-
* Message manager
19+
* Message manager.
2120
*
2221
* @var MessageManagerInterface
2322
*/
2423
protected $messageManager;
2524

2625
/**
27-
* Thread manager
26+
* Thread manager.
2827
*
2928
* @var ThreadManagerInterface
3029
*/
@@ -37,7 +36,7 @@ public function __construct(MessageManagerInterface $messageManager, ThreadManag
3736
}
3837

3938
/**
40-
* Starts composing a message, starting a new thread
39+
* Starts composing a message, starting a new thread.
4140
*
4241
* @return NewThreadMessageBuilder
4342
*/
@@ -50,7 +49,7 @@ public function newThread()
5049
}
5150

5251
/**
53-
* Starts composing a message in a reply to a thread
52+
* Starts composing a message in a reply to a thread.
5453
*
5554
* @return ReplyMessageBuilder
5655
*/

Diff for: Composer/ComposerInterface.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
use FOS\MessageBundle\Model\ThreadInterface;
77

88
/**
9-
* Factory for message builders
9+
* Factory for message builders.
1010
*
1111
* @author Thibault Duplessis <[email protected]>
1212
*/
1313
interface ComposerInterface
1414
{
1515
/**
16-
* Starts composing a message, starting a new thread
16+
* Starts composing a message, starting a new thread.
1717
*
1818
* @return AbstractMessageBuilder
1919
*/
2020
public function newThread();
2121

2222
/**
23-
* Starts composing a message in a reply to a thread
23+
* Starts composing a message in a reply to a thread.
2424
*
2525
* @return AbstractMessageBuilder
2626
*/

0 commit comments

Comments
 (0)