瀏覽代碼

[Security] Fixed coding standard

Pascal Borreli 14 年之前
父節點
當前提交
d067d5da69

+ 1 - 1
src/Symfony/Component/Security/Authentication/AuthenticationManagerInterface.php

@@ -25,7 +25,7 @@ interface AuthenticationManagerInterface
     /**
      * Attempts to authenticates a TokenInterface object.
      *
-     * @param TokenInterface The TokenInterface instance to authenticate
+     * @param TokenInterface $token The TokenInterface instance to authenticate
      *
      * @return TokenInterface An authenticated TokenInterface instance
      *

+ 1 - 1
src/Symfony/Component/Security/Authentication/Provider/DaoAuthenticationProvider.php

@@ -35,8 +35,8 @@ class DaoAuthenticationProvider extends UserAuthenticationProvider
      * Constructor.
      *
      * @param UserProviderInterface    $userProvider    A UserProviderInterface instance
-     * @param PasswordEncoderInterface $passwordEncoder A PasswordEncoderInterface instance
      * @param AccountCheckerInterface  $accountChecker  An AccountCheckerInterface instance
+     * @param PasswordEncoderInterface $passwordEncoder A PasswordEncoderInterface instance
      */
     public function __construct(UserProviderInterface $userProvider, AccountCheckerInterface $accountChecker, PasswordEncoderInterface $passwordEncoder = null)
     {

+ 6 - 7
src/Symfony/Component/Security/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php

@@ -26,8 +26,7 @@ use Symfony\Component\Security\Authentication\Token\TokenInterface;
  * requests, as they should already be pre-authenticated. However, the
  * AuthenticationUserDetailsService implementation may still throw a UsernameNotFoundException, for example.
  *
- * @author Ruud Senden
- * @since 2.0
+ * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  */
 class PreAuthenticatedAuthenticationProvider implements AuthenticationProviderInterface
 {
@@ -37,8 +36,8 @@ class PreAuthenticatedAuthenticationProvider implements AuthenticationProviderIn
     /**
      * Constructor.
      *
-     * @param UserProviderInterface   $userProvider    A UserProviderInterface instance
-     * @param AccountCheckerInterface $accountChecker  An AccountCheckerInterface instance
+     * @param UserProviderInterface   $userProvider   A UserProviderInterface instance
+     * @param AccountCheckerInterface $accountChecker An AccountCheckerInterface instance
      */
     public function __construct(UserProviderInterface $userProvider, AccountCheckerInterface $accountChecker)
     {
@@ -51,9 +50,9 @@ class PreAuthenticatedAuthenticationProvider implements AuthenticationProviderIn
       */
      public function authenticate(TokenInterface $token)
      {
-        if (!$this->supports($token)) {
-            return null;
-        }
+         if (!$this->supports($token)) {
+             return null;
+         }
 
         if (null === $token->getUser()) {
             throw new BadCredentialsException('No pre-authenticated principal found in request.');

+ 2 - 2
src/Symfony/Component/Security/Authentication/Token/Token.php

@@ -31,7 +31,7 @@ abstract class Token implements TokenInterface
     /**
      * Constructor.
      *
-     * @param Role[] An array of roles
+     * @param Role[] $roles An array of roles
      */
     public function __construct(array $roles = array())
     {
@@ -47,7 +47,7 @@ abstract class Token implements TokenInterface
     /**
      * Adds a Role to the token.
      *
-     * @param RoleInterface A RoleInterface instance
+     * @param RoleInterface $role A RoleInterface instance
      */
     public function addRole(RoleInterface $role)
     {

+ 1 - 1
src/Symfony/Component/Security/Authentication/Token/TokenInterface.php

@@ -63,7 +63,7 @@ interface TokenInterface extends \Serializable
     /**
      * Sets the authenticated flag.
      *
-     * @param Boolean The authenticated flag
+     * @param Boolean $isAuthenticated The authenticated flag
      */
     function setAuthenticated($isAuthenticated);
 }

+ 1 - 1
src/Symfony/Component/Security/Authorization/AccessDecisionManagerInterface.php

@@ -26,8 +26,8 @@ interface AccessDecisionManagerInterface
      * Decides whether the access is possible or not.
      *
      * @param TokenInterface $token      A TokenInterface instance
-     * @param object         $object     The object to secure
      * @param array          $attributes An array of attributes associated with the method being invoked
+     * @param object         $object     The object to secure
      *
      * @return Boolean true if the access is granted, false otherwise
      */

+ 2 - 2
src/Symfony/Component/Security/Authorization/Voter/AuthenticatedVoter.php

@@ -21,8 +21,8 @@ use Symfony\Component\Security\Authentication\Token\AnonymousToken;
  */
 class AuthenticatedVoter implements VoterInterface
 {
-    const IS_AUTHENTICATED_FULLY = "IS_AUTHENTICATED_FULLY";
-    const IS_AUTHENTICATED_ANONYMOUSLY = "IS_AUTHENTICATED_ANONYMOUSLY";
+    const IS_AUTHENTICATED_FULLY = 'IS_AUTHENTICATED_FULLY';
+    const IS_AUTHENTICATED_ANONYMOUSLY = 'IS_AUTHENTICATED_ANONYMOUSLY';
 
     /**
      * {@inheritdoc}

+ 5 - 4
src/Symfony/Component/Security/Encoder/BasePasswordEncoder.php

@@ -46,12 +46,13 @@ abstract class BasePasswordEncoder implements PasswordEncoderInterface
     /**
      * Merges a password and a salt.
      *
-     * @param password the password to be used (can be <code>null</code>)
-     * @param salt the salt to be used (can be <code>null</code>)
+     * @param string $password the password to be used
+     * @param string $salt the salt to be used
      *
-     * @return a merged password and salt <code>String</code>
+     * @return string a merged password and salt
      */
-    protected function mergePasswordAndSalt($password, $salt) {
+    protected function mergePasswordAndSalt($password, $salt)
+    {
         if (empty($salt)) {
             return $password;
         }

+ 3 - 3
src/Symfony/Component/Security/Encoder/PasswordEncoderInterface.php

@@ -31,9 +31,9 @@ interface PasswordEncoderInterface
     /**
      * Checks a raw password against an encoded password.
      *
-     * @param string $encoded  An encoded password
-     * @param string $raw      A raw password
-     * @param string $salt     The salt
+     * @param string $encoded An encoded password
+     * @param string $raw     A raw password
+     * @param string $salt    The salt
      *
      * @return Boolean true if the password is valid, false otherwise
      */

+ 1 - 1
src/Symfony/Component/Security/Exception/AuthenticationCredentialsNotFoundException.php

@@ -15,7 +15,7 @@ namespace Symfony\Component\Security\Exception;
  * AuthenticationCredentialsNotFoundException is thrown when an authentication is rejected
  * because no Token is available.
  *
- * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
+ * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  */
 class AuthenticationCredentialsNotFoundException extends AuthenticationException
 {

+ 1 - 1
src/Symfony/Component/Security/Role/RoleHierarchyInterface.php

@@ -25,7 +25,7 @@ interface RoleHierarchyInterface
      * roles that are transitively reachable from them in the role
      * hierarchy.
      *
-     * @param  array $roles An array of directly assigned roles
+     * @param array $roles An array of directly assigned roles
      *
      * @return array An array of all reachable roles
      */

+ 4 - 4
src/Symfony/Component/Security/User/AccountChecker.php

@@ -33,7 +33,7 @@ class AccountChecker implements AccountCheckerInterface
         }
 
         if (!$account->isCredentialsNonExpired()) {
-            throw new CredentialsExpiredException("User credentials have expired.", $account);
+            throw new CredentialsExpiredException('User credentials have expired.', $account);
         }
     }
 
@@ -47,15 +47,15 @@ class AccountChecker implements AccountCheckerInterface
         }
 
         if (!$account->isAccountNonLocked()) {
-            throw new LockedException("User account is locked.", $account);
+            throw new LockedException('User account is locked.', $account);
         }
 
         if (!$account->isEnabled()) {
-            throw new DisabledException("User account is disabled.", $account);
+            throw new DisabledException('User account is disabled.', $account);
         }
 
         if (!$account->isAccountNonExpired()) {
-            throw new AccountExpiredException("User account has expired.", $account);
+            throw new AccountExpiredException('User account has expired.', $account);
         }
     }
 }