diff --git a/src/Symfony/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php b/src/Symfony/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php index aa7ea84404686..2a10fb6f51149 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php +++ b/src/Symfony/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php @@ -17,8 +17,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\Output; use Symfony\Bundle\FrameworkBundle\Util\Filesystem; -use Doctrine\Common\Cli\Configuration; -use Doctrine\Common\Cli\CliController as DoctrineCliController; use Doctrine\DBAL\Connection; /** diff --git a/src/Symfony/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php b/src/Symfony/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php index d0c2f713c2c0f..aded02aa94706 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php +++ b/src/Symfony/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php @@ -17,8 +17,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\Output; use Symfony\Bundle\FrameworkBundle\Util\Filesystem; -use Doctrine\Common\Cli\Configuration; -use Doctrine\Common\Cli\CliController as DoctrineCliController; use Doctrine\DBAL\Connection; /** @@ -74,7 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } } else { $output->writeln(sprintf('Would drop the database named %s.', $name)); - $output->writeln(sprintf('All data will be lost!', $name)); + $output->writeln('All data will be lost!'); } } } \ No newline at end of file diff --git a/src/Symfony/Bundle/DoctrineBundle/Command/LoadDataFixturesDoctrineCommand.php b/src/Symfony/Bundle/DoctrineBundle/Command/LoadDataFixturesDoctrineCommand.php index 3a369bbd61ef7..fac3157245ac2 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Command/LoadDataFixturesDoctrineCommand.php +++ b/src/Symfony/Bundle/DoctrineBundle/Command/LoadDataFixturesDoctrineCommand.php @@ -19,8 +19,6 @@ use Symfony\Component\Finder\Finder; use Symfony\Bundle\FrameworkBundle\Util\Filesystem; use Symfony\Bundle\DoctrineAbstractBundle\Common\DataFixtures\Loader as DataFixturesLoader; -use Doctrine\Common\Cli\Configuration; -use Doctrine\Common\Cli\CliController as DoctrineCliController; use Doctrine\Common\DataFixtures\Executor\ORMExecutor; use Doctrine\Common\DataFixtures\Purger\ORMPurger; use Doctrine\ORM\EntityManager; diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/Command/LoadDataFixturesDoctrineODMCommand.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/Command/LoadDataFixturesDoctrineODMCommand.php index bcaf9e0d85a16..1a448b4284a09 100644 --- a/src/Symfony/Bundle/DoctrineMongoDBBundle/Command/LoadDataFixturesDoctrineODMCommand.php +++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/Command/LoadDataFixturesDoctrineODMCommand.php @@ -19,8 +19,6 @@ use Symfony\Component\Finder\Finder; use Symfony\Bundle\FrameworkBundle\Util\Filesystem; use Symfony\Bundle\DoctrineAbstractBundle\Common\DataFixtures\Loader as DataFixturesLoader; -use Doctrine\Common\Cli\Configuration; -use Doctrine\Common\Cli\CliController as DoctrineCliController; use Doctrine\Common\DataFixtures\Executor\MongoDBExecutor; use Doctrine\Common\DataFixtures\Purger\MongoDBPurger; use Doctrine\ODM\MongoDB\DocumentManager; diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php index da0673a09153a..b726f0391e390 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php @@ -159,8 +159,8 @@ protected function formatValue($value) { if (is_object($value)) { return sprintf('object(%s)', get_class($value)); - } else { - return preg_replace("/\n\s*/s", '', var_export($value, true)); } + + return preg_replace("/\n\s*/s", '', var_export($value, true)); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php index 92cb882861c52..200c735d2132c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php @@ -66,9 +66,9 @@ private function attributesCallback($name, $value) { if (false === $value || null === $value || ('' === $value && 'value' != $name)) { return ''; - } else { - return ' '.$this->attribute($name, $value); } + + return ' '.$this->attribute($name, $value); } /** diff --git a/src/Symfony/Component/BrowserKit/Response.php b/src/Symfony/Component/BrowserKit/Response.php index e8179f1532389..7e425155a9478 100644 --- a/src/Symfony/Component/BrowserKit/Response.php +++ b/src/Symfony/Component/BrowserKit/Response.php @@ -118,9 +118,9 @@ public function getHeader($header, $first = true) if (str_replace('-', '_', strtolower($key)) == str_replace('-', '_', strtolower($header))) { if ($first) { return is_array($value) ? (count($value) ? $value[0] : '') : $value; - } else { - return is_array($value) ? $value : array($value); } + + return is_array($value) ? $value : array($value); } } diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index d7509de85b245..4eccf9833b820 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -129,9 +129,9 @@ public function run(InputInterface $input = null, OutputInterface $output = null // @codeCoverageIgnoreStart exit($statusCode); // @codeCoverageIgnoreEnd - } else { - return $statusCode; } + + return $statusCode; } /** @@ -315,9 +315,9 @@ public function getLongVersion() { if ('UNKNOWN' !== $this->getName() && 'UNKNOWN' !== $this->getVersion()) { return sprintf('%s version %s', $this->getName(), $this->getVersion()); - } else { - return 'Console Tool'; } + + return 'Console Tool'; } /** diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index f07e57520fefd..711d8d2e64d68 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -159,9 +159,9 @@ public function run(InputInterface $input, OutputInterface $output) if ($this->code) { return call_user_func($this->code, $input, $output); - } else { - return $this->execute($input, $output); } + + return $this->execute($input, $output); } /** diff --git a/src/Symfony/Component/Console/Helper/DialogHelper.php b/src/Symfony/Component/Console/Helper/DialogHelper.php index a2df0db53baa7..a82fbccc6d47d 100644 --- a/src/Symfony/Component/Console/Helper/DialogHelper.php +++ b/src/Symfony/Component/Console/Helper/DialogHelper.php @@ -61,9 +61,9 @@ public function askConfirmation(OutputInterface $output, $question, $default = t if (false === $default) { return $answer && 'y' == strtolower($answer[0]); - } else { - return !$answer || 'y' == strtolower($answer[0]); } + + return !$answer || 'y' == strtolower($answer[0]); // @codeCoverageIgnoreEnd } diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index 256a15c9c4013..4113b493d095a 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -275,9 +275,9 @@ public function getParameterOption($values, $default = false) if (0 === strpos($token, $value)) { if (false !== $pos = strpos($token, '=')) { return substr($token, $pos + 1); - } else { - return array_shift($tokens); } + + return array_shift($tokens); } } } diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index e20252aefa10c..90397e832e23f 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -97,9 +97,9 @@ protected function hasColorSupport() // @codeCoverageIgnoreStart if (DIRECTORY_SEPARATOR == '\\') { return false !== getenv('ANSICON'); - } else { - return function_exists('posix_isatty') && @posix_isatty($this->stream); } + + return function_exists('posix_isatty') && @posix_isatty($this->stream); // @codeCoverageIgnoreEnd } } diff --git a/src/Symfony/Component/CssSelector/Node/AttribNode.php b/src/Symfony/Component/CssSelector/Node/AttribNode.php index 3471986d2d166..31e55d62c6263 100644 --- a/src/Symfony/Component/CssSelector/Node/AttribNode.php +++ b/src/Symfony/Component/CssSelector/Node/AttribNode.php @@ -55,9 +55,9 @@ public function __toString() { if ($this->operator == 'exists') { return sprintf('%s[%s[%s]]', __CLASS__, $this->selector, $this->formatAttrib()); - } else { - return sprintf('%s[%s[%s %s %s]]', __CLASS__, $this->selector, $this->formatAttrib(), $this->operator, $this->value); } + + return sprintf('%s[%s[%s %s %s]]', __CLASS__, $this->selector, $this->formatAttrib(), $this->operator, $this->value); } /** diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php index 44b1c4a8e10ee..cc222cf202325 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php @@ -79,9 +79,9 @@ protected function resolveValue($value) return $resolved; } else if (is_string($value)) { return $this->resolveString($value); - } else { - return $value; } + + return $value; } /** diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 1442f4f43ce8e..9ed0842ce2e80 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -466,12 +466,12 @@ protected function addServiceConfigurator($id, $definition, $variableName = 'ins if (is_array($callable)) { if (is_object($callable[0]) && $callable[0] instanceof Reference) { return sprintf(" %s->%s(\$%s);\n", $this->getServiceCall((string) $callable[0]), $callable[1], $variableName); - } else { - return sprintf(" call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } - } else { - return sprintf(" %s(\$%s);\n", $callable, $variableName); + + return sprintf(" call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); } + + return sprintf(" %s(\$%s);\n", $callable, $variableName); } /** diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index 52ec07c0deb9e..30464025bf1aa 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -206,9 +206,9 @@ protected function dumpValue($value) return $this->getParameterCall((string) $value); } elseif (is_object($value) || is_resource($value)) { throw new \RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); - } else { - return $value; } + + return $value; } /** @@ -222,9 +222,9 @@ protected function getServiceCall($id, Reference $reference = null) { if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) { return sprintf('@?%s', $id); - } else { - return sprintf('@%s', $id); } + + return sprintf('@%s', $id); } /** diff --git a/src/Symfony/Component/Form/ChoiceField.php b/src/Symfony/Component/Form/ChoiceField.php index 9e16eee7184ab..c85710b159907 100644 --- a/src/Symfony/Component/Form/ChoiceField.php +++ b/src/Symfony/Component/Form/ChoiceField.php @@ -205,11 +205,11 @@ protected function newChoiceField($choice, $label) return new CheckboxField($choice, array( 'value' => $choice, )); - } else { - return new RadioField($choice, array( - 'value' => $choice, - )); } + + return new RadioField($choice, array( + 'value' => $choice, + )); } /** diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index d8a6e38174b35..aea839c65eefb 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -836,9 +836,9 @@ public function isPostMaxSizeReached() } return $length > $max; - } else { - return false; } + + return false; } /** diff --git a/src/Symfony/Component/Form/HybridField.php b/src/Symfony/Component/Form/HybridField.php index 7c097c06b2c1d..54891ae59be30 100644 --- a/src/Symfony/Component/Form/HybridField.php +++ b/src/Symfony/Component/Form/HybridField.php @@ -95,9 +95,9 @@ public function getDisplayedData() { if ($this->mode === self::FORM) { return parent::getDisplayedData(); - } else { - return Field::getDisplayedData(); } + + return Field::getDisplayedData(); } /** @@ -131,8 +131,8 @@ public function isEmpty() { if ($this->mode === self::FORM) { return parent::isEmpty(); - } else { - return Field::isEmpty(); } + + return Field::isEmpty(); } } \ No newline at end of file diff --git a/src/Symfony/Component/Form/PropertyPath.php b/src/Symfony/Component/Form/PropertyPath.php index 5eebc349f3868..0a18d59079bbf 100644 --- a/src/Symfony/Component/Form/PropertyPath.php +++ b/src/Symfony/Component/Form/PropertyPath.php @@ -246,9 +246,9 @@ protected function readPropertyPath(&$objectOrArray, $currentIndex) if ($currentIndex < $this->length) { return $this->readPropertyPath($value, $currentIndex); - } else { - return $value; } + + return $value; } /** diff --git a/src/Symfony/Component/HttpFoundation/File/File.php b/src/Symfony/Component/HttpFoundation/File/File.php index 306764f932617..e88d915d06109 100644 --- a/src/Symfony/Component/HttpFoundation/File/File.php +++ b/src/Symfony/Component/HttpFoundation/File/File.php @@ -519,9 +519,9 @@ public function getExtension() { if ($ext = pathinfo($this->getName(), \PATHINFO_EXTENSION)) { return '.' . $ext; - } else { - return ''; } + + return ''; } /** @@ -537,9 +537,9 @@ public function getDefaultExtension() if (isset(self::$defaultExtensions[$type])) { return '.' . self::$defaultExtensions[$type]; - } else { - return $this->getExtension(); } + + return $this->getExtension(); } /** diff --git a/src/Symfony/Component/HttpFoundation/FileBag.php b/src/Symfony/Component/HttpFoundation/FileBag.php index 5188716cd3d5a..7304ecb497931 100644 --- a/src/Symfony/Component/HttpFoundation/FileBag.php +++ b/src/Symfony/Component/HttpFoundation/FileBag.php @@ -86,13 +86,14 @@ protected function convertFileInformation($file) } if ($keys != $this->fileKeys) { $file = array_map(array($this, 'convertFileInformation'), $file); - } else + } else { if ($file['error'] === UPLOAD_ERR_NO_FILE) { $file = null; } else { $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); } + } } return $file; } diff --git a/src/Symfony/Component/HttpFoundation/HeaderBag.php b/src/Symfony/Component/HttpFoundation/HeaderBag.php index f28620b8dfd63..c786753c6ac34 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/HeaderBag.php @@ -96,16 +96,16 @@ public function get($key, $default = null, $first = true) if (!array_key_exists($key, $this->headers)) { if (null === $default) { return $first ? null : array(); - } else { - return $first ? $default : array($default); } + + return $first ? $default : array($default); } if ($first) { return count($this->headers[$key]) ? $this->headers[$key][0] : $default; - } else { - return $this->headers[$key]; } + + return $this->headers[$key]; } /** diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 57883272c457b..f9de1cba51501 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -436,9 +436,9 @@ public function getHttpHost() if (('http' == $scheme && $port == 80) || ('https' == $scheme && $port == 443)) { return $name; - } else { - return $name.':'.$port; } + + return $name.':'.$port; } public function getRequestUri() diff --git a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php index 348ba170ad8fa..3ff7cb36376e0 100644 --- a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php @@ -171,18 +171,18 @@ public function sessionRead($id) if (count($sessionRows) == 1) { return $sessionRows[0][0]; - } else { - // session does not exist, create it - $sql = 'INSERT INTO '.$db_table.'('.$db_id_col.', '.$db_data_col.', '.$db_time_col.') VALUES (?, ?, ?)'; + } - $stmt = $this->db->prepare($sql); - $stmt->bindParam(1, $id, \PDO::PARAM_STR); - $stmt->bindValue(2, '', \PDO::PARAM_STR); - $stmt->bindValue(3, time(), \PDO::PARAM_INT); - $stmt->execute(); + // session does not exist, create it + $sql = 'INSERT INTO '.$db_table.'('.$db_id_col.', '.$db_data_col.', '.$db_time_col.') VALUES (?, ?, ?)'; - return ''; - } + $stmt = $this->db->prepare($sql); + $stmt->bindParam(1, $id, \PDO::PARAM_STR); + $stmt->bindValue(2, '', \PDO::PARAM_STR); + $stmt->bindValue(3, time(), \PDO::PARAM_INT); + $stmt->execute(); + + return ''; } catch (\PDOException $e) { throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e); } diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index ca826d4a636f9..7f8b91051a698 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -456,32 +456,30 @@ protected function lock(Request $request, Response $entry) // server the stale response while there is a revalidation return true; - } else { - // wait for the lock to be released - $wait = 0; - while (file_exists($lock) && $wait < 5000000) { - usleep($wait += 50000); - } - - if ($wait < 2000000) { - // replace the current entry with the fresh one - $new = $this->lookup($request); - $entry->headers = $new->headers; - $entry->setContent($new->getContent()); - $entry->setStatusCode($new->getStatusCode()); - $entry->setProtocolVersion($new->getProtocolVersion()); - $entry->setCookies($new->getCookies()); + } - return true; - } else { - // backend is slow as hell, send a 503 response (to avoid the dog pile effect) - $entry->setStatusCode(503); - $entry->setContent('503 Service Unavailable'); - $entry->headers->set('Retry-After', 10); + // wait for the lock to be released + $wait = 0; + while (file_exists($lock) && $wait < 5000000) { + usleep($wait += 50000); + } - return true; - } + if ($wait < 2000000) { + // replace the current entry with the fresh one + $new = $this->lookup($request); + $entry->headers = $new->headers; + $entry->setContent($new->getContent()); + $entry->setStatusCode($new->getStatusCode()); + $entry->setProtocolVersion($new->getProtocolVersion()); + $entry->setCookies($new->getCookies()); + } else { + // backend is slow as hell, send a 503 response (to avoid the dog pile effect) + $entry->setStatusCode(503); + $entry->setContent('503 Service Unavailable'); + $entry->headers->set('Retry-After', 10); } + + return true; } // we have the lock, call the backend diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index c71b436cad0b0..6c7f22b46aabb 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -78,9 +78,9 @@ public function lock(Request $request) $this->locks[] = $path; return true; - } else { - return $path; } + + return $path; } /** @@ -125,12 +125,12 @@ public function lookup(Request $request) list($req, $headers) = $match; if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) { return $this->restoreResponse($headers, $body); - } else { - // TODO the metaStore referenced an entity that doesn't exist in - // the entityStore. We definitely want to return nil but we should - // also purge the entry from the meta-store when this is detected. - return null; } + + // TODO the metaStore referenced an entity that doesn't exist in + // the entityStore. We definitely want to return nil but we should + // also purge the entry from the meta-store when this is detected. + return null; } /** diff --git a/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php index bc01087ac8808..0f858c58f8496 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php @@ -73,9 +73,9 @@ public function read($token) $this->close($db); if (isset($data[0]['data'])) { return array($data[0]['data'], $data[0]['ip'], $data[0]['url'], $data[0]['time']); - } else { - return false; } + + return false; } /** diff --git a/src/Symfony/Component/Security/Acl/Domain/PermissionGrantingStrategy.php b/src/Symfony/Component/Security/Acl/Domain/PermissionGrantingStrategy.php index d23dc3e12d6b0..bbc5526c4ebc6 100644 --- a/src/Symfony/Component/Security/Acl/Domain/PermissionGrantingStrategy.php +++ b/src/Symfony/Component/Security/Acl/Domain/PermissionGrantingStrategy.php @@ -220,8 +220,8 @@ protected function isAceApplicable($requiredMask, EntryInterface $ace) return 0 !== ($ace->getMask() & $requiredMask); } else if (self::EQUAL === $strategy) { return $requiredMask === $ace->getMask(); - } else { - throw new \RuntimeException(sprintf('The strategy "%s" is not supported.', $strategy)); } + + throw new \RuntimeException(sprintf('The strategy "%s" is not supported.', $strategy)); } } diff --git a/src/Symfony/Component/Security/Acl/Voter/AclVoter.php b/src/Symfony/Component/Security/Acl/Voter/AclVoter.php index 14acef5227c69..d689db596ba52 100644 --- a/src/Symfony/Component/Security/Acl/Voter/AclVoter.php +++ b/src/Symfony/Component/Security/Acl/Voter/AclVoter.php @@ -111,13 +111,13 @@ public function vote(TokenInterface $token, $object, array $attributes) } return self::ACCESS_GRANTED; - } else { - if (null !== $this->logger) { - $this->logger->debug('ACL found, insufficient permissions. Voting to deny access.'); - } + } - return self::ACCESS_DENIED; + if (null !== $this->logger) { + $this->logger->debug('ACL found, insufficient permissions. Voting to deny access.'); } + + return self::ACCESS_DENIED; } catch (NoAceFoundException $noAce) { if (null !== $this->logger) { $this->logger->debug('ACL found, no ACE applicable. Voting to deny access.'); diff --git a/src/Symfony/Component/Security/Core/Encoder/PlaintextPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/PlaintextPasswordEncoder.php index 98982b02837f0..e155fbd3c78f1 100644 --- a/src/Symfony/Component/Security/Core/Encoder/PlaintextPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/PlaintextPasswordEncoder.php @@ -42,8 +42,8 @@ public function isPasswordValid($encoded, $raw, $salt) if (!$this->ignorePasswordCase) { return $this->comparePasswords($encoded, $pass2); - } else { - return $this->comparePasswords(strtolower($encoded), strtolower($pass2)); } + + return $this->comparePasswords(strtolower($encoded), strtolower($pass2)); } } diff --git a/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php index 353185e218cca..f992b98758a9c 100644 --- a/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php @@ -198,15 +198,15 @@ protected function onFailure($event, Request $request, AuthenticationException $ $subRequest->attributes->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed); return $event->getSubject()->handle($subRequest, HttpKernelInterface::SUB_REQUEST); - } else { - if (null !== $this->logger) { - $this->logger->debug(sprintf('Redirecting to %s', $this->options['failure_path'])); - } - - $request->getSession()->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed); + } - return new RedirectResponse(0 !== strpos($this->options['failure_path'], 'http') ? $request->getUriForPath($this->options['failure_path']) : $this->options['failure_path'], 302); + if (null !== $this->logger) { + $this->logger->debug(sprintf('Redirecting to %s', $this->options['failure_path'])); } + + $request->getSession()->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed); + + return new RedirectResponse(0 !== strpos($this->options['failure_path'], 'http') ? $request->getUriForPath($this->options['failure_path']) : $this->options['failure_path'], 302); } protected function onSuccess(EventInterface $event, Request $request, TokenInterface $token) diff --git a/src/Symfony/Component/Templating/PhpEngine.php b/src/Symfony/Component/Templating/PhpEngine.php index d3b9813756cb0..0afafe5f2ab5e 100644 --- a/src/Symfony/Component/Templating/PhpEngine.php +++ b/src/Symfony/Component/Templating/PhpEngine.php @@ -460,9 +460,9 @@ public function convertEncoding($string, $to, $from) return iconv($from, $to, $string); } elseif (function_exists('mb_convert_encoding')) { return mb_convert_encoding($string, $to, $from); - } else { - throw new \RuntimeException('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).'); } + + throw new \RuntimeException('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).'); } /** diff --git a/src/Symfony/Component/Templating/TemplateReference.php b/src/Symfony/Component/Templating/TemplateReference.php index cba64d2d18c04..dbd60710aa4c6 100644 --- a/src/Symfony/Component/Templating/TemplateReference.php +++ b/src/Symfony/Component/Templating/TemplateReference.php @@ -62,9 +62,9 @@ public function get($name) { if (array_key_exists($name, $this->parameters)) { return $this->parameters[$name]; - } else { - throw new \InvalidArgumentException(sprintf('The template does not support the "%s" parameter.', $name)); } + + throw new \InvalidArgumentException(sprintf('The template does not support the "%s" parameter.', $name)); } /** diff --git a/src/Symfony/Component/Translation/Interval.php b/src/Symfony/Component/Translation/Interval.php index f40b7fb4e03af..f28d2b25fb274 100644 --- a/src/Symfony/Component/Translation/Interval.php +++ b/src/Symfony/Component/Translation/Interval.php @@ -96,8 +96,8 @@ static protected function convertNumber($number) return log(0); } elseif ('+Inf' === $number || 'Inf' === $number) { return -log(0); - } else { - return (int) $number; } + + return (int) $number; } } diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 76350605b8c65..13fe4641d8749 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -343,9 +343,9 @@ protected function parseValue($value) $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : ''; return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), intval(abs($modifiers))); - } else { - return Inline::load($value); } + + return Inline::load($value); } /** diff --git a/tests/Symfony/Tests/Component/BrowserKit/ClientTest.php b/tests/Symfony/Tests/Component/BrowserKit/ClientTest.php index 42f45569dec2c..dfecf055962a5 100644 --- a/tests/Symfony/Tests/Component/BrowserKit/ClientTest.php +++ b/tests/Symfony/Tests/Component/BrowserKit/ClientTest.php @@ -36,12 +36,12 @@ protected function doRequest($request) { if (null === $this->nextResponse) { return new Response(); - } else { - $response = $this->nextResponse; - $this->nextResponse = null; - - return $response; } + + $response = $this->nextResponse; + $this->nextResponse = null; + + return $response; } protected function getScript($request)