From 9ed3d0468ef9a99383be82fe5059931cb3c36961 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 8 May 2010 15:32:30 +0200 Subject: [PATCH] folded all curly brackets of control structures to conform to PEAR/ZF CS, part two --- .../Components/BrowserKit/CookieJar.php | 6 ++--- .../Components/BrowserKit/Response.php | 3 +-- .../Components/Console/Application.php | 27 +++++++------------ .../Components/Console/Command/Command.php | 3 +-- .../Console/Helper/DialogHelper.php | 3 +-- .../Components/Console/Input/ArgvInput.php | 18 +++++-------- .../Components/Console/Input/ArrayInput.php | 12 +++------ .../Console/Input/InputArgument.php | 3 +-- .../Console/Input/InputDefinition.php | 12 +++------ .../Components/Console/Input/InputOption.php | 6 ++--- .../Components/Console/Input/StringInput.php | 3 +-- .../Components/Console/Output/Output.php | 6 ++--- .../CssSelector/Node/FunctionNode.php | 3 +-- src/Symfony/Components/CssSelector/Parser.php | 9 +++---- .../Components/CssSelector/TokenStream.php | 3 +-- .../Components/CssSelector/Tokenizer.php | 9 +++---- .../Components/CssSelector/XPathExpr.php | 3 +-- .../DependencyInjection/Builder.php | 24 ++++++----------- .../DependencyInjection/Container.php | 3 +-- .../Dumper/GraphvizDumper.php | 15 ++++------- .../DependencyInjection/Dumper/PhpDumper.php | 15 ++++------- .../DependencyInjection/Dumper/XmlDumper.php | 15 ++++------- .../DependencyInjection/Dumper/YamlDumper.php | 12 +++------ .../DependencyInjection/Loader/FileLoader.php | 3 +-- .../Loader/IniFileLoader.php | 3 +-- .../Loader/XmlFileLoader.php | 27 +++++++------------ .../Loader/YamlFileLoader.php | 18 +++++-------- src/Symfony/Components/DomCrawler/Crawler.php | 21 +++++---------- .../DomCrawler/Field/ChoiceFormField.php | 6 ++--- src/Symfony/Components/DomCrawler/Form.php | 15 ++++------- .../EventDispatcher/EventDispatcher.php | 6 ++--- src/Symfony/Components/Finder/Finder.php | 3 +-- src/Symfony/Components/Finder/Glob.php | 6 ++--- .../Finder/Iterator/CustomFilterIterator.php | 3 +-- .../Iterator/FilenameFilterIterator.php | 6 ++--- .../Iterator/SizeRangeFilterIterator.php | 3 +-- .../Components/HttpKernel/CacheControl.php | 6 ++--- .../Components/HttpKernel/HttpKernel.php | 6 ++--- src/Symfony/Components/HttpKernel/Request.php | 15 ++++------- .../Components/HttpKernel/Response.php | 3 +-- .../HttpKernel/Test/ResponseTester.php | 18 +++++-------- .../Components/OutputEscaper/Escaper.php | 9 +++---- src/Symfony/Components/Process/PhpProcess.php | 6 ++--- .../Routing/Generator/UrlGenerator.php | 3 +-- .../Components/Routing/Loader/FileLoader.php | 3 +-- .../Routing/Loader/XmlFileLoader.php | 6 ++--- .../Routing/Loader/YamlFileLoader.php | 3 +-- .../Routing/Matcher/ApacheUrlMatcher.php | 3 +-- .../Components/Routing/Matcher/UrlMatcher.php | 3 +-- src/Symfony/Components/Routing/Route.php | 3 +-- .../Components/Routing/RouteCompiler.php | 9 +++---- src/Symfony/Components/Routing/Router.php | 3 +-- .../Templating/Helper/SlotsHelper.php | 3 +-- .../Templating/Loader/CacheLoader.php | 3 +-- .../Templating/Loader/ChainLoader.php | 3 +-- .../Templating/Loader/FilesystemLoader.php | 6 ++--- src/Symfony/Components/Yaml/Inline.php | 9 +++---- src/Symfony/Components/Yaml/Parser.php | 27 +++++++------------ src/Symfony/Foundation/Bundle/Bundle.php | 3 +-- .../Foundation/Bundle/KernelExtension.php | 3 +-- .../Foundation/ClassCollectionLoader.php | 6 ++--- .../Foundation/Debug/EventDispatcher.php | 12 +++------ src/Symfony/Foundation/EventDispatcher.php | 6 ++--- src/Symfony/Foundation/Kernel.php | 12 +++------ src/Symfony/Foundation/Test/Client.php | 3 +-- .../Foundation/UniversalClassLoader.php | 6 ++--- src/Symfony/Foundation/bootstrap.php | 18 +++++-------- .../Framework/DoctrineBundle/Bundle.php | 3 +-- .../ConvertDoctrine1SchemaDoctrineCommand.php | 3 +-- .../Command/CreateDatabaseDoctrineCommand.php | 8 +++--- .../Command/DoctrineCommand.php | 3 +-- .../Command/DropDatabaseDoctrineCommand.php | 8 +++--- .../GenerateRepositoriesDoctrineCommand.php | 3 +-- .../Command/ImportMappingDoctrineCommand.php | 3 +-- .../LoadDataFixturesDoctrineCommand.php | 11 +++----- .../DependencyInjection/DoctrineExtension.php | 12 +++------ .../ProfilerBundle/ProfilerStorage.php | 6 ++--- .../SwiftmailerExtension.php | 6 ++--- .../WebBundle/Command/RouterDebugCommand.php | 3 +-- .../Controller/ExceptionController.php | 5 ++-- .../WebBundle/Debug/ExceptionFormatter.php | 3 +-- .../DependencyInjection/WebExtension.php | 3 +-- .../WebBundle/Listener/ControllerLoader.php | 12 +++------ .../WebBundle/Listener/RequestParser.php | 3 +-- .../Framework/WebBundle/Templating/Engine.php | 3 +-- .../Framework/WebBundle/Util/Filesystem.php | 9 +++---- .../Loader/YamlFileLoaderTest.php | 3 +-- .../Finder/Iterator/RealIteratorTestCase.php | 6 ++--- .../OutputEscaper/ArrayDecoratorTest.php | 3 +-- .../Tests/Components/Yaml/DumperTest.php | 3 +-- .../Tests/Components/Yaml/InlineTest.php | 6 ++--- .../Tests/Components/Yaml/ParserTest.php | 6 ++--- .../Templating/ProjectTemplateDebugger.php | 3 +-- 93 files changed, 231 insertions(+), 458 deletions(-) diff --git a/src/Symfony/Components/BrowserKit/CookieJar.php b/src/Symfony/Components/BrowserKit/CookieJar.php index fc88fdb811..51939f77bc 100644 --- a/src/Symfony/Components/BrowserKit/CookieJar.php +++ b/src/Symfony/Components/BrowserKit/CookieJar.php @@ -110,8 +110,7 @@ class CookieJar $cookies = array(); foreach ($this->cookieJar as $cookie) { - if ($cookie->getDomain() && $cookie->getDomain() != substr($parts['host'], -strlen($cookie->getDomain()))) - { + if ($cookie->getDomain() && $cookie->getDomain() != substr($parts['host'], -strlen($cookie->getDomain()))) { continue; } @@ -136,8 +135,7 @@ class CookieJar { $cookies = $this->cookieJar; foreach ($cookies as $name => $cookie) { - if ($cookie->isExpired()) - { + if ($cookie->isExpired()) { unset($this->cookieJar[$name]); } } diff --git a/src/Symfony/Components/BrowserKit/Response.php b/src/Symfony/Components/BrowserKit/Response.php index 4c892a56ea..8f73ccd921 100644 --- a/src/Symfony/Components/BrowserKit/Response.php +++ b/src/Symfony/Components/BrowserKit/Response.php @@ -94,8 +94,7 @@ class Response public function getHeader($header) { foreach ($this->headers as $key => $value) { - if (str_replace('-', '_', strtolower($key)) == str_replace('-', '_', strtolower($header))) - { + if (str_replace('-', '_', strtolower($key)) == str_replace('-', '_', strtolower($header))) { return $value; } } diff --git a/src/Symfony/Components/Console/Application.php b/src/Symfony/Components/Console/Application.php index 5dca831b92..8f40044ae8 100644 --- a/src/Symfony/Components/Console/Application.php +++ b/src/Symfony/Components/Console/Application.php @@ -115,8 +115,7 @@ class Application try { $statusCode = $this->doRun($input, $output); } catch (\Exception $e) { - if (!$this->catchExceptions) - { + if (!$this->catchExceptions) { throw $e; } @@ -152,8 +151,7 @@ class Application } if (true === $input->hasParameterOption(array('--help', '-H'))) { - if (!$name) - { + if (!$name) { $name = 'help'; $input = new ArrayInput(array('command' => 'help')); } else { @@ -420,8 +418,7 @@ class Application { $namespaces = array(); foreach ($this->commands as $command) { - if ($command->getNamespace()) - { + if ($command->getNamespace()) { $namespaces[$command->getNamespace()] = true; } } @@ -477,8 +474,7 @@ class Application // name $commands = array(); foreach ($this->commands as $command) { - if ($command->getNamespace() == $namespace) - { + if ($command->getNamespace() == $namespace) { $commands[] = $command->getName(); } } @@ -524,8 +520,7 @@ class Application $commands = array(); foreach ($this->commands as $name => $command) { - if ($namespace === $command->getNamespace()) - { + if ($namespace === $command->getNamespace()) { $commands[$name] = $command; } } @@ -544,8 +539,7 @@ class Application { $abbrevs = array(); foreach ($names as $name) { - for ($len = strlen($name) - 1; $len > 0; --$len) - { + for ($len = strlen($name) - 1; $len > 0; --$len) { $abbrev = substr($name, 0, $len); if (!isset($abbrevs[$abbrev])) { $abbrevs[$abbrev] = array($name); @@ -589,8 +583,7 @@ class Application // add commands by namespace foreach ($this->sortCommands($commands) as $space => $commands) { - if (!$namespace && '_global' !== $space) - { + if (!$namespace && '_global' !== $space) { $messages[] = ''.$space.''; } @@ -630,15 +623,13 @@ class Application // add commands by namespace foreach ($this->sortCommands($commands) as $space => $commands) { - if (!$namespace) - { + if (!$namespace) { $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace')); $namespaceArrayXML->setAttribute('id', $space); } foreach ($commands as $command) { - if (!$namespace) - { + if (!$namespace) { $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command')); $commandXML->appendChild($dom->createTextNode($command->getName())); } diff --git a/src/Symfony/Components/Console/Command/Command.php b/src/Symfony/Components/Console/Command/Command.php index 9f68bd2a67..d290bd89c3 100644 --- a/src/Symfony/Components/Console/Command/Command.php +++ b/src/Symfony/Components/Console/Command/Command.php @@ -134,8 +134,7 @@ class Command try { $input->bind($this->definition); } catch (\Exception $e) { - if (!$this->ignoreValidationErrors) - { + if (!$this->ignoreValidationErrors) { throw $e; } } diff --git a/src/Symfony/Components/Console/Helper/DialogHelper.php b/src/Symfony/Components/Console/Helper/DialogHelper.php index c499c612e1..929bb85a19 100644 --- a/src/Symfony/Components/Console/Helper/DialogHelper.php +++ b/src/Symfony/Components/Console/Helper/DialogHelper.php @@ -86,8 +86,7 @@ class DialogHelper extends Helper // @codeCoverageIgnoreStart $error = null; while (false === $attempts || $attempts--) { - if (null !== $error) - { + if (null !== $error) { $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error')); } diff --git a/src/Symfony/Components/Console/Input/ArgvInput.php b/src/Symfony/Components/Console/Input/ArgvInput.php index c813ec4001..b9e678e66e 100644 --- a/src/Symfony/Components/Console/Input/ArgvInput.php +++ b/src/Symfony/Components/Console/Input/ArgvInput.php @@ -70,8 +70,7 @@ class ArgvInput extends Input { $this->parsed = $this->tokens; while (null !== $token = array_shift($this->parsed)) { - if ('--' === substr($token, 0, 2)) - { + if ('--' === substr($token, 0, 2)) { $this->parseLongOption($token); } elseif ('-' === $token[0]) { $this->parseShortOption($token); @@ -91,8 +90,7 @@ class ArgvInput extends Input $name = substr($token, 1); if (strlen($name) > 1) { - if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptParameter()) - { + if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptParameter()) { // an option with a value (with no space) $this->addShortOption($name[0], substr($name, 1)); } else { @@ -114,8 +112,7 @@ class ArgvInput extends Input { $len = strlen($name); for ($i = 0; $i < $len; $i++) { - if (!$this->definition->hasShortcut($name[$i])) - { + if (!$this->definition->hasShortcut($name[$i])) { throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i])); } @@ -207,8 +204,7 @@ class ArgvInput extends Input } if (null === $value) { - if ($option->isParameterRequired()) - { + if ($option->isParameterRequired()) { throw new \RuntimeException(sprintf('The "--%s" option requires a value.', $name)); } @@ -226,8 +222,7 @@ class ArgvInput extends Input public function getFirstArgument() { foreach ($this->tokens as $token) { - if ($token && '-' === $token[0]) - { + if ($token && '-' === $token[0]) { continue; } @@ -252,8 +247,7 @@ class ArgvInput extends Input } foreach ($this->tokens as $v) { - if (in_array($v, $values)) - { + if (in_array($v, $values)) { return true; } } diff --git a/src/Symfony/Components/Console/Input/ArrayInput.php b/src/Symfony/Components/Console/Input/ArrayInput.php index 46b2221b5d..f09b7b44b4 100644 --- a/src/Symfony/Components/Console/Input/ArrayInput.php +++ b/src/Symfony/Components/Console/Input/ArrayInput.php @@ -47,8 +47,7 @@ class ArrayInput extends Input public function getFirstArgument() { foreach ($this->parameters as $key => $value) { - if ($key && '-' === $key[0]) - { + if ($key && '-' === $key[0]) { continue; } @@ -73,8 +72,7 @@ class ArrayInput extends Input } foreach ($this->parameters as $k => $v) { - if (!is_int($k)) - { + if (!is_int($k)) { $v = $k; } @@ -92,8 +90,7 @@ class ArrayInput extends Input protected function parse() { foreach ($this->parameters as $key => $value) { - if ('--' === substr($key, 0, 2)) - { + if ('--' === substr($key, 0, 2)) { $this->addLongOption(substr($key, 2), $value); } elseif ('-' === $key[0]) { $this->addShortOption(substr($key, 1), $value); @@ -138,8 +135,7 @@ class ArrayInput extends Input $option = $this->definition->getOption($name); if (null === $value) { - if ($option->isParameterRequired()) - { + if ($option->isParameterRequired()) { throw new \InvalidArgumentException(sprintf('The "--%s" option requires a value.', $name)); } diff --git a/src/Symfony/Components/Console/Input/InputArgument.php b/src/Symfony/Components/Console/Input/InputArgument.php index e2498e01d7..ead88a48ab 100644 --- a/src/Symfony/Components/Console/Input/InputArgument.php +++ b/src/Symfony/Components/Console/Input/InputArgument.php @@ -98,8 +98,7 @@ class InputArgument } if ($this->isArray()) { - if (null === $default) - { + if (null === $default) { $default = array(); } else if (!is_array($default)) { throw new \LogicException('A default value for an array argument must be an array.'); diff --git a/src/Symfony/Components/Console/Input/InputDefinition.php b/src/Symfony/Components/Console/Input/InputDefinition.php index 0dc893bc3d..53454cf80b 100644 --- a/src/Symfony/Components/Console/Input/InputDefinition.php +++ b/src/Symfony/Components/Console/Input/InputDefinition.php @@ -49,8 +49,7 @@ class InputDefinition $arguments = array(); $options = array(); foreach ($definition as $item) { - if ($item instanceof InputOption) - { + if ($item instanceof InputOption) { $options[] = $item; } else { $arguments[] = $item; @@ -82,8 +81,7 @@ class InputDefinition public function addArguments($arguments = array()) { if (null !== $arguments) { - foreach ($arguments as $argument) - { + foreach ($arguments as $argument) { $this->addArgument($argument); } } @@ -386,8 +384,7 @@ class InputDefinition if ($this->getArguments()) { $text[] = 'Arguments:'; foreach ($this->getArguments() as $argument) { - if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) - { + if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) { $default = sprintf(' (default: %s)', is_array($argument->getDefault()) ? str_replace("\n", '', var_export($argument->getDefault(), true)): $argument->getDefault()); } else { $default = ''; @@ -403,8 +400,7 @@ class InputDefinition $text[] = 'Options:'; foreach ($this->getOptions() as $option) { - if ($option->acceptParameter() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) - { + if ($option->acceptParameter() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) { $default = sprintf(' (default: %s)', is_array($option->getDefault()) ? str_replace("\n", '', print_r($option->getDefault(), true)): $option->getDefault()); } else { $default = ''; diff --git a/src/Symfony/Components/Console/Input/InputOption.php b/src/Symfony/Components/Console/Input/InputOption.php index 4bc0738ec6..828319cb25 100644 --- a/src/Symfony/Components/Console/Input/InputOption.php +++ b/src/Symfony/Components/Console/Input/InputOption.php @@ -53,8 +53,7 @@ class InputOption } if (null !== $shortcut) { - if ('-' === $shortcut[0]) - { + if ('-' === $shortcut[0]) { $shortcut = substr($shortcut, 1); } } @@ -149,8 +148,7 @@ class InputOption } if ($this->isArray()) { - if (null === $default) - { + if (null === $default) { $default = array(); } elseif (!is_array($default)) { throw new \LogicException('A default value for an array option must be an array.'); diff --git a/src/Symfony/Components/Console/Input/StringInput.php b/src/Symfony/Components/Console/Input/StringInput.php index e4c17284ed..c80a3ef4cd 100644 --- a/src/Symfony/Components/Console/Input/StringInput.php +++ b/src/Symfony/Components/Console/Input/StringInput.php @@ -51,8 +51,7 @@ class StringInput extends ArgvInput $length = strlen($input); $cursor = 0; while ($cursor < $length) { - if (preg_match('/\s+/A', $input, $match, null, $cursor)) - { + if (preg_match('/\s+/A', $input, $match, null, $cursor)) { } elseif (preg_match('/([^="\' ]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) { $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))); } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) { diff --git a/src/Symfony/Components/Console/Output/Output.php b/src/Symfony/Components/Console/Output/Output.php index 691752ad20..8f3793dc6d 100644 --- a/src/Symfony/Components/Console/Output/Output.php +++ b/src/Symfony/Components/Console/Output/Output.php @@ -141,8 +141,7 @@ abstract class Output implements OutputInterface } foreach ($messages as $message) { - switch ($type) - { + switch ($type) { case Output::OUTPUT_NORMAL: $message = $this->format($message); break; @@ -206,8 +205,7 @@ abstract class Output implements OutputInterface } foreach (static::$options as $option => $value) { - if (isset($parameters[$option]) && $parameters[$option]) - { + if (isset($parameters[$option]) && $parameters[$option]) { $codes[] = $value; } } diff --git a/src/Symfony/Components/CssSelector/Node/FunctionNode.php b/src/Symfony/Components/CssSelector/Node/FunctionNode.php index b9f3259fef..868e06aa8a 100644 --- a/src/Symfony/Components/CssSelector/Node/FunctionNode.php +++ b/src/Symfony/Components/CssSelector/Node/FunctionNode.php @@ -79,8 +79,7 @@ class FunctionNode implements NodeInterface $xpath->addStarPrefix(); if ($a == 0) { - if ($last) - { + if ($last) { $b = sprintf('last() - %s', $b); } $xpath->addCondition(sprintf('position() = %s', $b)); diff --git a/src/Symfony/Components/CssSelector/Parser.php b/src/Symfony/Components/CssSelector/Parser.php index 42757cbe99..db2d74bbf6 100644 --- a/src/Symfony/Components/CssSelector/Parser.php +++ b/src/Symfony/Components/CssSelector/Parser.php @@ -32,8 +32,7 @@ class Parser static public function cssToXpath($cssExpr, $prefix = 'descendant-or-self::') { if (is_string($cssExpr)) { - if (preg_match('#^\w+\s*$#u', $cssExpr, $match)) - { + if (preg_match('#^\w+\s*$#u', $cssExpr, $match)) { return $prefix.trim($match[0]); } @@ -162,8 +161,7 @@ class Parser while (1) { $peek = $stream->peek(); if ($peek == '#') { - if ($has_hash) - { + if ($has_hash) { /* You can't have two hashes (FIXME: is there some more general rule I'm missing?) */ // @codeCoverageIgnoreStart @@ -219,8 +217,7 @@ class Parser continue; } else { - if ($peek == ' ') - { + if ($peek == ' ') { $stream->next(); } diff --git a/src/Symfony/Components/CssSelector/TokenStream.php b/src/Symfony/Components/CssSelector/TokenStream.php index adab2cd2c3..f9a55b28fd 100644 --- a/src/Symfony/Components/CssSelector/TokenStream.php +++ b/src/Symfony/Components/CssSelector/TokenStream.php @@ -65,8 +65,7 @@ class TokenStream public function peek() { if (!$this->peeking) { - if (!count($this->tokens)) - { + if (!count($this->tokens)) { return null; } diff --git a/src/Symfony/Components/CssSelector/Tokenizer.php b/src/Symfony/Components/CssSelector/Tokenizer.php index 9e056abbcb..14247c49d9 100644 --- a/src/Symfony/Components/CssSelector/Tokenizer.php +++ b/src/Symfony/Components/CssSelector/Tokenizer.php @@ -35,8 +35,7 @@ class Tokenizer $s = preg_replace('#/\*.*?\*/#s', '', $s); while (1) { - if (preg_match('#\s+#A', $s, $match, 0, $pos)) - { + if (preg_match('#\s+#A', $s, $match, 0, $pos)) { $preceding_whitespace_pos = $pos; $pos += strlen($match[0]); } else { @@ -44,8 +43,7 @@ class Tokenizer } if ($pos >= strlen($s)) { - if (isset($mbEncoding)) - { + if (isset($mbEncoding)) { mb_internal_encoding($mbEncoding); } @@ -70,8 +68,7 @@ class Tokenizer } if (in_array($c, array('>', '+', '~', ',', '.', '*', '=', '[', ']', '(', ')', '|', ':', '#'))) { - if (in_array($c, array('.', '#', '[')) && $preceding_whitespace_pos > 0) - { + if (in_array($c, array('.', '#', '[')) && $preceding_whitespace_pos > 0) { $tokens[] = new Token('Token', ' ', $preceding_whitespace_pos); } $tokens[] = new Token('Token', $c, $pos); diff --git a/src/Symfony/Components/CssSelector/XPathExpr.php b/src/Symfony/Components/CssSelector/XPathExpr.php index 7763ae31b0..46393929ff 100644 --- a/src/Symfony/Components/CssSelector/XPathExpr.php +++ b/src/Symfony/Components/CssSelector/XPathExpr.php @@ -165,8 +165,7 @@ class XPathExpr $string = $s; $parts = array(); while (true) { - if (false !== $pos = strpos($string, "'")) - { + if (false !== $pos = strpos($string, "'")) { $parts[] = sprintf("'%s'", substr($string, 0, $pos)); $parts[] = "\"'\""; $string = substr($string, $pos + 1); diff --git a/src/Symfony/Components/DependencyInjection/Builder.php b/src/Symfony/Components/DependencyInjection/Builder.php index 3fb0f7a42f..4b0a62d1de 100644 --- a/src/Symfony/Components/DependencyInjection/Builder.php +++ b/src/Symfony/Components/DependencyInjection/Builder.php @@ -68,8 +68,7 @@ class Builder extends Container implements AnnotatedContainerInterface try { return parent::getService($id, Container::EXCEPTION_ON_INVALID_REFERENCE); } catch (\InvalidArgumentException $e) { - if (isset($this->loading[$id])) - { + if (isset($this->loading[$id])) { throw new \LogicException(sprintf('The service "%s" has a circular reference to itself.', $id)); } @@ -80,8 +79,7 @@ class Builder extends Container implements AnnotatedContainerInterface try { $definition = $this->getDefinition($id); } catch (\InvalidArgumentException $e) { - if (Container::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) - { + if (Container::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { return null; } @@ -349,8 +347,7 @@ class Builder extends Container implements AnnotatedContainerInterface $ok = true; foreach ($services as $s) { - if (!$this->hasService($s)) - { + if (!$this->hasService($s)) { $ok = false; break; } @@ -362,8 +359,7 @@ class Builder extends Container implements AnnotatedContainerInterface } if ($callable = $definition->getConfigurator()) { - if (is_array($callable) && is_object($callable[0]) && $callable[0] instanceof Reference) - { + if (is_array($callable) && is_object($callable[0]) && $callable[0] instanceof Reference) { $callable[0] = $this->getService((string) $callable[0]); } elseif (is_array($callable)) { $callable[0] = self::resolveValue($callable[0], $this->parameters); @@ -398,8 +394,7 @@ class Builder extends Container implements AnnotatedContainerInterface $value = $args; } else if (is_string($value)) { - if (preg_match('/^%([^%]+)%$/', $value, $match)) - { + if (preg_match('/^%([^%]+)%$/', $value, $match)) { // we do this to deal with non string values (boolean, integer, ...) // the preg_replace_callback converts them to strings if (!array_key_exists($name = strtolower($match[1]), $parameters)) { @@ -434,8 +429,7 @@ class Builder extends Container implements AnnotatedContainerInterface public function resolveServices($value) { if (is_array($value)) { - foreach ($value as &$v) - { + foreach ($value as &$v) { $v = $this->resolveServices($v); } } else if (is_object($value) && $value instanceof Reference) { @@ -456,8 +450,7 @@ class Builder extends Container implements AnnotatedContainerInterface { $annotations = array(); foreach ($this->getDefinitions() as $id => $definition) { - if ($definition->getAnnotation($name)) - { + if ($definition->getAnnotation($name)) { $annotations[$id] = $definition->getAnnotation($name); } } @@ -470,8 +463,7 @@ class Builder extends Container implements AnnotatedContainerInterface $services = array(); if (is_array($value)) { - foreach ($value as $v) - { + foreach ($value as $v) { $services = array_unique(array_merge($services, self::getServiceConditionals($v))); } } elseif (is_object($value) && $value instanceof Reference && $value->getInvalidBehavior() === Container::IGNORE_ON_INVALID_REFERENCE) { diff --git a/src/Symfony/Components/DependencyInjection/Container.php b/src/Symfony/Components/DependencyInjection/Container.php index d3afeb8a07..9c4523edb4 100644 --- a/src/Symfony/Components/DependencyInjection/Container.php +++ b/src/Symfony/Components/DependencyInjection/Container.php @@ -215,8 +215,7 @@ class Container implements ContainerInterface, \ArrayAccess $ids = array(); $r = new \ReflectionClass($this); foreach ($r->getMethods() as $method) { - if (preg_match('/^get(.+)Service$/', $name = $method->getName(), $match)) - { + if (preg_match('/^get(.+)Service$/', $name = $method->getName(), $match)) { $ids[] = self::underscore($match[1]); } } diff --git a/src/Symfony/Components/DependencyInjection/Dumper/GraphvizDumper.php b/src/Symfony/Components/DependencyInjection/Dumper/GraphvizDumper.php index 7dd6b00b8e..06fd110803 100644 --- a/src/Symfony/Components/DependencyInjection/Dumper/GraphvizDumper.php +++ b/src/Symfony/Components/DependencyInjection/Dumper/GraphvizDumper.php @@ -60,8 +60,7 @@ class GraphvizDumper extends Dumper ); foreach (array('graph', 'node', 'edge', 'node.instance', 'node.definition', 'node.missing') as $key) { - if (isset($options[$key])) - { + if (isset($options[$key])) { $this->options[$key] = array_merge($this->options[$key], $options[$key]); } } @@ -99,8 +98,7 @@ class GraphvizDumper extends Dumper { $code = ''; foreach ($this->edges as $id => $edges) { - foreach ($edges as $edge) - { + foreach ($edges as $edge) { $code .= sprintf(" node_%s -> node_%s [label=\"%s\" style=\"%s\"];\n", $this->dotize($id), $this->dotize($edge['to']), $edge['name'], $edge['required'] ? 'filled' : 'dashed'); } } @@ -112,16 +110,14 @@ class GraphvizDumper extends Dumper { $edges = array(); foreach ($arguments as $argument) { - if (is_object($argument) && $argument instanceof Parameter) - { + if (is_object($argument) && $argument instanceof Parameter) { $argument = $this->container->hasParameter($argument) ? $this->container->getParameter($argument) : null; } elseif (is_string($argument) && preg_match('/^%([^%]+)%$/', $argument, $match)) { $argument = $this->container->hasParameter($match[1]) ? $this->container->getParameter($match[1]) : null; } if ($argument instanceof Reference) { - if (!$this->container->hasService((string) $argument)) - { + if (!$this->container->hasService((string) $argument)) { $this->nodes[(string) $argument] = array('name' => $name, 'required' => $required, 'class' => '', 'attributes' => $this->options['node.missing']); } @@ -211,8 +207,7 @@ class GraphvizDumper extends Dumper { $aliases = array(); foreach ($this->container->getAliases() as $alias => $origin) { - if ($id == $origin) - { + if ($id == $origin) { $aliases[] = $alias; } } diff --git a/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php index 12302a69b2..5ce8c38ab6 100644 --- a/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php @@ -128,8 +128,7 @@ EOF; } if (is_array($callable)) { - if (is_object($callable[0]) && $callable[0] instanceof Reference) - { + if (is_object($callable[0]) && $callable[0] instanceof Reference) { return sprintf(" %s->%s(\$instance);\n", $this->getServiceCall((string) $callable[0]), $callable[1]); } else { return sprintf(" call_user_func(array(%s, '%s'), \$instance);\n", $this->dumpValue($callable[0]), $callable[1]); @@ -222,8 +221,7 @@ EOF; { $annotations = array(); foreach ($this->container->getDefinitions() as $id => $definition) { - foreach ($definition->getAnnotations() as $name => $ann) - { + foreach ($definition->getAnnotations() as $name => $ann) { if (!isset($annotations[$name])) { $annotations[$name] = array(); } @@ -342,8 +340,7 @@ EOF; { $php = array(); foreach ($parameters as $key => $value) { - if (is_array($value)) - { + if (is_array($value)) { $value = $this->exportParameters($value, $indent + 4); } elseif ($value instanceof Reference) { throw new \InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain references to other services (reference to service %s found).', $value)); @@ -396,8 +393,7 @@ EOF; } elseif (is_object($value) && $value instanceof Parameter) { return sprintf("\$this->getParameter('%s')", strtolower($value)); } elseif (is_string($value)) { - if (preg_match('/^%([^%]+)%$/', $value, $match)) - { + if (preg_match('/^%([^%]+)%$/', $value, $match)) { // we do this to deal with non string values (boolean, integer, ...) // the preg_replace_callback converts them to strings return sprintf("\$this->getParameter('%s')", strtolower($match[1])); @@ -430,8 +426,7 @@ EOF; if (null !== $reference && Container::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) { return sprintf('$this->getService(\'%s\', Container::NULL_ON_INVALID_REFERENCE)', $id); } else { - if ($this->container->hasAlias($id)) - { + if ($this->container->hasAlias($id)) { $id = $this->container->getAlias($id); } diff --git a/src/Symfony/Components/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Components/DependencyInjection/Dumper/XmlDumper.php index 53532cec3e..e3c26d9f30 100644 --- a/src/Symfony/Components/DependencyInjection/Dumper/XmlDumper.php +++ b/src/Symfony/Components/DependencyInjection/Dumper/XmlDumper.php @@ -55,8 +55,7 @@ class XmlDumper extends Dumper ); foreach ($definition->getAnnotations() as $name => $annotations) { - foreach ($annotations as $attributes) - { + foreach ($annotations as $attributes) { $att = array(); foreach ($attributes as $key => $value) { $att[] = sprintf('%s="%s"', $key, $value); @@ -76,8 +75,7 @@ class XmlDumper extends Dumper } foreach ($definition->getMethodCalls() as $call) { - if (count($call[1])) - { + if (count($call[1])) { $code .= sprintf(" \n%s \n", $call[0], $this->convertParameters($call[1], 'argument', 8)); } else { $code .= sprintf(" \n", $call[0]); @@ -85,8 +83,7 @@ class XmlDumper extends Dumper } if ($callable = $definition->getConfigurator()) { - if (is_array($callable)) - { + if (is_array($callable)) { if (is_object($callable[0]) && $callable[0] instanceof Reference) { $code .= sprintf(" \n", $callable[0], $callable[1]); } else { @@ -141,8 +138,7 @@ class XmlDumper extends Dumper if (is_object($value) && $value instanceof Reference) { $xml .= sprintf("%s<%s%s type=\"service\" id=\"%s\" %s/>\n", $white, $type, $key, (string) $value, $this->getXmlInvalidBehavior($value)); } else { - if (in_array($value, array('null', 'true', 'false'), true)) - { + if (in_array($value, array('null', 'true', 'false'), true)) { $attributes = ' type="string"'; } @@ -186,8 +182,7 @@ EOF; { $args = array(); foreach ($arguments as $k => $v) { - if (is_array($v)) - { + if (is_array($v)) { $args[$k] = $this->escape($v); } elseif (is_string($v)) { $args[$k] = str_replace('%', '%%', $v); diff --git a/src/Symfony/Components/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Components/DependencyInjection/Dumper/YamlDumper.php index 9580e06795..50c247b487 100644 --- a/src/Symfony/Components/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Components/DependencyInjection/Dumper/YamlDumper.php @@ -44,8 +44,7 @@ class YamlDumper extends Dumper $annotationsCode = ''; foreach ($definition->getAnnotations() as $name => $annotations) { - foreach ($annotations as $attributes) - { + foreach ($annotations as $attributes) { $att = array(); foreach ($attributes as $key => $value) { $att[] = sprintf('%s: %s', Yaml::dump($key), Yaml::dump($value)); @@ -80,8 +79,7 @@ class YamlDumper extends Dumper } if ($callable = $definition->getConfigurator()) { - if (is_array($callable)) - { + if (is_array($callable)) { if (is_object($callable[0]) && $callable[0] instanceof Reference) { $callable = array($this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]); } else { @@ -168,8 +166,7 @@ class YamlDumper extends Dumper { $filtered = array(); foreach ($parameters as $key => $value) { - if (is_array($value)) - { + if (is_array($value)) { $value = $this->prepareParameters($value); } elseif ($value instanceof Reference) { $value = '@'.$value; @@ -185,8 +182,7 @@ class YamlDumper extends Dumper { $args = array(); foreach ($arguments as $k => $v) { - if (is_array($v)) - { + if (is_array($v)) { $args[$k] = $this->escape($v); } elseif (is_string($v)) { $args[$k] = str_replace('%', '%%', $v); diff --git a/src/Symfony/Components/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Components/DependencyInjection/Loader/FileLoader.php index c27ec64fb7..2adf61c636 100644 --- a/src/Symfony/Components/DependencyInjection/Loader/FileLoader.php +++ b/src/Symfony/Components/DependencyInjection/Loader/FileLoader.php @@ -56,8 +56,7 @@ abstract class FileLoader extends Loader } else if (null !== $currentPath && file_exists($currentPath.DIRECTORY_SEPARATOR.$file)) { return $currentPath.DIRECTORY_SEPARATOR.$file; } else { - foreach ($this->paths as $path) - { + foreach ($this->paths as $path) { if (file_exists($path.DIRECTORY_SEPARATOR.$file)) { return $path.DIRECTORY_SEPARATOR.$file; } diff --git a/src/Symfony/Components/DependencyInjection/Loader/IniFileLoader.php b/src/Symfony/Components/DependencyInjection/Loader/IniFileLoader.php index bb201168f5..0318227c9b 100644 --- a/src/Symfony/Components/DependencyInjection/Loader/IniFileLoader.php +++ b/src/Symfony/Components/DependencyInjection/Loader/IniFileLoader.php @@ -46,8 +46,7 @@ class IniFileLoader extends FileLoader } if (isset($result['parameters']) && is_array($result['parameters'])) { - foreach ($result['parameters'] as $key => $value) - { + foreach ($result['parameters'] as $key => $value) { $configuration->setParameter(strtolower($key), $value); } } diff --git a/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php index 1837b00ec9..f05e9f050c 100644 --- a/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php @@ -127,8 +127,7 @@ class XmlFileLoader extends FileLoader $definition = new Definition((string) $service['class']); foreach (array('shared', 'constructor') as $key) { - if (isset($service[$key])) - { + if (isset($service[$key])) { $method = 'set'.ucfirst($key); $definition->$method((string) $service->getAttributeAsPhp($key)); } @@ -141,12 +140,10 @@ class XmlFileLoader extends FileLoader $definition->setArguments($service->getArgumentsAsPhp('argument')); if (isset($service->configurator)) { - if (isset($service->configurator['function'])) - { + if (isset($service->configurator['function'])) { $definition->setConfigurator((string) $service->configurator['function']); } else { - if (isset($service->configurator['service'])) - { + if (isset($service->configurator['service'])) { $class = new Reference((string) $service->configurator['service']); } else { $class = (string) $service->configurator['class']; @@ -163,8 +160,7 @@ class XmlFileLoader extends FileLoader foreach ($service->annotation as $annotation) { $parameters = array(); foreach ($annotation->attributes() as $name => $value) { - if ('name' === $name) - { + if ('name' === $name) { continue; } @@ -240,8 +236,7 @@ class XmlFileLoader extends FileLoader if ($element = $dom->documentElement->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation')) { $items = preg_split('/\s+/', $element); for ($i = 0, $nb = count($items); $i < $nb; $i += 2) { - if ($extension = static::getExtension($items[$i])) - { + if ($extension = static::getExtension($items[$i])) { $path = str_replace('http://www.symfony-project.org/', str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]); if (!file_exists($path)) { @@ -284,8 +279,7 @@ EOF protected function validateExtensions($dom, $file) { foreach ($dom->documentElement->childNodes as $node) { - if (!$node instanceof \DOMElement || in_array($node->tagName, array('imports', 'parameters', 'services'))) - { + if (!$node instanceof \DOMElement || in_array($node->tagName, array('imports', 'parameters', 'services'))) { continue; } @@ -322,8 +316,7 @@ EOF protected function loadFromExtensions(BuilderConfiguration $configuration, $xml) { foreach (dom_import_simplexml($xml)->childNodes as $node) { - if (!$node instanceof \DOMElement || $node->namespaceURI === 'http://www.symfony-project.org/schema/dic/services') - { + if (!$node instanceof \DOMElement || $node->namespaceURI === 'http://www.symfony-project.org/schema/dic/services') { continue; } @@ -367,15 +360,13 @@ EOF $nodeValue = false; foreach ($element->childNodes as $node) { - if ($node instanceof \DOMText) - { + if ($node instanceof \DOMText) { if (trim($node->nodeValue)) { $nodeValue = trim($node->nodeValue); $empty = false; } } elseif (!$node instanceof \DOMComment) { - if (isset($config[$node->localName])) - { + if (isset($config[$node->localName])) { if (!is_array($config[$node->localName])) { $config[$node->localName] = array($config[$node->localName]); } diff --git a/src/Symfony/Components/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Components/DependencyInjection/Loader/YamlFileLoader.php index 2f6ffe8409..f5c7e98b04 100644 --- a/src/Symfony/Components/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Components/DependencyInjection/Loader/YamlFileLoader.php @@ -55,8 +55,7 @@ class YamlFileLoader extends FileLoader // parameters if (isset($content['parameters'])) { - foreach ($content['parameters'] as $key => $value) - { + foreach ($content['parameters'] as $key => $value) { $configuration->setParameter(strtolower($key), $this->resolveServices($value)); } } @@ -143,8 +142,7 @@ class YamlFileLoader extends FileLoader } if (isset($service['configurator'])) { - if (is_string($service['configurator'])) - { + if (is_string($service['configurator'])) { $definition->setConfigurator($service['configurator']); } else { $definition->setConfigurator(array($this->resolveServices($service['configurator'][0]), $service['configurator'][1])); @@ -152,15 +150,13 @@ class YamlFileLoader extends FileLoader } if (isset($service['calls'])) { - foreach ($service['calls'] as $call) - { + foreach ($service['calls'] as $call) { $definition->addMethodCall($call[0], $this->resolveServices($call[1])); } } if (isset($service['annotations'])) { - foreach ($service['annotations'] as $annotation) - { + foreach ($service['annotations'] as $annotation) { $name = $annotation['name']; unset($annotation['name']); @@ -190,8 +186,7 @@ class YamlFileLoader extends FileLoader } foreach (array_keys($content) as $key) { - if (in_array($key, array('imports', 'parameters', 'services'))) - { + if (in_array($key, array('imports', 'parameters', 'services'))) { continue; } @@ -227,8 +222,7 @@ class YamlFileLoader extends FileLoader protected function loadFromExtensions(BuilderConfiguration $configuration, $content) { foreach ($content as $key => $values) { - if (in_array($key, array('imports', 'parameters', 'services'))) - { + if (in_array($key, array('imports', 'parameters', 'services'))) { continue; } diff --git a/src/Symfony/Components/DomCrawler/Crawler.php b/src/Symfony/Components/DomCrawler/Crawler.php index e7858dd494..64bfd3a6fc 100644 --- a/src/Symfony/Components/DomCrawler/Crawler.php +++ b/src/Symfony/Components/DomCrawler/Crawler.php @@ -191,8 +191,7 @@ class Crawler extends \SplObjectStorage public function eq($position) { foreach ($this as $i => $node) { - if ($i == $position) - { + if ($i == $position) { return new static($node, $this->uri); } } @@ -239,8 +238,7 @@ class Crawler extends \SplObjectStorage { $nodes = array(); foreach ($this as $i => $node) { - if (false !== $closure($node, $i)) - { + if (false !== $closure($node, $i)) { $nodes[] = $node; } } @@ -331,8 +329,7 @@ class Crawler extends \SplObjectStorage $nodes = array(); while ($node = $node->parentNode) { - if (1 === $node->nodeType && '_root' !== $node->nodeName) - { + if (1 === $node->nodeType && '_root' !== $node->nodeName) { $nodes[] = $node; } } @@ -413,8 +410,7 @@ class Crawler extends \SplObjectStorage foreach ($this as $node) { $elements = array(); foreach ($attributes as $attribute) { - if ('_text' === $attribute) - { + if ('_text' === $attribute) { $elements[] = $node->nodeValue; } else { $elements[] = $node->getAttribute($attribute); @@ -563,8 +559,7 @@ class Crawler extends \SplObjectStorage protected function getNode($position) { foreach ($this as $i => $node) { - if ($i == $position) - { + if ($i == $position) { return $node; } // @codeCoverageIgnoreStart @@ -594,8 +589,7 @@ class Crawler extends \SplObjectStorage $nodes = array(); do { - if ($node !== $this->getNode(0) && $node->nodeType === 1) - { + if ($node !== $this->getNode(0) && $node->nodeType === 1) { $nodes[] = $node; } } while($node = $node->$siblingDir); @@ -616,8 +610,7 @@ class Crawler extends \SplObjectStorage $string = $s; $parts = array(); while (true) { - if (false !== $pos = strpos($string, "'")) - { + if (false !== $pos = strpos($string, "'")) { $parts[] = sprintf("'%s'", substr($string, 0, $pos)); $parts[] = "\"'\""; $string = substr($string, $pos + 1); diff --git a/src/Symfony/Components/DomCrawler/Field/ChoiceFormField.php b/src/Symfony/Components/DomCrawler/Field/ChoiceFormField.php index c292c9eff2..5333b3059d 100644 --- a/src/Symfony/Components/DomCrawler/Field/ChoiceFormField.php +++ b/src/Symfony/Components/DomCrawler/Field/ChoiceFormField.php @@ -57,15 +57,13 @@ class ChoiceFormField extends FormField // check $this->value = $this->options[0]; } else { - if (is_array($value)) - { + if (is_array($value)) { if (!$this->multiple) { throw new \InvalidArgumentException(sprintf('The value for "%s" cannot be an array.', $this->name)); } foreach ($value as $v) { - if (!in_array($v, $this->options)) - { + if (!in_array($v, $this->options)) { throw new \InvalidArgumentException(sprintf('Input "%s" cannot take "%s" as a value (possible values: %s).', $this->name, $v, implode(', ', $this->options))); } } diff --git a/src/Symfony/Components/DomCrawler/Form.php b/src/Symfony/Components/DomCrawler/Form.php index 2fb8c0439a..f665dd8887 100644 --- a/src/Symfony/Components/DomCrawler/Form.php +++ b/src/Symfony/Components/DomCrawler/Form.php @@ -42,8 +42,7 @@ class Form { $this->button = $node; if ('button' == $node->nodeName || ('input' == $node->nodeName && in_array($node->getAttribute('type'), array('submit', 'button', 'image')))) { - do - { + do { // use the ancestor form element if (null === $node = $node->parentNode) { throw new \LogicException('The selected node does not have a form ancestor.'); @@ -130,8 +129,7 @@ class Form { $values = array(); foreach ($this->fields as $name => $field) { - if (!$field instanceof Field\FileFormField && $field->hasValue()) - { + if (!$field instanceof Field\FileFormField && $field->hasValue()) { $values[$name] = $field->getValue(); } } @@ -152,8 +150,7 @@ class Form $files = array(); foreach ($this->fields as $name => $field) { - if ($field instanceof Field\FileFormField) - { + if ($field instanceof Field\FileFormField) { $files[$name] = $field->getValue(); } } @@ -305,8 +302,7 @@ class Form $xpath = new \DOMXPath($document); foreach ($xpath->query('descendant::input | descendant::textarea | descendant::select', $root) as $node) { - if ($node->hasAttribute('disabled') || !$node->hasAttribute('name')) - { + if ($node->hasAttribute('disabled') || !$node->hasAttribute('name')) { continue; } @@ -317,8 +313,7 @@ class Form } elseif ('select' == $nodeName || 'input' == $nodeName && 'checkbox' == $node->getAttribute('type')) { $this->setField(new Field\ChoiceFormField($node)); } elseif ('input' == $nodeName && 'radio' == $node->getAttribute('type')) { - if ($this->hasField($node->getAttribute('name'))) - { + if ($this->hasField($node->getAttribute('name'))) { $this->getField($node->getAttribute('name'))->addChoice($node); } else { $this->setField(new Field\ChoiceFormField($node)); diff --git a/src/Symfony/Components/EventDispatcher/EventDispatcher.php b/src/Symfony/Components/EventDispatcher/EventDispatcher.php index adbad0dfdf..67e4f75c3b 100644 --- a/src/Symfony/Components/EventDispatcher/EventDispatcher.php +++ b/src/Symfony/Components/EventDispatcher/EventDispatcher.php @@ -53,8 +53,7 @@ class EventDispatcher } foreach ($this->listeners[$name] as $i => $callable) { - if ($listener === $callable) - { + if ($listener === $callable) { unset($this->listeners[$name][$i]); } } @@ -86,8 +85,7 @@ class EventDispatcher public function notifyUntil(Event $event) { foreach ($this->getListeners($event->getName()) as $listener) { - if (call_user_func($listener, $event)) - { + if (call_user_func($listener, $event)) { $event->setProcessed(true); break; } diff --git a/src/Symfony/Components/Finder/Finder.php b/src/Symfony/Components/Finder/Finder.php index 8a7dcf89c6..e20ac335cb 100644 --- a/src/Symfony/Components/Finder/Finder.php +++ b/src/Symfony/Components/Finder/Finder.php @@ -292,8 +292,7 @@ class Finder implements \IteratorAggregate } foreach ($dirs as $dir) { - if (!is_dir($dir)) - { + if (!is_dir($dir)) { throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); } } diff --git a/src/Symfony/Components/Finder/Glob.php b/src/Symfony/Components/Finder/Glob.php index c01958eb2c..bcc7360172 100644 --- a/src/Symfony/Components/Finder/Glob.php +++ b/src/Symfony/Components/Finder/Glob.php @@ -54,8 +54,7 @@ class Glob for ($i = 0; $i < $sizeGlob; $i++) { $car = $glob[$i]; if ($firstByte) { - if ($strictLeadingDot && $car !== '.') - { + if ($strictLeadingDot && $car !== '.') { $regex .= '(?=[^\.])'; } @@ -85,8 +84,7 @@ class Glob } elseif ($car === ',' && $inCurlies) { $regex .= $escaping ? ',' : '|'; } elseif ($car === '\\') { - if ($escaping) - { + if ($escaping) { $regex .= '\\\\'; $escaping = false; } else { diff --git a/src/Symfony/Components/Finder/Iterator/CustomFilterIterator.php b/src/Symfony/Components/Finder/Iterator/CustomFilterIterator.php index d750ef611b..2acd11f280 100644 --- a/src/Symfony/Components/Finder/Iterator/CustomFilterIterator.php +++ b/src/Symfony/Components/Finder/Iterator/CustomFilterIterator.php @@ -48,8 +48,7 @@ class CustomFilterIterator extends \FilterIterator $fileinfo = $this->getInnerIterator()->current(); foreach ($this->filters as $filter) { - if (false === $filter($fileinfo)) - { + if (false === $filter($fileinfo)) { return false; } } diff --git a/src/Symfony/Components/Finder/Iterator/FilenameFilterIterator.php b/src/Symfony/Components/Finder/Iterator/FilenameFilterIterator.php index f6990aa9be..cb5559ddac 100644 --- a/src/Symfony/Components/Finder/Iterator/FilenameFilterIterator.php +++ b/src/Symfony/Components/Finder/Iterator/FilenameFilterIterator.php @@ -60,8 +60,7 @@ class FilenameFilterIterator extends \FilterIterator if ($this->matchRegexps) { $match = false; foreach ($this->matchRegexps as $regex) { - if (preg_match($regex, $fileinfo->getFilename())) - { + if (preg_match($regex, $fileinfo->getFilename())) { $match = true; break; } @@ -74,8 +73,7 @@ class FilenameFilterIterator extends \FilterIterator if ($this->noMatchRegexps) { $exclude = false; foreach ($this->noMatchRegexps as $regex) { - if (preg_match($regex, $fileinfo->getFilename())) - { + if (preg_match($regex, $fileinfo->getFilename())) { $exclude = true; break; } diff --git a/src/Symfony/Components/Finder/Iterator/SizeRangeFilterIterator.php b/src/Symfony/Components/Finder/Iterator/SizeRangeFilterIterator.php index ea389355a3..9d4653a9a1 100644 --- a/src/Symfony/Components/Finder/Iterator/SizeRangeFilterIterator.php +++ b/src/Symfony/Components/Finder/Iterator/SizeRangeFilterIterator.php @@ -50,8 +50,7 @@ class SizeRangeFilterIterator extends \FilterIterator $filesize = $fileinfo->getSize(); foreach ($this->patterns as $compare) { - if (!$compare->test($filesize)) - { + if (!$compare->test($filesize)) { return false; } } diff --git a/src/Symfony/Components/HttpKernel/CacheControl.php b/src/Symfony/Components/HttpKernel/CacheControl.php index e9671dda72..f567e6263b 100644 --- a/src/Symfony/Components/HttpKernel/CacheControl.php +++ b/src/Symfony/Components/HttpKernel/CacheControl.php @@ -50,12 +50,10 @@ class CacheControl $parts = array(); ksort($this->attributes); foreach ($this->attributes as $key => $value) { - if (true === $value) - { + if (true === $value) { $parts[] = $key; } else { - if (preg_match('#[^a-zA-Z0-9._-]#', $value)) - { + if (preg_match('#[^a-zA-Z0-9._-]#', $value)) { $value = '"'.$value.'"'; } diff --git a/src/Symfony/Components/HttpKernel/HttpKernel.php b/src/Symfony/Components/HttpKernel/HttpKernel.php index 36e34bc53d..f33a83afd5 100644 --- a/src/Symfony/Components/HttpKernel/HttpKernel.php +++ b/src/Symfony/Components/HttpKernel/HttpKernel.php @@ -76,8 +76,7 @@ class HttpKernel implements HttpKernelInterface try { return $this->handleRaw($request, $main); } catch (\Exception $e) { - if (true === $raw) - { + if (true === $raw) { throw $e; } @@ -130,8 +129,7 @@ class HttpKernel implements HttpKernelInterface // controller $event = $this->dispatcher->notifyUntil(new Event($this, 'core.controller', array('main_request' => $main, 'request' => $request, 'controller' => &$controller, 'arguments' => &$arguments))); if ($event->isProcessed()) { - try - { + try { return $this->filterResponse($event->getReturnValue(), $request, 'A "core.controller" listener returned a non response object.', $main); } catch (\Exception $e) { $retval = $event->getReturnValue(); diff --git a/src/Symfony/Components/HttpKernel/Request.php b/src/Symfony/Components/HttpKernel/Request.php index e1ec9e0918..17d38f19d0 100644 --- a/src/Symfony/Components/HttpKernel/Request.php +++ b/src/Symfony/Components/HttpKernel/Request.php @@ -309,8 +309,7 @@ class Request public function getMethod() { if (null === $this->method) { - switch ($this->server->get('REQUEST_METHOD', 'GET')) - { + switch ($this->server->get('REQUEST_METHOD', 'GET')) { case 'POST': $this->method = strtoupper($this->request->get('_method', 'POST')); break; @@ -365,8 +364,7 @@ class Request } foreach (static::$formats as $format => $mimeTypes) { - if (in_array($mimeType, (array) $mimeTypes)) - { + if (in_array($mimeType, (array) $mimeTypes)) { return $format; } } @@ -456,8 +454,7 @@ class Request $languages = $this->splitHttpAcceptHeader($this->headers->get('Accept-Language')); foreach ($languages as $lang) { - if (strstr($lang, '-')) - { + if (strstr($lang, '-')) { $codes = explode('-', $lang); if ($codes[0] == 'i') { // Language not listed in ISO 639 that are not variants @@ -467,8 +464,7 @@ class Request $lang = $codes[1]; } } else { - for ($i = 0, $max = count($codes); $i < $max; $i++) - { + for ($i = 0, $max = count($codes); $i < $max; $i++) { if ($i == 0) { $lang = strtolower($codes[0]); } else { @@ -725,8 +721,7 @@ class Request { $headers = array(); foreach ($this->server->all() as $key => $value) { - if ('http_' === strtolower(substr($key, 0, 5))) - { + if ('http_' === strtolower(substr($key, 0, 5))) { $headers[substr($key, 5)] = $value; } } diff --git a/src/Symfony/Components/HttpKernel/Response.php b/src/Symfony/Components/HttpKernel/Response.php index 739fc28738..a8a174b649 100644 --- a/src/Symfony/Components/HttpKernel/Response.php +++ b/src/Symfony/Components/HttpKernel/Response.php @@ -203,8 +203,7 @@ class Response public function setCookie($name, $value, $expire = null, $path = '/', $domain = '', $secure = false, $httpOnly = false) { if (null !== $expire) { - if (is_numeric($expire)) - { + if (is_numeric($expire)) { $expire = (int) $expire; } else { $expire = strtotime($expire); diff --git a/src/Symfony/Components/HttpKernel/Test/ResponseTester.php b/src/Symfony/Components/HttpKernel/Test/ResponseTester.php index 02e18f91bb..2cc9e48223 100644 --- a/src/Symfony/Components/HttpKernel/Test/ResponseTester.php +++ b/src/Symfony/Components/HttpKernel/Test/ResponseTester.php @@ -118,8 +118,7 @@ class ResponseTester extends Tester { $headers = explode(', ', $this->response->headers->get($key)); foreach ($headers as $header) { - if ($header == $value) - { + if ($header == $value) { return $this->test->pass(sprintf('Response header "%s" is "%s" (%s)', $key, $value, $this->response->headers->get($key))); } } @@ -137,8 +136,7 @@ class ResponseTester extends Tester { $headers = explode(', ', $this->response->headers->get($key)); foreach ($headers as $header) { - if ($header == $value) - { + if ($header == $value) { return $this->test->fail(sprintf('Response header "%s" is not "%s" (%s)', $key, $value, $this->response->headers->get($key))); } } @@ -156,8 +154,7 @@ class ResponseTester extends Tester { $headers = explode(', ', $this->response->headers->get($key)); foreach ($headers as $header) { - if (preg_match($regex, $header)) - { + if (preg_match($regex, $header)) { return $this->test->pass(sprintf('Response header "%s" matches "%s" (%s)', $key, $value, $this->response->headers->get($key))); } } @@ -175,8 +172,7 @@ class ResponseTester extends Tester { $headers = explode(', ', $this->response->headers->get($key)); foreach ($headers as $header) { - if (!preg_match($regex, $header)) - { + if (!preg_match($regex, $header)) { return $this->test->pass(sprintf('Response header "%s" matches "%s" (%s)', $key, $value, $this->response->headers->get($key))); } } @@ -194,8 +190,7 @@ class ResponseTester extends Tester public function assertCookie($name, $value = null, $attributes = array()) { foreach ($this->response->getCookies() as $cookie) { - if ($name == $cookie['name']) - { + if ($name == $cookie['name']) { if (null === $value) { $this->test->pass(sprintf('Response sets cookie "%s"', $name)); } else { @@ -203,8 +198,7 @@ class ResponseTester extends Tester } foreach ($attributes as $attributeName => $attributeValue) { - if (!array_key_exists($attributeName, $cookie)) - { + if (!array_key_exists($attributeName, $cookie)) { throw new \LogicException(sprintf('The cookie attribute "%s" is not valid.', $attributeName)); } diff --git a/src/Symfony/Components/OutputEscaper/Escaper.php b/src/Symfony/Components/OutputEscaper/Escaper.php index e489a6b202..42a7c87949 100644 --- a/src/Symfony/Components/OutputEscaper/Escaper.php +++ b/src/Symfony/Components/OutputEscaper/Escaper.php @@ -111,8 +111,7 @@ abstract class Escaper } if (is_object($value)) { - if ($value instanceof Escaper) - { + if ($value instanceof Escaper) { // avoid double decoration $copy = clone $value; @@ -165,8 +164,7 @@ abstract class Escaper } if (is_array($value)) { - foreach ($value as $name => $v) - { + foreach ($value as $name => $v) { $value[$name] = self::unescape($v); } @@ -194,8 +192,7 @@ abstract class Escaper } foreach (self::$safeClasses as $safeClass) { - if (is_subclass_of($class, $safeClass)) - { + if (is_subclass_of($class, $safeClass)) { return true; } } diff --git a/src/Symfony/Components/Process/PhpProcess.php b/src/Symfony/Components/Process/PhpProcess.php index 5b86d8eb9a..163f96422c 100644 --- a/src/Symfony/Components/Process/PhpProcess.php +++ b/src/Symfony/Components/Process/PhpProcess.php @@ -69,8 +69,7 @@ class PhpProcess extends Process static public function getPhpBinary() { if (getenv('PHP_PATH')) { - if (!is_executable($php = getenv('PHP_PATH'))) - { + if (!is_executable($php = getenv('PHP_PATH'))) { throw new \RuntimeException('The defined PHP_PATH environment variable is not a valid PHP executable.'); } @@ -79,8 +78,7 @@ class PhpProcess extends Process $suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com')) : array(''); foreach ($suffixes as $suffix) { - if (is_executable($php = PHP_BINDIR.DIRECTORY_SEPARATOR.'php'.$suffix)) - { + if (is_executable($php = PHP_BINDIR.DIRECTORY_SEPARATOR.'php'.$suffix)) { return $php; } } diff --git a/src/Symfony/Components/Routing/Generator/UrlGenerator.php b/src/Symfony/Components/Routing/Generator/UrlGenerator.php index 4caa4571a4..11077fbfd1 100644 --- a/src/Symfony/Components/Routing/Generator/UrlGenerator.php +++ b/src/Symfony/Components/Routing/Generator/UrlGenerator.php @@ -83,8 +83,7 @@ class UrlGenerator implements UrlGeneratorInterface $url = ''; $optional = true; foreach ($tokens as $token) { - if ('variable' === $token[0]) - { + if ('variable' === $token[0]) { if (false === $optional || !isset($defaults[$token[3]]) || (isset($parameters[$token[3]]) && $parameters[$token[3]] != $defaults[$token[3]])) { // check requirement if (isset($requirements[$token[3]]) && !preg_match('#^'.$requirements[$token[3]].'$#', $tparams[$token[3]])) { diff --git a/src/Symfony/Components/Routing/Loader/FileLoader.php b/src/Symfony/Components/Routing/Loader/FileLoader.php index 427256106d..d52e30fef6 100644 --- a/src/Symfony/Components/Routing/Loader/FileLoader.php +++ b/src/Symfony/Components/Routing/Loader/FileLoader.php @@ -56,8 +56,7 @@ abstract class FileLoader implements LoaderInterface } else if (null !== $currentPath && file_exists($currentPath.DIRECTORY_SEPARATOR.$file)) { return $currentPath.DIRECTORY_SEPARATOR.$file; } else { - foreach ($this->paths as $path) - { + foreach ($this->paths as $path) { if (file_exists($path.DIRECTORY_SEPARATOR.$file)) { return $path.DIRECTORY_SEPARATOR.$file; } diff --git a/src/Symfony/Components/Routing/Loader/XmlFileLoader.php b/src/Symfony/Components/Routing/Loader/XmlFileLoader.php index f8355226e7..ac0b45ddb5 100644 --- a/src/Symfony/Components/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Components/Routing/Loader/XmlFileLoader.php @@ -44,8 +44,7 @@ class XmlFileLoader extends FileLoader // process routes and imports foreach ($xml->documentElement->childNodes as $node) { - if (!$node instanceof \DOMElement) - { + if (!$node instanceof \DOMElement) { continue; } @@ -71,8 +70,7 @@ class XmlFileLoader extends FileLoader $options = array(); foreach ($definition->childNodes as $node) { - if (!$node instanceof \DOMElement) - { + if (!$node instanceof \DOMElement) { continue; } diff --git a/src/Symfony/Components/Routing/Loader/YamlFileLoader.php b/src/Symfony/Components/Routing/Loader/YamlFileLoader.php index c248a71238..8e2c67ce59 100644 --- a/src/Symfony/Components/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Components/Routing/Loader/YamlFileLoader.php @@ -44,8 +44,7 @@ class YamlFileLoader extends FileLoader $collection->addResource(new FileResource($path)); foreach ($config as $name => $config) { - if (isset($config['resource'])) - { + if (isset($config['resource'])) { $this->parseImport($collection, $name, $config, $path); } elseif (isset($config['pattern'])) { $this->parseRoute($collection, $name, $config, $path); diff --git a/src/Symfony/Components/Routing/Matcher/ApacheUrlMatcher.php b/src/Symfony/Components/Routing/Matcher/ApacheUrlMatcher.php index 5f2522abdc..96dd2a99ab 100644 --- a/src/Symfony/Components/Routing/Matcher/ApacheUrlMatcher.php +++ b/src/Symfony/Components/Routing/Matcher/ApacheUrlMatcher.php @@ -56,8 +56,7 @@ class ApacheUrlMatcher extends UrlMatcher $parameters = array(); foreach ($_SERVER as $key => $value) { - if ('_ROUTING_' === substr($key, 0, 9)) - { + if ('_ROUTING_' === substr($key, 0, 9)) { $parameters[substr($key, 9)] = $value; unset($_SERVER[$key]); } diff --git a/src/Symfony/Components/Routing/Matcher/UrlMatcher.php b/src/Symfony/Components/Routing/Matcher/UrlMatcher.php index 3d61adbdc0..7b832ed59e 100644 --- a/src/Symfony/Components/Routing/Matcher/UrlMatcher.php +++ b/src/Symfony/Components/Routing/Matcher/UrlMatcher.php @@ -81,8 +81,7 @@ class UrlMatcher implements UrlMatcherInterface { $parameters = array_merge($this->defaults, $defaults); foreach ($params as $key => $value) { - if (!is_int($key)) - { + if (!is_int($key)) { $parameters[$key] = urldecode($value); } } diff --git a/src/Symfony/Components/Routing/Route.php b/src/Symfony/Components/Routing/Route.php index 4508271562..6268cac386 100644 --- a/src/Symfony/Components/Routing/Route.php +++ b/src/Symfony/Components/Routing/Route.php @@ -188,8 +188,7 @@ class Route { $this->requirements = array(); foreach ($requirements as $key => $regex) { - if ('^' == $regex[0]) - { + if ('^' == $regex[0]) { $regex = substr($regex, 1); } diff --git a/src/Symfony/Components/Routing/RouteCompiler.php b/src/Symfony/Components/Routing/RouteCompiler.php index 3924642887..27f25fd8d9 100644 --- a/src/Symfony/Components/Routing/RouteCompiler.php +++ b/src/Symfony/Components/Routing/RouteCompiler.php @@ -68,8 +68,7 @@ class RouteCompiler implements RouteCompilerInterface // optimize tokens for generation $tokens = array(); foreach ($this->tokens as $i => $token) { - if ($i + 1 === count($this->tokens) && 'separator' === $token[0]) - { + if ($i + 1 === count($this->tokens) && 'separator' === $token[0]) { // trailing / $tokens[] = array('text', $token[2], '', null); } elseif ('separator' !== $token[0]) { @@ -103,8 +102,7 @@ class RouteCompiler implements RouteCompilerInterface $this->staticPrefix = ''; foreach ($this->tokens as $token) { - switch ($token[0]) - { + switch ($token[0]) { case 'separator': break; case 'text': @@ -132,8 +130,7 @@ class RouteCompiler implements RouteCompilerInterface // a route is an array of (separator + variable) or (separator + text) segments while (strlen($buffer)) { - if (false !== $this->tokenizeBufferBefore($buffer, $tokens, $afterASeparator, $currentSeparator)) - { + if (false !== $this->tokenizeBufferBefore($buffer, $tokens, $afterASeparator, $currentSeparator)) { // a custom token $this->customToken = true; } else if ($afterASeparator && preg_match('#^'.$this->options['variable_prefix_regex'].'('.$this->options['variable_regex'].')#', $buffer, $match)) { diff --git a/src/Symfony/Components/Routing/Router.php b/src/Symfony/Components/Routing/Router.php index 2908f583dc..edc0889bc2 100644 --- a/src/Symfony/Components/Routing/Router.php +++ b/src/Symfony/Components/Routing/Router.php @@ -224,8 +224,7 @@ class Router implements RouterInterface $time = filemtime($file); $meta = unserialize(file_get_contents($metadata)); foreach ($meta as $resource) { - if (!$resource->isUptodate($time)) - { + if (!$resource->isUptodate($time)) { return true; } } diff --git a/src/Symfony/Components/Templating/Helper/SlotsHelper.php b/src/Symfony/Components/Templating/Helper/SlotsHelper.php index e10f6fbcac..690509ae1b 100644 --- a/src/Symfony/Components/Templating/Helper/SlotsHelper.php +++ b/src/Symfony/Components/Templating/Helper/SlotsHelper.php @@ -109,8 +109,7 @@ class SlotsHelper extends Helper public function output($name, $default = false) { if (!isset($this->slots[$name])) { - if (false !== $default) - { + if (false !== $default) { echo $default; return true; diff --git a/src/Symfony/Components/Templating/Loader/CacheLoader.php b/src/Symfony/Components/Templating/Loader/CacheLoader.php index 91989472c1..50d3ddab85 100644 --- a/src/Symfony/Components/Templating/Loader/CacheLoader.php +++ b/src/Symfony/Components/Templating/Loader/CacheLoader.php @@ -66,8 +66,7 @@ class CacheLoader extends Loader } if (file_exists($path)) { - if (null !== $this->debugger) - { + if (null !== $this->debugger) { $this->debugger->log(sprintf('Fetching template "%s" from cache', $template)); } diff --git a/src/Symfony/Components/Templating/Loader/ChainLoader.php b/src/Symfony/Components/Templating/Loader/ChainLoader.php index 7dd3948d12..7da1290326 100644 --- a/src/Symfony/Components/Templating/Loader/ChainLoader.php +++ b/src/Symfony/Components/Templating/Loader/ChainLoader.php @@ -60,8 +60,7 @@ class ChainLoader extends Loader public function load($template, array $options = array()) { foreach ($this->loaders as $loader) { - if (false !== $ret = $loader->load($template, $options)) - { + if (false !== $ret = $loader->load($template, $options)) { return $ret; } } diff --git a/src/Symfony/Components/Templating/Loader/FilesystemLoader.php b/src/Symfony/Components/Templating/Loader/FilesystemLoader.php index a1e29d274c..68674d28c9 100644 --- a/src/Symfony/Components/Templating/Loader/FilesystemLoader.php +++ b/src/Symfony/Components/Templating/Loader/FilesystemLoader.php @@ -65,8 +65,7 @@ class FilesystemLoader extends Loader $logs = array(); foreach ($this->templatePathPatterns as $templatePathPattern) { - if (is_file($file = strtr($templatePathPattern, $replacements))) - { + if (is_file($file = strtr($templatePathPattern, $replacements))) { if (null !== $this->debugger) { $this->debugger->log(sprintf('Loaded template file "%s" (renderer: %s)', $file, $options['renderer'])); } @@ -80,8 +79,7 @@ class FilesystemLoader extends Loader } if (null !== $this->debugger) { - foreach ($logs as $log) - { + foreach ($logs as $log) { $this->debugger->log($log); } } diff --git a/src/Symfony/Components/Yaml/Inline.php b/src/Symfony/Components/Yaml/Inline.php index f1a2f5f41a..79c2283db3 100644 --- a/src/Symfony/Components/Yaml/Inline.php +++ b/src/Symfony/Components/Yaml/Inline.php @@ -232,8 +232,7 @@ class Inline // [foo, bar, ...] while ($i < $len) { - switch ($sequence[$i]) - { + switch ($sequence[$i]) { case '[': // nested sequence $output[] = self::parseSequence($sequence, $i); @@ -289,8 +288,7 @@ class Inline // {foo: bar, bar:foo, ...} while ($i < $len) { - switch ($mapping[$i]) - { + switch ($mapping[$i]) { case ' ': case ',': ++$i; @@ -305,8 +303,7 @@ class Inline // value $done = false; while ($i < $len) { - switch ($mapping[$i]) - { + switch ($mapping[$i]) { case '[': // nested sequence $output[$key] = self::parseSequence($mapping, $i); diff --git a/src/Symfony/Components/Yaml/Parser.php b/src/Symfony/Components/Yaml/Parser.php index 66b20af57e..f7cf8e80b1 100644 --- a/src/Symfony/Components/Yaml/Parser.php +++ b/src/Symfony/Components/Yaml/Parser.php @@ -57,8 +57,7 @@ class Parser $data = array(); while ($this->moveToNextLine()) { - if ($this->isCurrentLineEmpty()) - { + if ($this->isCurrentLineEmpty()) { continue; } @@ -69,8 +68,7 @@ class Parser $isRef = $isInPlace = $isProcessed = false; if (preg_match('#^\-((?P\s+)(?P.+?))?\s*$#', $this->currentLine, $values)) { - if (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P.*)#', $values['value'], $matches)) - { + if (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P.*)#', $values['value'], $matches)) { $isRef = $matches['ref']; $values['value'] = $matches['value']; } @@ -105,15 +103,13 @@ class Parser $key = Inline::parseScalar($values['key']); if ('<<' === $key) { - if (isset($values['value']) && '*' === substr($values['value'], 0, 1)) - { + if (isset($values['value']) && '*' === substr($values['value'], 0, 1)) { $isInPlace = substr($values['value'], 1); if (!array_key_exists($isInPlace, $this->refs)) { throw new ParserException(sprintf('Reference "%s" does not exist at line %s (%s).', $isInPlace, $this->getRealCurrentLineNb() + 1, $this->currentLine)); } } else { - if (isset($values['value']) && $values['value'] !== '') - { + if (isset($values['value']) && $values['value'] !== '') { $value = $values['value']; } else { $value = $this->getNextEmbedBlock(); @@ -129,8 +125,7 @@ class Parser } else if (isset($parsed[0])) { // Numeric array, merge individual elements foreach (array_reverse($parsed) as $parsedItem) { - if (!is_array($parsedItem)) - { + if (!is_array($parsedItem)) { throw new ParserException(sprintf('Merge items must be arrays at line %s (%s).', $this->getRealCurrentLineNb() + 1, $parsedItem)); } $merged = array_merge($parsedItem, $merged); @@ -163,8 +158,7 @@ class Parser $data[$key] = $parser->parse($this->getNextEmbedBlock()); } } else { - if ($isInPlace) - { + if ($isInPlace) { $data = $this->refs[$isInPlace]; } else { $data[$key] = $this->parseValue($values['value']); @@ -273,8 +267,7 @@ class Parser $data = array(substr($this->currentLine, $newIndent)); while ($this->moveToNextLine()) { - if ($this->isCurrentLineEmpty()) - { + if ($this->isCurrentLineEmpty()) { if ($this->isCurrentLineBlank()) { $data[] = substr($this->currentLine, $newIndent); } @@ -335,8 +328,7 @@ class Parser protected function parseValue($value) { if ('*' === substr($value, 0, 1)) { - if (false !== $pos = strpos($value, '#')) - { + if (false !== $pos = strpos($value, '#')) { $value = substr($value, 1, $pos - 2); } else { $value = substr($value, 1); @@ -397,8 +389,7 @@ class Parser $this->moveToNextLine(); if (preg_match('#^(?P {'.strlen($textIndent).',})(?P.+)$#', $this->currentLine, $matches)) { - if (' ' == $separator && $previousIndent != $matches['indent']) - { + if (' ' == $separator && $previousIndent != $matches['indent']) { $text = substr($text, 0, -1)."\n"; } $previousIndent = $matches['indent']; diff --git a/src/Symfony/Foundation/Bundle/Bundle.php b/src/Symfony/Foundation/Bundle/Bundle.php index 6b33651589..eb715c86fa 100644 --- a/src/Symfony/Foundation/Bundle/Bundle.php +++ b/src/Symfony/Foundation/Bundle/Bundle.php @@ -46,8 +46,7 @@ abstract class Bundle implements BundleInterface // look for commands foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($commandDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if ($file->isDir() || substr($file, -4) !== '.php') - { + if ($file->isDir() || substr($file, -4) !== '.php') { continue; } diff --git a/src/Symfony/Foundation/Bundle/KernelExtension.php b/src/Symfony/Foundation/Bundle/KernelExtension.php index c9c9ed70ba..6f91310aad 100644 --- a/src/Symfony/Foundation/Bundle/KernelExtension.php +++ b/src/Symfony/Foundation/Bundle/KernelExtension.php @@ -71,8 +71,7 @@ class KernelExtension extends LoaderExtension } else { $classes = array(); foreach (explode("\n", $config['compilation']) as $class) { - if ($class) - { + if ($class) { $classes[] = trim($class); } } diff --git a/src/Symfony/Foundation/ClassCollectionLoader.php b/src/Symfony/Foundation/ClassCollectionLoader.php index 48c962541d..2a0d1c379e 100644 --- a/src/Symfony/Foundation/ClassCollectionLoader.php +++ b/src/Symfony/Foundation/ClassCollectionLoader.php @@ -40,8 +40,7 @@ class ClassCollectionLoader if ($meta[1] != $classes) { $reload = true; } else { - foreach ($meta[0] as $resource) - { + foreach ($meta[0] as $resource) { if (!file_exists($resource) || filemtime($resource) > $time) { $reload = true; @@ -61,8 +60,7 @@ class ClassCollectionLoader $files = array(); $content = ''; foreach ($classes as $class) { - if (!class_exists($class) && !interface_exists($class)) - { + if (!class_exists($class) && !interface_exists($class)) { throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class)); } diff --git a/src/Symfony/Foundation/Debug/EventDispatcher.php b/src/Symfony/Foundation/Debug/EventDispatcher.php index 256fadb2fb..76ada90d92 100644 --- a/src/Symfony/Foundation/Debug/EventDispatcher.php +++ b/src/Symfony/Foundation/Debug/EventDispatcher.php @@ -50,8 +50,7 @@ class EventDispatcher extends BaseEventDispatcher public function notify(Event $event) { foreach ($this->getListeners($event->getName()) as $listener) { - if (null !== $this->logger) - { + if (null !== $this->logger) { $this->logger->debug(sprintf('Notifying event "%s" to listener "%s"', $event->getName(), $this->listenerToString($listener))); } @@ -71,14 +70,12 @@ class EventDispatcher extends BaseEventDispatcher public function notifyUntil(Event $event) { foreach ($this->getListeners($event->getName()) as $listener) { - if (null !== $this->logger) - { + if (null !== $this->logger) { $this->logger->debug(sprintf('Notifying (until) event "%s" to listener "%s"', $event->getName(), $this->listenerToString($listener))); } if (call_user_func($listener, $event)) { - if (null !== $this->logger) - { + if (null !== $this->logger) { $this->logger->debug(sprintf('Listener "%s" processed the event "%s"', $this->listenerToString($listener), $event->getName())); } @@ -101,8 +98,7 @@ class EventDispatcher extends BaseEventDispatcher public function filter(Event $event, $value) { foreach ($this->getListeners($event->getName()) as $listener) { - if (null !== $this->logger) - { + if (null !== $this->logger) { $this->logger->debug(sprintf('Notifying (filter) event "%s" to listener "%s"', $event->getName(), $this->listenerToString($listener))); } diff --git a/src/Symfony/Foundation/EventDispatcher.php b/src/Symfony/Foundation/EventDispatcher.php index ef7607a973..f079a300fd 100644 --- a/src/Symfony/Foundation/EventDispatcher.php +++ b/src/Symfony/Foundation/EventDispatcher.php @@ -36,8 +36,7 @@ class EventDispatcher extends BaseEventDispatcher $this->container = $container; foreach ($container->findAnnotatedServiceIds('kernel.listener') as $id => $attributes) { - foreach ($attributes as $attribute) - { + foreach ($attributes as $attribute) { if (isset($attribute['event'])) { $this->connect($attribute['event'], array($id, isset($attribute['method']) ? $attribute['method'] : 'handle')); } @@ -59,8 +58,7 @@ class EventDispatcher extends BaseEventDispatcher } foreach ($this->listeners[$name] as $i => $listener) { - if (is_array($listener) && is_string($listener[0])) - { + if (is_array($listener) && is_string($listener[0])) { $this->listeners[$name][$i] = array($this->container->getService($listener[0]), $listener[1]); } } diff --git a/src/Symfony/Foundation/Kernel.php b/src/Symfony/Foundation/Kernel.php index 9cbdbd97e9..bdc0d6d17a 100644 --- a/src/Symfony/Foundation/Kernel.php +++ b/src/Symfony/Foundation/Kernel.php @@ -280,8 +280,7 @@ abstract class Kernel implements HttpKernelInterface, \Serializable { $parameters = array(); foreach ($_SERVER as $key => $value) { - if ('SYMFONY__' === substr($key, 0, 9)) - { + if ('SYMFONY__' === substr($key, 0, 9)) { $parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value; } } @@ -298,8 +297,7 @@ abstract class Kernel implements HttpKernelInterface, \Serializable $meta = unserialize(file_get_contents($location.'.meta')); $time = filemtime($location.'.php'); foreach ($meta as $resource) { - if (!$resource->isUptodate($time)) - { + if (!$resource->isUptodate($time)) { return true; } } @@ -322,8 +320,7 @@ abstract class Kernel implements HttpKernelInterface, \Serializable foreach (array('cache', 'logs') as $name) { $dir = $container->getParameter(sprintf('kernel.%s_dir', $name)); if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true)) - { + if (false === @mkdir($dir, 0777, true)) { die(sprintf('Unable to create the %s directory (%s)', $name, dirname($dir))); } } elseif (!is_writable($dir)) { @@ -356,8 +353,7 @@ abstract class Kernel implements HttpKernelInterface, \Serializable { // replace all classes with the real value foreach ($container->getDefinitions() as $definition) { - if (false !== strpos($class = $definition->getClass(), '%')) - { + if (false !== strpos($class = $definition->getClass(), '%')) { $definition->setClass(Builder::resolveValue($class, $container->getParameters())); unset($container[substr($class, 1, -1)]); } diff --git a/src/Symfony/Foundation/Test/Client.php b/src/Symfony/Foundation/Test/Client.php index b02838c3da..1a751cc1ca 100644 --- a/src/Symfony/Foundation/Test/Client.php +++ b/src/Symfony/Foundation/Test/Client.php @@ -130,8 +130,7 @@ EOF; protected function addTestersFromContainer() { foreach ($this->container->findAnnotatedServiceIds('test.tester') as $id => $config) { - if (!isset($config[0]['alias'])) - { + if (!isset($config[0]['alias'])) { continue; } diff --git a/src/Symfony/Foundation/UniversalClassLoader.php b/src/Symfony/Foundation/UniversalClassLoader.php index cf5da93bd7..ec02421803 100644 --- a/src/Symfony/Foundation/UniversalClassLoader.php +++ b/src/Symfony/Foundation/UniversalClassLoader.php @@ -129,8 +129,7 @@ class UniversalClassLoader // namespaced class name $namespace = substr($class, 0, $pos); foreach ($this->namespaces as $ns => $dir) { - if (0 === strpos($namespace, $ns)) - { + if (0 === strpos($namespace, $ns)) { $class = substr($class, $pos + 1); $file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; if (file_exists($file)) { @@ -143,8 +142,7 @@ class UniversalClassLoader } else { // PEAR-like class name foreach ($this->prefixes as $prefix => $dir) { - if (0 === strpos($class, $prefix)) - { + if (0 === strpos($class, $prefix)) { $file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; if (file_exists($file)) { require $file; diff --git a/src/Symfony/Foundation/bootstrap.php b/src/Symfony/Foundation/bootstrap.php index ca30309c40..a70cf3a85f 100644 --- a/src/Symfony/Foundation/bootstrap.php +++ b/src/Symfony/Foundation/bootstrap.php @@ -32,8 +32,7 @@ abstract class Bundle implements BundleInterface } foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($commandDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if ($file->isDir() || substr($file, -4) !== '.php') - { + if ($file->isDir() || substr($file, -4) !== '.php') { continue; } @@ -167,8 +166,7 @@ class KernelExtension extends LoaderExtension } else { $classes = array(); foreach (explode("\n", $config['compilation']) as $class) { - if ($class) - { + if ($class) { $classes[] = trim($class); } } @@ -270,8 +268,7 @@ class ClassCollectionLoader if ($meta[1] != $classes) { $reload = true; } else { - foreach ($meta[0] as $resource) - { + foreach ($meta[0] as $resource) { if (!file_exists($resource) || filemtime($resource) > $time) { $reload = true; @@ -291,8 +288,7 @@ class ClassCollectionLoader $files = array(); $content = ''; foreach ($classes as $class) { - if (!class_exists($class) && !interface_exists($class)) - { + if (!class_exists($class) && !interface_exists($class)) { throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class)); } @@ -350,8 +346,7 @@ class EventDispatcher extends BaseEventDispatcher $this->container = $container; foreach ($container->findAnnotatedServiceIds('kernel.listener') as $id => $attributes) { - foreach ($attributes as $attribute) - { + foreach ($attributes as $attribute) { if (isset($attribute['event'])) { $this->connect($attribute['event'], array($id, isset($attribute['method']) ? $attribute['method'] : 'handle')); } @@ -367,8 +362,7 @@ class EventDispatcher extends BaseEventDispatcher } foreach ($this->listeners[$name] as $i => $listener) { - if (is_array($listener) && is_string($listener[0])) - { + if (is_array($listener) && is_string($listener[0])) { $this->listeners[$name][$i] = array($this->container->getService($listener[0]), $listener[1]); } } diff --git a/src/Symfony/Framework/DoctrineBundle/Bundle.php b/src/Symfony/Framework/DoctrineBundle/Bundle.php index 6b5690983a..a01edd3383 100644 --- a/src/Symfony/Framework/DoctrineBundle/Bundle.php +++ b/src/Symfony/Framework/DoctrineBundle/Bundle.php @@ -41,8 +41,7 @@ class Bundle extends BaseBundle $class = basename($tmp); if (isset($bundleDirs[$namespace])) { - if (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Resources/config/doctrine/metadata')) - { + if (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Resources/config/doctrine/metadata')) { $metadataDirs[] = realpath($dir); } if (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Entities')) { diff --git a/src/Symfony/Framework/DoctrineBundle/Command/ConvertDoctrine1SchemaDoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/ConvertDoctrine1SchemaDoctrineCommand.php index f0fd0fbe4e..2e2d9eba68 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/ConvertDoctrine1SchemaDoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/ConvertDoctrine1SchemaDoctrineCommand.php @@ -60,8 +60,7 @@ EOT $bundleClass = null; $bundleDirs = $this->container->getKernelService()->getBundleDirs(); foreach ($this->container->getKernelService()->getBundles() as $bundle) { - if (strpos(get_class($bundle), $input->getArgument('bundle')) !== false) - { + if (strpos(get_class($bundle), $input->getArgument('bundle')) !== false) { $tmp = dirname(str_replace('\\', '/', get_class($bundle))); $namespace = str_replace('/', '\\', dirname($tmp)); $class = basename($tmp); diff --git a/src/Symfony/Framework/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php index d2aebea223..2389335e25 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php @@ -54,16 +54,14 @@ EOT $found = false; $connections = $this->getDoctrineConnections(); foreach ($connections as $name => $connection) { - if ($input->getOption('connection') && $name != $input->getOption('connection')) - { + if ($input->getOption('connection') && $name != $input->getOption('connection')) { continue; } $this->createDatabaseForConnection($connection, $output); $found = true; } if ($found === false) { - if ($input->getOption('connection')) - { + if ($input->getOption('connection')) { throw new \InvalidArgumentException(sprintf('Could not find a connection named %s', $input->getOption('connection'))); } else { throw new \InvalidArgumentException(sprintf('Could not find any configured connections', $input->getOption('connection'))); @@ -80,7 +78,7 @@ EOT $tmpConnection = \Doctrine\DBAL\DriverManager::getConnection($params); - try { + try { $tmpConnection->getSchemaManager()->createDatabase($name); $output->writeln(sprintf('Created database for connection named %s', $name)); } catch (\Exception $e) { diff --git a/src/Symfony/Framework/DoctrineBundle/Command/DoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/DoctrineCommand.php index 3ce4feb302..62eed02995 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/DoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/DoctrineCommand.php @@ -163,8 +163,7 @@ abstract class DoctrineCommand extends Command $cmf = new SymfonyDisconnectedClassMetadataFactory($em); $metadatas = $cmf->getAllMetadata(); foreach ($metadatas as $metadata) { - if (strpos($metadata->name, $namespace) !== false) - { + if (strpos($metadata->name, $namespace) !== false) { $bundleMetadatas[] = $metadata; } } diff --git a/src/Symfony/Framework/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php index 7c9dcfb2dd..ba2a315ae2 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php @@ -54,16 +54,14 @@ EOT $found = false; $connections = $this->getDoctrineConnections(); foreach ($connections as $name => $connection) { - if ($input->getOption('connection') && $name != $input->getOption('connection')) - { + if ($input->getOption('connection') && $name != $input->getOption('connection')) { continue; } $this->dropDatabaseForConnection($connection, $output); $found = true; } if ($found === false) { - if ($input->getOption('connection')) - { + if ($input->getOption('connection')) { throw new \InvalidArgumentException(sprintf('Could not find a connection named %s', $input->getOption('connection'))); } else { throw new \InvalidArgumentException(sprintf('Could not find any configured connections', $input->getOption('connection'))); @@ -76,7 +74,7 @@ EOT $params = $connection->getParams(); $name = isset($params['path']) ? $params['path']:$params['dbname']; - try { + try { $connection->getSchemaManager()->dropDatabase($name); $output->writeln(sprintf('Dropped database for connection named %s', $name)); } catch (\Exception $e) { diff --git a/src/Symfony/Framework/DoctrineBundle/Command/GenerateRepositoriesDoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/GenerateRepositoriesDoctrineCommand.php index ec95e04ee9..072b6660da 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/GenerateRepositoriesDoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/GenerateRepositoriesDoctrineCommand.php @@ -54,8 +54,7 @@ EOT if ($metadatas = $this->getBundleMetadatas($bundle)) { $output->writeln(sprintf('Generating entity repositories for "%s"', $class)); foreach ($metadatas as $metadata) { - if ($metadata->customRepositoryClassName) - { + if ($metadata->customRepositoryClassName) { $output->writeln(sprintf(' > generating %s', $metadata->customRepositoryClassName)); $generator->writeEntityRepositoryClass($metadata->customRepositoryClassName, $destination); } diff --git a/src/Symfony/Framework/DoctrineBundle/Command/ImportMappingDoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/ImportMappingDoctrineCommand.php index 581d5edb72..3c3188d4a1 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/ImportMappingDoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/ImportMappingDoctrineCommand.php @@ -58,8 +58,7 @@ EOT $bundleClass = null; $bundleDirs = $this->container->getKernelService()->getBundleDirs(); foreach ($this->container->getKernelService()->getBundles() as $bundle) { - if (strpos(get_class($bundle), $input->getArgument('bundle')) !== false) - { + if (strpos(get_class($bundle), $input->getArgument('bundle')) !== false) { $tmp = dirname(str_replace('\\', '/', get_class($bundle))); $namespace = str_replace('/', '\\', dirname($tmp)); $class = basename($tmp); diff --git a/src/Symfony/Framework/DoctrineBundle/Command/LoadDataFixturesDoctrineCommand.php b/src/Symfony/Framework/DoctrineBundle/Command/LoadDataFixturesDoctrineCommand.php index efe93fec5e..d62a9756d2 100644 --- a/src/Symfony/Framework/DoctrineBundle/Command/LoadDataFixturesDoctrineCommand.php +++ b/src/Symfony/Framework/DoctrineBundle/Command/LoadDataFixturesDoctrineCommand.php @@ -78,8 +78,7 @@ EOT $files = array(); foreach ($paths as $path) { - if (is_dir($path)) - { + if (is_dir($path)) { $finder = new Finder(); $found = iterator_to_array($finder ->files() @@ -117,8 +116,7 @@ EOT $emEntities[$emName][] = $value; } foreach ($ems as $emName => $em) { - if (!$input->getOption('append')) - { + if (!$input->getOption('append')) { $output->writeln(sprintf('Purging data from entity manager named "%s"', $emName)); $this->purgeEntityManager($em); } @@ -146,8 +144,7 @@ EOT $metadatas = $em->getMetadataFactory()->getAllMetadata(); foreach ($metadatas as $metadata) { - if (!$metadata->isMappedSuperclass) - { + if (!$metadata->isMappedSuperclass) { $classes[] = $metadata; } } @@ -174,7 +171,7 @@ EOT if ($assoc->isOwningSide) { $targetClass = $em->getClassMetadata($assoc->targetEntityName); - if ( ! $calc->hasClass($targetClass->name)) { + if ( ! $calc->hasClass($targetClass->name)) { $calc->addClass($targetClass); } diff --git a/src/Symfony/Framework/DoctrineBundle/DependencyInjection/DoctrineExtension.php b/src/Symfony/Framework/DoctrineBundle/DependencyInjection/DoctrineExtension.php index 712d67c36e..2c7b3e5617 100644 --- a/src/Symfony/Framework/DoctrineBundle/DependencyInjection/DoctrineExtension.php +++ b/src/Symfony/Framework/DoctrineBundle/DependencyInjection/DoctrineExtension.php @@ -80,8 +80,7 @@ class DoctrineExtension extends LoaderExtension $connections = array(); if (isset($config['connections'])) { - foreach ($config['connections'] as $name => $connection) - { + foreach ($config['connections'] as $name => $connection) { $connections[isset($connection['id']) ? $connection['id'] : $name] = $connection; } } else { @@ -122,8 +121,7 @@ class DoctrineExtension extends LoaderExtension $driverOptions['driverOptions'] = $connection['options']; } foreach (array('dbname', 'host', 'user', 'password', 'path', 'port') as $key) { - if (isset($connection[$key])) - { + if (isset($connection[$key])) { $driverOptions[$key] = $connection[$key]; } } @@ -162,8 +160,7 @@ class DoctrineExtension extends LoaderExtension $config['default_entity_manager'] = isset($config['default_entity_manager']) ? $config['default_entity_manager'] : 'default'; foreach (array('metadata_driver', 'cache_driver') as $key) { - if (isset($config[$key])) - { + if (isset($config[$key])) { $configuration->setParameter('doctrine.orm.'.$key, $config[$key]); } } @@ -205,8 +202,7 @@ class DoctrineExtension extends LoaderExtension } if (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Entities')) { - if ($type === false) - { + if ($type === false) { $type = 'annotation'; } $aliasMap[$class] = $namespace.'\\'.$class.'\\Entities'; diff --git a/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php b/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php index 3025128a98..efc986b313 100644 --- a/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php +++ b/src/Symfony/Framework/ProfilerBundle/ProfilerStorage.php @@ -107,8 +107,7 @@ class ProfilerStorage $stmt = $db->prepare($query); if ($db instanceof \SQLite3) { - foreach ($args as $arg => $val) - { + foreach ($args as $arg => $val) { $stmt->bindValue($arg, $val, is_int($val) ? \SQLITE3_INTEGER : \SQLITE3_TEXT); } $res = $stmt->execute(); @@ -118,8 +117,7 @@ class ProfilerStorage $res->finalize(); $stmt->close(); } else { - foreach ($args as $arg => $val) - { + foreach ($args as $arg => $val) { $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); } $stmt->execute(); diff --git a/src/Symfony/Framework/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php b/src/Symfony/Framework/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php index e7b00fd23f..c2f1982749 100644 --- a/src/Symfony/Framework/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php +++ b/src/Symfony/Framework/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php @@ -69,8 +69,7 @@ class SwiftMailerExtension extends LoaderExtension } foreach (array('encryption', 'port', 'host', 'username', 'password', 'auth_mode') as $key) { - if (isset($config[$key])) - { + if (isset($config[$key])) { $configuration->setParameter('swiftmailer.transport.'.$config['transport'].'.'.$key, $config[$key]); } } @@ -84,8 +83,7 @@ class SwiftMailerExtension extends LoaderExtension $configuration->setAlias('swiftmailer.spool', 'swiftmailer.spool.'.$type); foreach (array('path') as $key) { - if (isset($config['spool'][$key])) - { + if (isset($config['spool'][$key])) { $configuration->setParameter('swiftmailer.spool.'.$type.'.'.$key, $config['spool'][$key]); } } diff --git a/src/Symfony/Framework/WebBundle/Command/RouterDebugCommand.php b/src/Symfony/Framework/WebBundle/Command/RouterDebugCommand.php index 6d3de255d1..42269995aa 100644 --- a/src/Symfony/Framework/WebBundle/Command/RouterDebugCommand.php +++ b/src/Symfony/Framework/WebBundle/Command/RouterDebugCommand.php @@ -140,8 +140,7 @@ EOF $tokens = ''; foreach ($route->getTokens() as $token) { - if (!$tokens) - { + if (!$tokens) { $tokens = $this->displayToken($token); } else { $tokens .= "\n".str_repeat(' ', 13).$this->displayToken($token); diff --git a/src/Symfony/Framework/WebBundle/Controller/ExceptionController.php b/src/Symfony/Framework/WebBundle/Controller/ExceptionController.php index e77a35dfeb..13f3d6d746 100644 --- a/src/Symfony/Framework/WebBundle/Controller/ExceptionController.php +++ b/src/Symfony/Framework/WebBundle/Controller/ExceptionController.php @@ -61,14 +61,13 @@ class ExceptionController extends Controller $errors = 0; foreach ($logs as $log) { - if ('ERR' === $log['priorityName']) - { + if ('ERR' === $log['priorityName']) { ++$errors; } } $currentContent = ''; - while (false !== $content = ob_get_clean()) { $currentContent .= $content; } + while (false !== $content = ob_get_clean()) { $currentContent .= $content; } ob_start(); require $template; diff --git a/src/Symfony/Framework/WebBundle/Debug/ExceptionFormatter.php b/src/Symfony/Framework/WebBundle/Debug/ExceptionFormatter.php index 18a796400e..39eca02ca1 100644 --- a/src/Symfony/Framework/WebBundle/Debug/ExceptionFormatter.php +++ b/src/Symfony/Framework/WebBundle/Debug/ExceptionFormatter.php @@ -118,8 +118,7 @@ class ExceptionFormatter $single and $args = array($args); foreach ($args as $key => $value) { - if (is_object($value)) - { + if (is_object($value)) { $formattedValue = ($format == 'html' ? 'object' : 'object').sprintf("('%s')", get_class($value)); } else if (is_array($value)) { $formattedValue = ($format == 'html' ? 'array' : 'array').sprintf("(%s)", $this->formatArgs($value)); diff --git a/src/Symfony/Framework/WebBundle/DependencyInjection/WebExtension.php b/src/Symfony/Framework/WebBundle/DependencyInjection/WebExtension.php index 24f2ba9a3f..e5f8625a55 100644 --- a/src/Symfony/Framework/WebBundle/DependencyInjection/WebExtension.php +++ b/src/Symfony/Framework/WebBundle/DependencyInjection/WebExtension.php @@ -61,8 +61,7 @@ class WebExtension extends LoaderExtension } foreach (array('name', 'auto_start', 'lifetime', 'path', 'domain', 'secure', 'httponly', 'cache_limiter', 'pdo.db_table') as $name) { - if (isset($config['session'][$name])) - { + if (isset($config['session'][$name])) { $configuration->setParameter('session.options.'.$name, $config['session'][$name]); } } diff --git a/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php b/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php index fca57a0dd8..3a6fb7f76b 100644 --- a/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php +++ b/src/Symfony/Framework/WebBundle/Listener/ControllerLoader.php @@ -59,8 +59,7 @@ class ControllerLoader $request = $event->getParameter('request'); if (!($bundle = $request->path->get('_bundle')) || !($controller = $request->path->get('_controller')) || !($action = $request->path->get('_action'))) { - if (null !== $this->logger) - { + if (null !== $this->logger) { $this->logger->err(sprintf('Unable to look for the controller as some mandatory parameters are missing (_bundle: %s, _controller: %s, _action: %s)', isset($bundle) ? var_export($bundle, true) : 'NULL', isset($controller) ? var_export($controller, true) : 'NULL', isset($action) ? var_export($action, true) : 'NULL')); } @@ -88,8 +87,7 @@ class ControllerLoader foreach (array_keys($this->container->getParameter('kernel.bundle_dirs')) as $namespace) { $try = $namespace.'\\'.$bundle.'\\Controller\\'.$controller.'Controller'; if (!class_exists($try)) { - if (null !== $this->logger) - { + if (null !== $this->logger) { $logs[] = sprintf('Failed finding controller "%s:%s" from namespace "%s" (%s)', $bundle, $controller, $namespace, $try); } } else { @@ -105,8 +103,7 @@ class ControllerLoader } if (null === $class) { - if (null !== $this->logger) - { + if (null !== $this->logger) { foreach ($logs as $log) { $this->logger->info($log); } @@ -136,8 +133,7 @@ class ControllerLoader { $arguments = array(); foreach ($r->getParameters() as $param) { - if (array_key_exists($param->getName(), $parameters)) - { + if (array_key_exists($param->getName(), $parameters)) { $arguments[] = $parameters[$param->getName()]; } elseif ($param->isDefaultValueAvailable()) { $arguments[] = $param->getDefaultValue(); diff --git a/src/Symfony/Framework/WebBundle/Listener/RequestParser.php b/src/Symfony/Framework/WebBundle/Listener/RequestParser.php index 90ddeeed0b..232ef9efd9 100644 --- a/src/Symfony/Framework/WebBundle/Listener/RequestParser.php +++ b/src/Symfony/Framework/WebBundle/Listener/RequestParser.php @@ -64,8 +64,7 @@ class RequestParser } if (false !== $parameters = $this->router->match($request->getPathInfo())) { - if (null !== $this->logger) - { + if (null !== $this->logger) { $this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], str_replace("\n", '', var_export($parameters, true)))); } diff --git a/src/Symfony/Framework/WebBundle/Templating/Engine.php b/src/Symfony/Framework/WebBundle/Templating/Engine.php index 939a73161f..fcb467dae8 100644 --- a/src/Symfony/Framework/WebBundle/Templating/Engine.php +++ b/src/Symfony/Framework/WebBundle/Templating/Engine.php @@ -48,8 +48,7 @@ class Engine extends BaseEngine $this->helpers = array(); foreach ($this->container->findAnnotatedServiceIds('templating.helper') as $id => $attributes) { - if (isset($attributes[0]['alias'])) - { + if (isset($attributes[0]['alias'])) { $this->helpers[$attributes[0]['alias']] = $id; } } diff --git a/src/Symfony/Framework/WebBundle/Util/Filesystem.php b/src/Symfony/Framework/WebBundle/Util/Filesystem.php index 66bdaccf3e..50821d2b92 100644 --- a/src/Symfony/Framework/WebBundle/Util/Filesystem.php +++ b/src/Symfony/Framework/WebBundle/Util/Filesystem.php @@ -104,16 +104,14 @@ class Filesystem $files = array_reverse($files); foreach ($files as $file) { - if (!file_exists($file)) - { + if (!file_exists($file)) { continue; } if (is_dir($file) && !is_link($file)) { $fp = opendir($file); while (false !== $item = readdir($fp)) { - if (!in_array($item, array('.', '..'))) - { + if (!in_array($item, array('.', '..'))) { $this->remove($file.'/'.$item); } } @@ -184,8 +182,7 @@ class Filesystem $ok = false; if (is_link($targetDir)) { - if (readlink($targetDir) != $originDir) - { + if (readlink($targetDir) != $originDir) { unlink($targetDir); } else { $ok = true; diff --git a/tests/Symfony/Tests/Components/DependencyInjection/Loader/YamlFileLoaderTest.php b/tests/Symfony/Tests/Components/DependencyInjection/Loader/YamlFileLoaderTest.php index 27a0e9b63d..8f25da26fc 100644 --- a/tests/Symfony/Tests/Components/DependencyInjection/Loader/YamlFileLoaderTest.php +++ b/tests/Symfony/Tests/Components/DependencyInjection/Loader/YamlFileLoaderTest.php @@ -49,8 +49,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase $loader = new ProjectLoader3(self::$fixturesPath.'/yaml'); foreach (array('nonvalid1', 'nonvalid2') as $fixture) { - try - { + try { $loader->loadFile($fixture.'.yml'); $this->fail('->load() throws an InvalidArgumentException if the loaded file does not validate'); } catch (\Exception $e) { diff --git a/tests/Symfony/Tests/Components/Finder/Iterator/RealIteratorTestCase.php b/tests/Symfony/Tests/Components/Finder/Iterator/RealIteratorTestCase.php index fd175b2c8e..8543820420 100644 --- a/tests/Symfony/Tests/Components/Finder/Iterator/RealIteratorTestCase.php +++ b/tests/Symfony/Tests/Components/Finder/Iterator/RealIteratorTestCase.php @@ -29,8 +29,7 @@ class RealIteratorTestCase extends IteratorTestCase mkdir($tmpDir); foreach (self::$files as $file) { - if (false !== ($pos = strpos($file, '.')) && '/' !== $file[$pos - 1]) - { + if (false !== ($pos = strpos($file, '.')) && '/' !== $file[$pos - 1]) { touch($file); } else { mkdir($file); @@ -44,8 +43,7 @@ class RealIteratorTestCase extends IteratorTestCase static public function tearDownAfterClass() { foreach (self::$files as $file) { - if (false !== ($pos = strpos($file, '.')) && '/' !== $file[$pos - 1]) - { + if (false !== ($pos = strpos($file, '.')) && '/' !== $file[$pos - 1]) { @unlink($file); } else { @rmdir($file); diff --git a/tests/Symfony/Tests/Components/OutputEscaper/ArrayDecoratorTest.php b/tests/Symfony/Tests/Components/OutputEscaper/ArrayDecoratorTest.php index 1270214aa8..dce4605816 100644 --- a/tests/Symfony/Tests/Components/OutputEscaper/ArrayDecoratorTest.php +++ b/tests/Symfony/Tests/Components/OutputEscaper/ArrayDecoratorTest.php @@ -59,8 +59,7 @@ class ArrayDecoratorTest extends \PHPUnit_Framework_TestCase public function testIteratorInterface() { foreach (self::$escaped as $key => $value) { - switch ($key) - { + switch ($key) { case 0: $this->assertEquals('<strong>escaped!</strong>', $value, 'The escaped object behaves like an array'); break; diff --git a/tests/Symfony/Tests/Components/Yaml/DumperTest.php b/tests/Symfony/Tests/Components/Yaml/DumperTest.php index 68c646f379..a0ecfb3f38 100644 --- a/tests/Symfony/Tests/Components/Yaml/DumperTest.php +++ b/tests/Symfony/Tests/Components/Yaml/DumperTest.php @@ -40,8 +40,7 @@ class DumperTest extends \PHPUnit_Framework_TestCase // split YAMLs documents foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) { - if (!$yaml) - { + if (!$yaml) { continue; } diff --git a/tests/Symfony/Tests/Components/Yaml/InlineTest.php b/tests/Symfony/Tests/Components/Yaml/InlineTest.php index 9aedbb968e..2cc77c56f1 100644 --- a/tests/Symfony/Tests/Components/Yaml/InlineTest.php +++ b/tests/Symfony/Tests/Components/Yaml/InlineTest.php @@ -36,8 +36,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase } foreach ($this->getTestsForLoad() as $yaml => $value) { - if ($value == 1230) - { + if ($value == 1230) { continue; } @@ -45,8 +44,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase } foreach ($testsForDump as $yaml => $value) { - if ($value == 1230) - { + if ($value == 1230) { continue; } diff --git a/tests/Symfony/Tests/Components/Yaml/ParserTest.php b/tests/Symfony/Tests/Components/Yaml/ParserTest.php index aea97ebb63..bbb97ad622 100644 --- a/tests/Symfony/Tests/Components/Yaml/ParserTest.php +++ b/tests/Symfony/Tests/Components/Yaml/ParserTest.php @@ -38,8 +38,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase // split YAMLs documents foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) { - if (!$yaml) - { + if (!$yaml) { continue; } @@ -66,8 +65,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase ); foreach ($yamls as $yaml) { - try - { + try { $content = $this->parser->parse($yaml); $this->fail('YAML files must not contain tabs'); diff --git a/tests/lib/SymfonyTests/Components/Templating/ProjectTemplateDebugger.php b/tests/lib/SymfonyTests/Components/Templating/ProjectTemplateDebugger.php index ea5c664695..6f9df27715 100644 --- a/tests/lib/SymfonyTests/Components/Templating/ProjectTemplateDebugger.php +++ b/tests/lib/SymfonyTests/Components/Templating/ProjectTemplateDebugger.php @@ -14,8 +14,7 @@ class ProjectTemplateDebugger implements DebuggerInterface public function hasMessage($regex) { foreach ($this->messages as $message) { - if (preg_match('#'.preg_quote($regex, '#').'#', $message)) - { + if (preg_match('#'.preg_quote($regex, '#').'#', $message)) { return true; } }