Skip to content

Commit

Permalink
Merge pull request #290 from FriendsOfSymfony/cs-fixes
Browse files Browse the repository at this point in the history
Normalize coding style to the whole project
  • Loading branch information
tgalopin committed Sep 7, 2016
2 parents cdfee5e + 96cefae commit 801398b
Show file tree
Hide file tree
Showing 95 changed files with 904 additions and 594 deletions.
10 changes: 10 additions & 0 deletions .php_cs
@@ -0,0 +1,10 @@
<?php

$finder = Symfony\CS\Finder::create()
->exclude('Resources')
->in(__DIR__)
;

return Symfony\CS\Config::create()
->finder($finder)
;
51 changes: 33 additions & 18 deletions .travis.yml
@@ -1,30 +1,45 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
sudo: false

env:
- SYMFONY_VERSION=2.1.*
- SYMFONY_VERSION=2.2.*
- SYMFONY_VERSION=2.3.*
- SYMFONY_VERSION=dev-master
branches:
only:
- master

matrix:
include:
- php: 5.3
env:
- deps=low
- SYMFONY_VERSION=2.7.*
- php: 5.4
env:
- deps=high
- SYMFONY_VERSION=2.7.*
- php: 5.5
env:
- deps=low
- SYMFONY_VERSION=2.8.*
- php: 5.6
env:
- deps=high
- SYMFONY_VERSION=3.0.*
- php: 7.0
env:
- deps=low
- SYMFONY_VERSION=3.1.*
- php: 7.1
env:
- deps=high
- SYMFONY_VERSION=3.1.*

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

script: phpunit --coverage-text

notifications:
email:
- friendsofsymfony-dev@googlegroups.com

matrix:
allow_failures:
- env: SYMFONY_VERSION=dev-master
- php: 5.6
- php: hhvm
25 changes: 16 additions & 9 deletions Command/MongoDBMigrateMetadataCommand.php
Expand Up @@ -110,7 +110,8 @@ protected function initialize(InputInterface $input, OutputInterface $output)
'fsync' => $input->getOption('fsync'),
);

$this->printStatusCallback = function() {};
$this->printStatusCallback = function () {
};
register_tick_function(array($this, 'printStatus'));
}

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

/**
* Migrate message documents
* Migrate message documents.
*/
private function migrateMessages(OutputInterface $output)
{
Expand All @@ -145,10 +146,11 @@ private function migrateMessages(OutputInterface $output)

if (!$numTotal = $cursor->count()) {
$output->writeln('There are no message documents to migrate.');

return;
}

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

Expand All @@ -169,12 +171,12 @@ private function migrateMessages(OutputInterface $output)
}
}

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

/**
* Migrate thread documents
* Migrate thread documents.
*/
private function migrateThreads(OutputInterface $output)
{
Expand All @@ -194,10 +196,11 @@ private function migrateThreads(OutputInterface $output)

if (!$numTotal = $cursor->count()) {
$output->writeln('There are no thread documents to migrate.');

return;
}

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

Expand All @@ -222,7 +225,7 @@ private function migrateThreads(OutputInterface $output)
}
}

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

Expand Down Expand Up @@ -250,6 +253,7 @@ private function createMessageMetadata(array &$message)
* Sets the unreadForParticipants array on the message.
*
* @see Message::doEnsureUnreadForParticipantsArray()
*
* @param array &$message
*/
private function createMessageUnreadForParticipants(array &$message)
Expand Down Expand Up @@ -328,6 +332,7 @@ private function createThreadLastMessageDate(array &$thread)
* Sets the active participant arrays on the thread.
*
* @see Thread::doEnsureActiveParticipantArrays()
*
* @param array $thread
*/
private function createThreadActiveParticipantArrays(array &$thread)
Expand Down Expand Up @@ -386,11 +391,13 @@ private function createThreadActiveParticipantArrays(array &$thread)
}

/**
* Get the MongoCollection for the given class
* Get the MongoCollection for the given class.
*
* @param ManagerRegistry $registry
* @param string $class
*
* @return \MongoCollection
*
* @throws \RuntimeException if the class has no DocumentManager
*/
private function getMongoCollectionForClass(ManagerRegistry $registry, $class)
Expand All @@ -403,7 +410,7 @@ private function getMongoCollectionForClass(ManagerRegistry $registry, $class)
}

/**
* Invokes the print status callback
* Invokes the print status callback.
*
* Since unregister_tick_function() does not support anonymous functions, it
* is easier to register one method (this) and invoke a dynamic callback.
Expand Down
11 changes: 5 additions & 6 deletions Composer/Composer.php
Expand Up @@ -3,28 +3,27 @@
namespace FOS\MessageBundle\Composer;

use FOS\MessageBundle\ModelManager\MessageManagerInterface;
use FOS\MessageBundle\Sender\SenderInterface;
use FOS\MessageBundle\Model\ThreadInterface;
use FOS\MessageBundle\ModelManager\ThreadManagerInterface;
use FOS\MessageBundle\MessageBuilder\NewThreadMessageBuilder;
use FOS\MessageBundle\MessageBuilder\ReplyMessageBuilder;

/**
* Factory for message builders
* Factory for message builders.
*
* @author Thibault Duplessis <thibault.duplessis@gmail.com>
*/
class Composer implements ComposerInterface
{
/**
* Message manager
* Message manager.
*
* @var MessageManagerInterface
*/
protected $messageManager;

/**
* Thread manager
* Thread manager.
*
* @var ThreadManagerInterface
*/
Expand All @@ -37,7 +36,7 @@ public function __construct(MessageManagerInterface $messageManager, ThreadManag
}

/**
* Starts composing a message, starting a new thread
* Starts composing a message, starting a new thread.
*
* @return NewThreadMessageBuilder
*/
Expand All @@ -50,7 +49,7 @@ public function newThread()
}

/**
* Starts composing a message in a reply to a thread
* Starts composing a message in a reply to a thread.
*
* @return ReplyMessageBuilder
*/
Expand Down
6 changes: 3 additions & 3 deletions Composer/ComposerInterface.php
Expand Up @@ -6,21 +6,21 @@
use FOS\MessageBundle\Model\ThreadInterface;

/**
* Factory for message builders
* Factory for message builders.
*
* @author Thibault Duplessis <thibault.duplessis@gmail.com>
*/
interface ComposerInterface
{
/**
* Starts composing a message, starting a new thread
* Starts composing a message, starting a new thread.
*
* @return AbstractMessageBuilder
*/
public function newThread();

/**
* Starts composing a message in a reply to a thread
* Starts composing a message in a reply to a thread.
*
* @return AbstractMessageBuilder
*/
Expand Down

0 comments on commit 801398b

Please sign in to comment.