Selaa lähdekoodia

[Security] Removed useless else

Pascal Borreli 14 vuotta sitten
vanhempi
commit
787812d968

+ 2 - 2
src/Symfony/Component/Security/Acl/Domain/PermissionGrantingStrategy.php

@@ -220,8 +220,8 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
             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));
     }
 }

+ 5 - 5
src/Symfony/Component/Security/Acl/Voter/AclVoter.php

@@ -111,13 +111,13 @@ class AclVoter implements VoterInterface
                     }
 
                     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.');

+ 2 - 2
src/Symfony/Component/Security/Core/Encoder/PlaintextPasswordEncoder.php

@@ -42,8 +42,8 @@ class PlaintextPasswordEncoder extends BasePasswordEncoder
 
         if (!$this->ignorePasswordCase) {
             return $this->comparePasswords($encoded, $pass2);
-        } else {
-            return $this->comparePasswords(strtolower($encoded), strtolower($pass2));
         }
+
+        return $this->comparePasswords(strtolower($encoded), strtolower($pass2));
     }
 }

+ 7 - 7
src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php

@@ -198,15 +198,15 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
             $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)