diff --git a/Command/RoleCommand.php b/Command/RoleCommand.php index 6e56a4daa2..2e3edfecd3 100644 --- a/Command/RoleCommand.php +++ b/Command/RoleCommand.php @@ -59,6 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * @see Command + * @param boolean $super */ abstract protected function executeRoleCommand(UserManipulator $manipulator, OutputInterface $output, $username, $super, $role); diff --git a/Controller/ChangePasswordController.php b/Controller/ChangePasswordController.php index adc29760be..8ac7c1972c 100644 --- a/Controller/ChangePasswordController.php +++ b/Controller/ChangePasswordController.php @@ -62,6 +62,10 @@ protected function getRedirectionUrl(UserInterface $user) return $this->container->get('router')->generate('fos_user_profile_show'); } + /** + * @param string $action + * @param string $value + */ protected function setFlash($action, $value) { $this->container->get('session')->setFlash($action, $value); diff --git a/Controller/GroupController.php b/Controller/GroupController.php index e801c8504a..03b690efda 100644 --- a/Controller/GroupController.php +++ b/Controller/GroupController.php @@ -127,6 +127,10 @@ protected function getEngine() return $this->container->getParameter('fos_user.template.engine'); } + /** + * @param string $action + * @param string $value + */ protected function setFlash($action, $value) { $this->container->get('session')->setFlash($action, $value); diff --git a/Controller/ProfileController.php b/Controller/ProfileController.php index 3a9abd3d44..21f518492b 100644 --- a/Controller/ProfileController.php +++ b/Controller/ProfileController.php @@ -74,6 +74,10 @@ protected function getRedirectionUrl(UserInterface $user) return $this->container->get('router')->generate('fos_user_profile_show'); } + /** + * @param string $action + * @param string $value + */ protected function setFlash($action, $value) { $this->container->get('session')->setFlash($action, $value); diff --git a/Controller/RegistrationController.php b/Controller/RegistrationController.php index 67fefe5151..db620659ed 100644 --- a/Controller/RegistrationController.php +++ b/Controller/RegistrationController.php @@ -136,6 +136,10 @@ protected function authenticateUser(UserInterface $user, Response $response) } } + /** + * @param string $action + * @param string $value + */ protected function setFlash($action, $value) { $this->container->get('session')->setFlash($action, $value); diff --git a/Controller/ResettingController.php b/Controller/ResettingController.php index f24dbda419..70d2e7c3d0 100644 --- a/Controller/ResettingController.php +++ b/Controller/ResettingController.php @@ -170,6 +170,10 @@ protected function getObfuscatedEmail(UserInterface $user) return $email; } + /** + * @param string $action + * @param string $value + */ protected function setFlash($action, $value) { $this->container->get('session')->setFlash($action, $value); diff --git a/Controller/SecurityController.php b/Controller/SecurityController.php index 3b8f5a468f..40b0ed1c22 100644 --- a/Controller/SecurityController.php +++ b/Controller/SecurityController.php @@ -53,7 +53,7 @@ public function loginAction() * Renders the login template with the given parameters. Overwrite this function in * an extended controller to provide additional data for the login template. * - * @param array $data + * @param array $data * @return \Symfony\Component\HttpFoundation\Response */ protected function renderLogin(array $data) diff --git a/CouchDocument/GroupManager.php b/CouchDocument/GroupManager.php index 0cd08c73f1..e2d820d08f 100644 --- a/CouchDocument/GroupManager.php +++ b/CouchDocument/GroupManager.php @@ -2,7 +2,6 @@ namespace FOS\UserBundle\CouchDocument; -use FOS\UserBundle\Model\GroupInterface; use Doctrine\ODM\CouchDB\DocumentManager; use FOS\UserBundle\Doctrine\GroupManager as BaseGroupManager; diff --git a/CouchDocument/UserManager.php b/CouchDocument/UserManager.php index 6913a182d1..06d5fd298c 100644 --- a/CouchDocument/UserManager.php +++ b/CouchDocument/UserManager.php @@ -12,7 +12,6 @@ namespace FOS\UserBundle\CouchDocument; use Doctrine\ODM\CouchDB\DocumentManager; -use FOS\UserBundle\Model\UserInterface; use FOS\UserBundle\Doctrine\UserManager as BaseUserManager; use FOS\UserBundle\Util\CanonicalizerInterface; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; diff --git a/Document/GroupManager.php b/Document/GroupManager.php index 7a8a830af2..d7404b7c5f 100644 --- a/Document/GroupManager.php +++ b/Document/GroupManager.php @@ -11,7 +11,6 @@ namespace FOS\UserBundle\Document; -use FOS\UserBundle\Model\GroupInterface; use Doctrine\ODM\MongoDB\DocumentManager; use FOS\UserBundle\Doctrine\GroupManager as BaseGroupManager; diff --git a/Document/UserManager.php b/Document/UserManager.php index e52f783042..fff96e534a 100644 --- a/Document/UserManager.php +++ b/Document/UserManager.php @@ -12,7 +12,6 @@ namespace FOS\UserBundle\Document; use Doctrine\ODM\MongoDB\DocumentManager; -use FOS\UserBundle\Model\UserInterface; use FOS\UserBundle\Doctrine\UserManager as BaseUserManager; use FOS\UserBundle\Util\CanonicalizerInterface; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; diff --git a/Entity/GroupManager.php b/Entity/GroupManager.php index 06b57cd299..8b079bfb4e 100644 --- a/Entity/GroupManager.php +++ b/Entity/GroupManager.php @@ -11,7 +11,6 @@ namespace FOS\UserBundle\Entity; -use FOS\UserBundle\Model\GroupInterface; use Doctrine\ORM\EntityManager; use FOS\UserBundle\Doctrine\GroupManager as BaseGroupManager; diff --git a/Entity/UserManager.php b/Entity/UserManager.php index fd58264623..21f9b8d8c9 100644 --- a/Entity/UserManager.php +++ b/Entity/UserManager.php @@ -12,7 +12,6 @@ namespace FOS\UserBundle\Entity; use Doctrine\ORM\EntityManager; -use FOS\UserBundle\Model\UserInterface; use FOS\UserBundle\Doctrine\UserManager as BaseUserManager; use FOS\UserBundle\Util\CanonicalizerInterface; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; diff --git a/Form/DataTransformer/UserToUsernameTransformer.php b/Form/DataTransformer/UserToUsernameTransformer.php index aee52dc6d1..401ef7b13d 100644 --- a/Form/DataTransformer/UserToUsernameTransformer.php +++ b/Form/DataTransformer/UserToUsernameTransformer.php @@ -29,7 +29,7 @@ public function __construct(UserManagerInterface $userManager) * * @param mixed $value UserInterface instance * - * @return string Username + * @return null|string Username * * @throws UnexpectedTypeException if the given value is not a UserInterface instance */ diff --git a/Form/Handler/ChangePasswordFormHandler.php b/Form/Handler/ChangePasswordFormHandler.php index e92f6ff66c..2b78e3fdf9 100644 --- a/Form/Handler/ChangePasswordFormHandler.php +++ b/Form/Handler/ChangePasswordFormHandler.php @@ -30,6 +30,9 @@ public function __construct(FormInterface $form, Request $request, UserManagerIn $this->userManager = $userManager; } + /** + * @return string + */ public function getNewPassword() { return $this->form->getData()->new; diff --git a/Form/Handler/RegistrationFormHandler.php b/Form/Handler/RegistrationFormHandler.php index 2a38c7a35b..3ea70fa0b2 100644 --- a/Form/Handler/RegistrationFormHandler.php +++ b/Form/Handler/RegistrationFormHandler.php @@ -35,6 +35,9 @@ public function __construct(FormInterface $form, Request $request, UserManagerIn $this->tokenGenerator = $tokenGenerator; } + /** + * @param boolean $confirmation + */ public function process($confirmation = false) { $user = $this->createUser(); @@ -53,6 +56,9 @@ public function process($confirmation = false) return false; } + /** + * @param boolean $confirmation + */ protected function onSuccess(UserInterface $user, $confirmation) { if ($confirmation) { @@ -69,6 +75,9 @@ protected function onSuccess(UserInterface $user, $confirmation) $this->userManager->updateUser($user); } + /** + * @return boolean|UserInterface + */ protected function createUser() { return $this->userManager->createUser(); diff --git a/Form/Handler/ResettingFormHandler.php b/Form/Handler/ResettingFormHandler.php index 237352e254..fab1c2884d 100644 --- a/Form/Handler/ResettingFormHandler.php +++ b/Form/Handler/ResettingFormHandler.php @@ -30,6 +30,9 @@ public function __construct(FormInterface $form, Request $request, UserManagerIn $this->userManager = $userManager; } + /** + * @return string + */ public function getNewPassword() { return $this->form->getData()->new; diff --git a/Mailer/Mailer.php b/Mailer/Mailer.php index dec6d93219..37b383a7f3 100644 --- a/Mailer/Mailer.php +++ b/Mailer/Mailer.php @@ -56,6 +56,10 @@ public function sendResettingEmailMessage(UserInterface $user) $this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], $user->getEmail()); } + /** + * @param string $renderedTemplate + * @param string $toEmail + */ protected function sendEmailMessage($renderedTemplate, $fromEmail, $toEmail) { // Render the email, use the first line as the subject, and the rest as the body diff --git a/Mailer/MailerInterface.php b/Mailer/MailerInterface.php index 433debaafa..3a491f8076 100644 --- a/Mailer/MailerInterface.php +++ b/Mailer/MailerInterface.php @@ -21,14 +21,16 @@ interface MailerInterface /** * Send an email to a user to confirm the account creation * - * @param UserInterface $user + * @param UserInterface $user + * @return void */ public function sendConfirmationEmailMessage(UserInterface $user); /** * Send an email to a user to confirm the password reset * - * @param UserInterface $user + * @param UserInterface $user + * @return void */ public function sendResettingEmailMessage(UserInterface $user); } diff --git a/Mailer/TwigSwiftMailer.php b/Mailer/TwigSwiftMailer.php index bab2312fe4..d2b4577ba0 100644 --- a/Mailer/TwigSwiftMailer.php +++ b/Mailer/TwigSwiftMailer.php @@ -56,6 +56,10 @@ public function sendResettingEmailMessage(UserInterface $user) $this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], $user->getEmail()); } + /** + * @param array $context + * @param string $toEmail + */ protected function sendMessage($templateName, $context, $fromEmail, $toEmail) { $template = $this->twig->loadTemplate($templateName); diff --git a/Model/Group.php b/Model/Group.php index cd82ebf41b..b2eebe60d7 100644 --- a/Model/Group.php +++ b/Model/Group.php @@ -50,6 +50,9 @@ public function getName() return $this->name; } + /** + * @param string $role + */ public function hasRole($role) { return in_array(strtoupper($role), $this->roles, true); diff --git a/Model/GroupInterface.php b/Model/GroupInterface.php index 6251c44a93..883d71f6c6 100644 --- a/Model/GroupInterface.php +++ b/Model/GroupInterface.php @@ -17,19 +17,42 @@ */ interface GroupInterface { + /** + * @return Group + */ public function addRole($role); public function getId(); + /** + * @return string + */ public function getName(); + /** + * @return boolean + */ public function hasRole($role); + /** + * @return array + */ public function getRoles(); + /** + * @return Group + */ public function removeRole($role); + /** + * @param string $name + * + * @return Group + */ public function setName($name); + /** + * @return Group + */ public function setRoles(array $roles); } diff --git a/Model/GroupManagerInterface.php b/Model/GroupManagerInterface.php index c67119c3bd..cadfd51cdf 100644 --- a/Model/GroupManagerInterface.php +++ b/Model/GroupManagerInterface.php @@ -74,7 +74,8 @@ public function getClass(); /** * Updates a group. * - * @param GroupInterface $group + * @param GroupInterface $group + * @return void */ public function updateGroup(GroupInterface $group); } diff --git a/Model/GroupableInterface.php b/Model/GroupableInterface.php index 3c481d9223..b42f236abf 100644 --- a/Model/GroupableInterface.php +++ b/Model/GroupableInterface.php @@ -44,14 +44,16 @@ public function hasGroup($name); /** * Add a group to the user groups. * - * @param GroupInterface $group + * @param GroupInterface $group + * @return User */ public function addGroup(GroupInterface $group); /** * Remove a group from the user groups. * - * @param GroupInterface $group + * @param GroupInterface $group + * @return User */ public function removeGroup(GroupInterface $group); } diff --git a/Model/User.php b/Model/User.php index ce8f877c4b..a7b46c8c2c 100644 --- a/Model/User.php +++ b/Model/User.php @@ -277,7 +277,7 @@ public function getPassword() /** * Gets the plain password. * - * @return string + * @return null|string */ public function getPlainPassword() { @@ -434,7 +434,7 @@ public function isSuperAdmin() * * Useful when not hydrating all fields. * - * @param UserInterface $user + * @param null|UserInterface $user * * @return Boolean */ @@ -665,7 +665,7 @@ public function setConfirmationToken($confirmationToken) /** * Sets the timestamp that the user requested a password reset. * - * @param \DateTime $date + * @param null|\DateTime $date * * @return User */ @@ -679,7 +679,7 @@ public function setPasswordRequestedAt(\DateTime $date = null) /** * Gets the timestamp that the user requested a password reset. * - * @return \DateTime + * @return null|\DateTime */ public function getPasswordRequestedAt() { @@ -722,7 +722,7 @@ public function setRoles(array $roles) /** * Gets the groups granted to the user. * - * @return Collection + * @return ArrayCollection */ public function getGroups() { diff --git a/Model/UserInterface.php b/Model/UserInterface.php index 0f4ea4b7fe..53097b3c9c 100644 --- a/Model/UserInterface.php +++ b/Model/UserInterface.php @@ -25,7 +25,8 @@ interface UserInterface extends AdvancedUserInterface, \Serializable /** * Sets the username. * - * @param string $username + * @param string $username + * @return User */ public function setUsername($username); @@ -39,7 +40,8 @@ public function getUsernameCanonical(); /** * Sets the canonical username. * - * @param string $usernameCanonical + * @param string $usernameCanonical + * @return User */ public function setUsernameCanonical($usernameCanonical); @@ -53,7 +55,8 @@ public function getEmail(); /** * Sets the email. * - * @param string $email + * @param string $email + * @return User */ public function setEmail($email); @@ -67,7 +70,8 @@ public function getEmailCanonical(); /** * Set the canonical email. * - * @param string $emailCanonical + * @param string $emailCanonical + * @return User */ public function setEmailCanonical($emailCanonical); @@ -81,14 +85,16 @@ public function getPlainPassword(); /** * Sets the plain password. * - * @param string $password + * @param string $password + * @return User|\FOS\UserBundle\Propel\User */ public function setPlainPassword($password); /** * Sets the hashed password. * - * @param string $password + * @param string $password + * @return User */ public function setPassword($password); @@ -104,28 +110,31 @@ public function isSuperAdmin(); * * Useful when not hydrating all fields. * - * @param UserInterface $user + * @param null|UserInterface $user * * @return Boolean */ public function isUser(UserInterface $user = null); /** - * @param Boolean $boolean + * @param Boolean $boolean + * @return User */ public function setEnabled($boolean); /** * Sets the locking status of the user. * - * @param Boolean $boolean + * @param Boolean $boolean + * @return User */ public function setLocked($boolean); /** * Sets the super admin status * - * @param Boolean $boolean + * @param Boolean $boolean + * @return User|\FOS\UserBundle\Propel\User */ public function setSuperAdmin($boolean); @@ -139,14 +148,16 @@ public function getConfirmationToken(); /** * Sets the confirmation token * - * @param string $confirmationToken + * @param string $confirmationToken + * @return User */ public function setConfirmationToken($confirmationToken); /** * Sets the timestamp that the user requested a password reset. * - * @param \DateTime $date + * @param null|\DateTime $date + * @return User */ public function setPasswordRequestedAt(\DateTime $date = null); @@ -162,7 +173,8 @@ public function isPasswordRequestNonExpired($ttl); /** * Sets the last login time * - * @param \DateTime $time + * @param \DateTime $time + * @return User */ public function setLastLogin(\DateTime $time); @@ -185,21 +197,24 @@ public function hasRole($role); * * This overwrites any previous roles. * - * @param array $roles + * @param array $roles + * @return User */ public function setRoles(array $roles); /** * Adds a role to the user. * - * @param string $role + * @param string $role + * @return User|\FOS\UserBundle\Propel\User */ public function addRole($role); /** * Removes a role to the user. * - * @param string $role + * @param string $role + * @return void */ public function removeRole($role); } diff --git a/Model/UserManagerInterface.php b/Model/UserManagerInterface.php index 8c5f53fc42..5a4dd68841 100644 --- a/Model/UserManagerInterface.php +++ b/Model/UserManagerInterface.php @@ -36,7 +36,8 @@ public function createUser(); /** * Deletes a user. * - * @param UserInterface $user + * @param UserInterface $user + * @return void */ public function deleteUser(UserInterface $user); @@ -102,28 +103,32 @@ public function getClass(); /** * Reloads a user. * - * @param UserInterface $user + * @param UserInterface $user + * @return void */ public function reloadUser(UserInterface $user); /** * Updates a user. * - * @param UserInterface $user + * @param UserInterface $user + * @return void */ public function updateUser(UserInterface $user); /** * Updates the canonical username and email fields for a user. * - * @param UserInterface $user + * @param UserInterface $user + * @return void */ public function updateCanonicalFields(UserInterface $user); /** * Updates a user password if a plain password is set. * - * @param UserInterface $user + * @param UserInterface $user + * @return void */ public function updatePassword(UserInterface $user); } diff --git a/Propel/GroupManager.php b/Propel/GroupManager.php index 1abaa020a5..5e608535e0 100644 --- a/Propel/GroupManager.php +++ b/Propel/GroupManager.php @@ -93,7 +93,7 @@ public function updateGroup(GroupInterface $group) /** * Create the propel query class corresponding to your queryclass * - * @return \ModelCriteria the queryClass + * @return string the queryClass */ protected function createQuery() { diff --git a/Propel/UserManager.php b/Propel/UserManager.php index 812f5f3568..bf539901c3 100644 --- a/Propel/UserManager.php +++ b/Propel/UserManager.php @@ -107,7 +107,7 @@ public function updateUser(UserInterface $user) /** * Create the propel query class corresponding to your queryclass * - * @return \ModelCriteria the queryClass + * @return string the queryClass */ protected function createQuery() { diff --git a/Security/LoginManagerInterface.php b/Security/LoginManagerInterface.php index 8dc9daeb53..678f1da08b 100644 --- a/Security/LoginManagerInterface.php +++ b/Security/LoginManagerInterface.php @@ -16,5 +16,8 @@ interface LoginManagerInterface { + /** + * @return void + */ public function loginUser($firewallName, UserInterface $user, Response $response = null); } diff --git a/Tests/DependencyInjection/FOSUserExtensionTest.php b/Tests/DependencyInjection/FOSUserExtensionTest.php index 213bf45d3a..9d81f6ede5 100644 --- a/Tests/DependencyInjection/FOSUserExtensionTest.php +++ b/Tests/DependencyInjection/FOSUserExtensionTest.php @@ -294,7 +294,7 @@ public function testUserLoadUtilService() } /** - * @return ContainerBuilder + * @return void */ protected function createEmptyConfiguration() { @@ -306,7 +306,7 @@ protected function createEmptyConfiguration() } /** - * @return ContainerBuilder + * @return void */ protected function createFullConfiguration() { @@ -320,7 +320,7 @@ protected function createFullConfiguration() /** * getEmptyConfig * - * @return array + * @return mixed */ protected function getEmptyConfig() { @@ -401,21 +401,35 @@ protected function getFullConfig() return $parser->parse($yaml); } + /** + * @param string $value + * @param string $key + */ private function assertAlias($value, $key) { $this->assertEquals($value, (string) $this->configuration->getAlias($key), sprintf('%s alias is correct', $key)); } + /** + * @param string|null|array|integer|boolean $value + * @param string $key + */ private function assertParameter($value, $key) { $this->assertEquals($value, $this->configuration->getParameter($key), sprintf('%s parameter is correct', $key)); } + /** + * @param string $id + */ private function assertHasDefinition($id) { $this->assertTrue(($this->configuration->hasDefinition($id) ?: $this->configuration->hasAlias($id))); } + /** + * @param string $id + */ private function assertNotHasDefinition($id) { $this->assertFalse(($this->configuration->hasDefinition($id) ?: $this->configuration->hasAlias($id))); diff --git a/Tests/Doctrine/UserManagerTest.php b/Tests/Doctrine/UserManagerTest.php index b84b9fa8ec..99f107ee4c 100644 --- a/Tests/Doctrine/UserManagerTest.php +++ b/Tests/Doctrine/UserManagerTest.php @@ -78,6 +78,11 @@ public function testUpdateUser() $this->userManager->updateUser($user); } + /** + * @param \PHPUnit_Framework_MockObject_MockObject $encoderFactory + * @param \PHPUnit_Framework_MockObject_MockObject $canonicalizer + * @param \PHPUnit_Framework_MockObject_MockObject $objectManager + */ protected function createUserManager($encoderFactory, $canonicalizer, $objectManager, $userClass) { return new UserManager($encoderFactory, $canonicalizer, $canonicalizer, $objectManager, $userClass); @@ -86,6 +91,7 @@ protected function createUserManager($encoderFactory, $canonicalizer, $objectMan protected function getUser() { $userClass = static::USER_CLASS; + return new $userClass(); } } diff --git a/Tests/Model/UserTest.php b/Tests/Model/UserTest.php index b098e94972..bce3d61b8e 100644 --- a/Tests/Model/UserTest.php +++ b/Tests/Model/UserTest.php @@ -79,7 +79,7 @@ public function testFalseHasRole() } /** - * @return User + * @return \PHPUnit_Framework_MockObject_MockObject */ protected function getUser() { diff --git a/Util/CanonicalizerInterface.php b/Util/CanonicalizerInterface.php index 4abd3b3311..feb32f0c54 100644 --- a/Util/CanonicalizerInterface.php +++ b/Util/CanonicalizerInterface.php @@ -13,5 +13,10 @@ interface CanonicalizerInterface { + /** + * @param string $string + * + * @return string + */ public function canonicalize($string); } diff --git a/Util/TokenGeneratorInterface.php b/Util/TokenGeneratorInterface.php index dc8f822231..17493d0246 100644 --- a/Util/TokenGeneratorInterface.php +++ b/Util/TokenGeneratorInterface.php @@ -13,5 +13,8 @@ interface TokenGeneratorInterface { + /** + * @return string + */ public function generateToken(); }