From 7f3be5c49d11ddc226c070b2507a4302ed544237 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 11 Dec 2012 11:40:22 +0100 Subject: [PATCH] fixed CS --- .../Tests/Form/DoctrineOrmTypeGuesserTest.php | 2 +- .../Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php | 1 - .../Config/Definition/Builder/EnumNodeDefinition.php | 4 ++-- .../Component/Console/Tests/ApplicationTest.php | 1 - .../Console/Tests/Formatter/OutputFormatterTest.php | 1 - src/Symfony/Component/Filesystem/Filesystem.php | 6 +++--- .../DataTransformer/DateTimeToRfc3339Transformer.php | 1 - .../Component/Form/Extension/Core/Type/FileType.php | 2 +- src/Symfony/Component/Form/Guess/Guess.php | 2 +- .../Core/DataTransformer/DateTimeTestCase.php | 1 - .../Validator/ViolationMapper/ViolationMapperTest.php | 2 -- .../Storage/Handler/MongoDbSessionHandlerTest.php | 3 +-- .../Storage/Handler/NativeFileSessionHandlerTest.php | 1 + .../Tests/Profiler/MongoDbProfilerStorageTest.php | 3 +-- .../Component/Locale/Resources/data/build-data.php | 11 +++++++---- .../Component/Process/Tests/AbstractProcessTest.php | 3 +-- .../Routing/Tests/Generator/UrlGeneratorTest.php | 2 +- .../DefaultAuthenticationSuccessHandler.php | 1 - src/Symfony/Component/Validator/Constraints/Regex.php | 4 ++-- .../Tests/Constraints/RegexValidatorTest.php | 3 +-- 20 files changed, 23 insertions(+), 31 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php index cb69d8b6ae..02312de64b 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php @@ -86,4 +86,4 @@ class DoctrineOrmTypeGuesserTest extends \PHPUnit_Framework_TestCase return new DoctrineOrmTypeGuesser($registry); } -} \ No newline at end of file +} diff --git a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php index ffe0a37b99..c4ca0eecdf 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php @@ -11,7 +11,6 @@ namespace Symfony\Bridge\Doctrine\Tests\Logger; - class DbalLoggerTest extends \PHPUnit_Framework_TestCase { /** diff --git a/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php index 1db01def30..2216c47f27 100755 --- a/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php @@ -23,7 +23,7 @@ class EnumNodeDefinition extends ScalarNodeDefinition } $this->values = $values; - + return $this; } @@ -40,4 +40,4 @@ class EnumNodeDefinition extends ScalarNodeDefinition return new EnumNode($this->name, $this->parent, $this->values); } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 5ae642f33a..7a0a4895cb 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -239,7 +239,6 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $this->assertRegExp('/Did you mean this/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with one alternative'); } - $application->add(new \Foo1Command()); $application->add(new \Foo2Command()); diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php index 5f3b809ce9..33187a7d26 100644 --- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php +++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Component\Console\Tests\Formatter; use Symfony\Component\Console\Formatter\OutputFormatter; diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 23c58721fe..cb03996d32 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -360,7 +360,7 @@ class Filesystem if ($copyOnWindows) { if (is_link($file) || is_file($file)) { $this->copy($file, $target, isset($options['override']) ? $options['override'] : false); - } else if (is_dir($file)) { + } elseif (is_dir($file)) { $this->mkdir($target); } else { throw new IOException(sprintf('Unable to guess "%s" file type.', $file)); @@ -368,9 +368,9 @@ class Filesystem } else { if (is_link($file)) { $this->symlink($file, $target); - } else if (is_dir($file)) { + } elseif (is_dir($file)) { $this->mkdir($target); - } else if (is_file($file)) { + } elseif (is_file($file)) { $this->copy($file, $target, isset($options['override']) ? $options['override'] : false); } else { throw new IOException(sprintf('Unable to guess "%s" file type.', $file)); diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php index 4062759913..7131ff6519 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php @@ -53,7 +53,6 @@ class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer return null; } - $dateTime = new \DateTime($rfc3339); if ($this->outputTimezone !== $this->inputTimezone) { diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FileType.php b/src/Symfony/Component/Form/Extension/Core/Type/FileType.php index 675eff313f..58368c7c3d 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/FileType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/FileType.php @@ -46,7 +46,7 @@ class FileType extends AbstractType { $resolver->setDefaults(array( 'compound' => false, - 'data_class' => 'Symfony\Component\HttpFoundation\File\File' + 'data_class' => 'Symfony\Component\HttpFoundation\File\File' )); } diff --git a/src/Symfony/Component/Form/Guess/Guess.php b/src/Symfony/Component/Form/Guess/Guess.php index 84407925a7..f24407dd73 100644 --- a/src/Symfony/Component/Form/Guess/Guess.php +++ b/src/Symfony/Component/Form/Guess/Guess.php @@ -90,7 +90,7 @@ abstract class Guess */ public function __construct($confidence) { - if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence && + if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence && self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) { throw new \InvalidArgumentException('The confidence should be one of the constants defined in Guess.'); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php index 9683aa1e20..e9596b3efb 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php @@ -18,4 +18,3 @@ abstract class DateTimeTestCase extends LocalizedTestCase self::assertEquals($expected->format('c'), $actual->format('c')); } } - diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index b3d9608cc3..e192f07108 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -227,7 +227,6 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase { // The mapping must be deterministic! If a child has the property path "[street]", // "data[street]" should be mapped, but "data.street" should not! - return array( // mapping target, child name, its property path, grand child name, its property path, violation path array(self::LEVEL_0, 'address', 'address', 'street', 'street', ''), @@ -1260,7 +1259,6 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase // 1) the error actually maps to an existing child and // 2) the property path of that child (relative to the form providing // the mapping) matches the left side of the mapping - return array( // mapping target, map from, map to, child name, its property path, grand child name, its property path, violation path array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].children[street].data'), diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index fb4811dfc5..d2232f1814 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -155,7 +155,6 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase array('justOne' => true) ); - $this->storage->destroy('foo'); } @@ -183,7 +182,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase $collection->expects($this->once()) ->method('remove') - ->will($this->returnCallback(function($citeria) use($that) { + ->will($this->returnCallback(function($citeria) use ($that) { $that->assertInstanceOf('MongoTimestamp', $citeria[$that->options['time_field']]['$lt']); $that->assertGreaterThanOrEqual(time() - -1, $citeria[$that->options['time_field']]['$lt']->sec); })); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php index 9f58f2d583..de2c4939f0 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php @@ -54,6 +54,7 @@ class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase public function savePathDataProvider() { $base = sys_get_temp_dir(); + return array( array("$base/foo", "$base/foo", "$base/foo"), array("5;$base/foo", "5;$base/foo", "$base/foo"), diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php index b2d148d4c3..b63b84c0fb 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php @@ -40,7 +40,7 @@ class MongoDbProfilerStorageTestDataCollector extends DataCollector public function collect(Request $request, Response $response, \Exception $exception = null) { } - + public function getName() { return 'test_data_collector'; @@ -126,4 +126,3 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest } } } - diff --git a/src/Symfony/Component/Locale/Resources/data/build-data.php b/src/Symfony/Component/Locale/Resources/data/build-data.php index 8f27830a43..0382cb8d35 100644 --- a/src/Symfony/Component/Locale/Resources/data/build-data.php +++ b/src/Symfony/Component/Locale/Resources/data/build-data.php @@ -125,7 +125,8 @@ function get_data($index, $dataDir, $locale = 'en', $constraint = null) return $data; } -function icu_version() { +function icu_version() +{ exec('icu-config --version', $output, $result); if ($result !== 0 || !isset($output[0])) { @@ -135,13 +136,15 @@ function icu_version() { return $output[0]; } -function normalize_icu_version($version) { +function normalize_icu_version($version) +{ preg_match('/^(?P[0-9]\.[0-9]|[0-9]{2,})/', $version, $matches); return $matches['version']; } -function download_icu_data($version) { +function download_icu_data($version) +{ $icu = parse_ini_file(__DIR__.'/icu.ini'); if (!isset($icu[$version])) { @@ -624,4 +627,4 @@ create_stub_datafile($defaultLocale, $stubRegionDir, $countries); // Clean up clear_directory($currDir); -rmdir($currDir); \ No newline at end of file +rmdir($currDir); diff --git a/src/Symfony/Component/Process/Tests/AbstractProcessTest.php b/src/Symfony/Component/Process/Tests/AbstractProcessTest.php index d83c1f3419..d8df0a5516 100644 --- a/src/Symfony/Component/Process/Tests/AbstractProcessTest.php +++ b/src/Symfony/Component/Process/Tests/AbstractProcessTest.php @@ -16,7 +16,7 @@ namespace Symfony\Component\Process\Tests; */ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase { - protected abstract function getProcess($commandline, $cwd = null, array $env = null, $stdin = null, $timeout = 60, array $options = array()); + abstract protected function getProcess($commandline, $cwd = null, array $env = null, $stdin = null, $timeout = 60, array $options = array()); /** * @expectedException \InvalidArgumentException @@ -233,7 +233,6 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('Windows does not support POSIX signals'); } - $process = $this->getProcess('php -r "while (true) {}"'); $process->start(); $process->stop(); diff --git a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php index 935b14eceb..d08da04311 100644 --- a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php +++ b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php @@ -214,7 +214,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase $routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'http'))); $this->assertEquals('http://localhost/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test')); } - + public function testPathWithTwoStartingSlashes() { $routes = $this->getRoutes('test', new Route('//path-and-not-domain')); diff --git a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php index dc7cbe549b..dd7a7d5547 100644 --- a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php +++ b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php @@ -58,7 +58,6 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle return $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request)); } - /** * Get the provider key. * diff --git a/src/Symfony/Component/Validator/Constraints/Regex.php b/src/Symfony/Component/Validator/Constraints/Regex.php index f26186cb13..fb5dcc1a73 100644 --- a/src/Symfony/Component/Validator/Constraints/Regex.php +++ b/src/Symfony/Component/Validator/Constraints/Regex.php @@ -62,7 +62,7 @@ class Regex extends Constraint * Convert the htmlPattern to a suitable format for HTML5 pattern. * Example: /^[a-z]+$/ would be converted to [a-z]+ * However, if options are specified, it cannot be converted - * + * * Pattern is also ignored if match=false since the pattern should * then be reversed before application. * @@ -78,7 +78,7 @@ class Regex extends Constraint if (!$this->match) { return null; } - + if (preg_match('/^(.)(\^?)(.*?)(\$?)\1$/', $this->pattern, $matches)) { $delimiter = $matches[1]; $start = empty($matches[2]) ? '.*' : ''; diff --git a/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php index 4ab7278973..b136bbc7e3 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php @@ -162,7 +162,7 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase 'pattern' => '/[a-z]+/', )); $this->assertEquals('.*[a-z]+.*', $constraint->getHtmlPattern()); - + // Dropped because of match=false $constraint = new Regex(array( 'pattern' => '/[a-z]+/', @@ -170,5 +170,4 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase )); $this->assertNull($constraint->getHtmlPattern()); } - }