Skip to content

Commit

Permalink
PHP CS
Browse files Browse the repository at this point in the history
  • Loading branch information
soullivaneuh committed Dec 4, 2017
1 parent 988d32f commit ae6d94f
Show file tree
Hide file tree
Showing 68 changed files with 278 additions and 143 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Added missing `swiftmailer` dependency

### Changed
- Risky code change for PHP 7
- Made `sonata-project/google-authenticator` an optional dependency
- Moved public methods of `User` to `UserInterface`
- Lowered upper composer dependencies
Expand Down
2 changes: 2 additions & 0 deletions src/Admin/Document/GroupAdmin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Admin/Document/UserAdmin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Admin/Entity/GroupAdmin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Admin/Entity/UserAdmin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down
8 changes: 5 additions & 3 deletions src/Admin/Model/GroupAdmin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down Expand Up @@ -39,7 +41,7 @@ public function getNewInstance()
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
protected function configureListFields(ListMapper $listMapper): void
{
$listMapper
->addIdentifier('name')
Expand All @@ -50,7 +52,7 @@ protected function configureListFields(ListMapper $listMapper)
/**
* {@inheritdoc}
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
protected function configureDatagridFilters(DatagridMapper $datagridMapper): void
{
$datagridMapper
->add('name')
Expand All @@ -60,7 +62,7 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper)
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
protected function configureFormFields(FormMapper $formMapper): void
{
$formMapper
->tab('Group')
Expand Down
14 changes: 8 additions & 6 deletions src/Admin/Model/UserAdmin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down Expand Up @@ -64,7 +66,7 @@ public function getExportFields()
/**
* {@inheritdoc}
*/
public function preUpdate($user)
public function preUpdate($user): void
{
$this->getUserManager()->updateCanonicalFields($user);
$this->getUserManager()->updatePassword($user);
Expand All @@ -73,7 +75,7 @@ public function preUpdate($user)
/**
* @param UserManagerInterface $userManager
*/
public function setUserManager(UserManagerInterface $userManager)
public function setUserManager(UserManagerInterface $userManager): void
{
$this->userManager = $userManager;
}
Expand All @@ -89,7 +91,7 @@ public function getUserManager()
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
protected function configureListFields(ListMapper $listMapper): void
{
$listMapper
->addIdentifier('username')
Expand All @@ -109,7 +111,7 @@ protected function configureListFields(ListMapper $listMapper)
/**
* {@inheritdoc}
*/
protected function configureDatagridFilters(DatagridMapper $filterMapper)
protected function configureDatagridFilters(DatagridMapper $filterMapper): void
{
$filterMapper
->add('id')
Expand All @@ -122,7 +124,7 @@ protected function configureDatagridFilters(DatagridMapper $filterMapper)
/**
* {@inheritdoc}
*/
protected function configureShowFields(ShowMapper $showMapper)
protected function configureShowFields(ShowMapper $showMapper): void
{
$showMapper
->with('General')
Expand Down Expand Up @@ -161,7 +163,7 @@ protected function configureShowFields(ShowMapper $showMapper)
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
protected function configureFormFields(FormMapper $formMapper): void
{
// define group zoning
$formMapper
Expand Down
6 changes: 4 additions & 2 deletions src/Command/TwoStepVerificationCommand.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand All @@ -22,7 +24,7 @@ class TwoStepVerificationCommand extends ContainerAwareCommand
/**
* {@inheritdoc}
*/
public function configure()
public function configure(): void
{
$this->setName('sonata:user:two-step-verification');
$this->addArgument('username', InputArgument::REQUIRED, 'The username to protect with a two step verification process');
Expand All @@ -33,7 +35,7 @@ public function configure()
/**
* {@inheritdoc}
*/
public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): void
{
if (!$this->getContainer()->has('sonata.user.google.authenticator.provider')) {
throw new \RuntimeException('Two Step Verification process is not enabled');
Expand Down
4 changes: 3 additions & 1 deletion src/Controller/AdminResettingController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down Expand Up @@ -173,7 +175,7 @@ public function resetAction(Request $request, $token)
*
* @param UserInterface $user
*/
private function sendResettingEmailMessage(UserInterface $user)
private function sendResettingEmailMessage(UserInterface $user): void
{
$url = $this->generateUrl('sonata_user_admin_resetting_reset', [
'token' => $user->getConfirmationToken(),
Expand Down
6 changes: 4 additions & 2 deletions src/Controller/AdminSecurityController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down Expand Up @@ -73,12 +75,12 @@ public function loginAction(Request $request)
]);
}

public function checkAction()
public function checkAction(): void
{
throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.');
}

public function logoutAction()
public function logoutAction(): void
{
throw new \RuntimeException('You must activate the logout in your security firewall configuration.');
}
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/Api/GroupController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/Api/UserController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand All @@ -25,7 +27,7 @@ class GlobalVariablesCompilerPass implements CompilerPassInterface
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
$container->getDefinition('twig')
->addMethodCall('addGlobal', ['sonata_user', new Reference('sonata.user.twig.global')]);
Expand Down
2 changes: 2 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down
20 changes: 11 additions & 9 deletions src/DependencyInjection/SonataUserExtension.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down Expand Up @@ -31,7 +33,7 @@ class SonataUserExtension extends Extension implements PrependExtensionInterface
/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container)
public function prepend(ContainerBuilder $container): void
{
if ($container->hasExtension('twig')) {
// add custom form widgets
Expand All @@ -42,7 +44,7 @@ public function prepend(ContainerBuilder $container)
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$processor = new Processor();
$configuration = new Configuration();
Expand Down Expand Up @@ -165,7 +167,7 @@ public function configureGoogleAuthenticator($config, ContainerBuilder $containe
* @param array $config
* @param ContainerBuilder $container
*/
public function configureClass($config, ContainerBuilder $container)
public function configureClass($config, ContainerBuilder $container): void
{
if ('orm' === $config['manager_type']) {
$modelType = 'entity';
Expand All @@ -183,7 +185,7 @@ public function configureClass($config, ContainerBuilder $container)
* @param array $config
* @param ContainerBuilder $container
*/
public function configureAdminClass($config, ContainerBuilder $container)
public function configureAdminClass($config, ContainerBuilder $container): void
{
$container->setParameter('sonata.user.admin.user.class', $config['admin']['user']['class']);
$container->setParameter('sonata.user.admin.group.class', $config['admin']['group']['class']);
Expand All @@ -193,7 +195,7 @@ public function configureAdminClass($config, ContainerBuilder $container)
* @param array $config
* @param ContainerBuilder $container
*/
public function configureTranslationDomain($config, ContainerBuilder $container)
public function configureTranslationDomain($config, ContainerBuilder $container): void
{
$container->setParameter('sonata.user.admin.user.translation_domain', $config['admin']['user']['translation']);
$container->setParameter('sonata.user.admin.group.translation_domain', $config['admin']['group']['translation']);
Expand All @@ -203,7 +205,7 @@ public function configureTranslationDomain($config, ContainerBuilder $container)
* @param array $config
* @param ContainerBuilder $container
*/
public function configureController($config, ContainerBuilder $container)
public function configureController($config, ContainerBuilder $container): void
{
$container->setParameter('sonata.user.admin.user.controller', $config['admin']['user']['controller']);
$container->setParameter('sonata.user.admin.group.controller', $config['admin']['group']['controller']);
Expand All @@ -212,7 +214,7 @@ public function configureController($config, ContainerBuilder $container)
/**
* @param array $config
*/
public function registerDoctrineMapping(array $config)
public function registerDoctrineMapping(array $config): void
{
foreach ($config['class'] as $type => $class) {
if (!class_exists($class)) {
Expand Down Expand Up @@ -250,7 +252,7 @@ public function registerDoctrineMapping(array $config)
* @param ContainerBuilder $container
* @param $managerType
*/
protected function aliasManagers(ContainerBuilder $container, $managerType)
protected function aliasManagers(ContainerBuilder $container, $managerType): void
{
$container->setAlias('sonata.user.user_manager', sprintf('sonata.user.%s.user_manager', $managerType));
$container->setAlias('sonata.user.group_manager', sprintf('sonata.user.%s.group_manager', $managerType));
Expand All @@ -259,7 +261,7 @@ protected function aliasManagers(ContainerBuilder $container, $managerType)
/**
* @param array $config
*/
private function checkManagerTypeToModelTypeMapping(array $config)
private function checkManagerTypeToModelTypeMapping(array $config): void
{
$managerType = $config['manager_type'];

Expand Down
2 changes: 2 additions & 0 deletions src/Document/BaseGroup.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down
6 changes: 4 additions & 2 deletions src/Document/BaseUser.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand All @@ -22,7 +24,7 @@ class BaseUser extends AbstractedUser implements UserInterface
/**
* Hook on pre-persist operations.
*/
public function prePersist()
public function prePersist(): void
{
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
Expand All @@ -31,7 +33,7 @@ public function prePersist()
/**
* Hook on pre-update operations.
*/
public function preUpdate()
public function preUpdate(): void
{
$this->updatedAt = new \DateTime();
}
Expand Down
4 changes: 3 additions & 1 deletion src/Document/GroupManager.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down Expand Up @@ -30,7 +32,7 @@ public function findGroupsBy(array $criteria = null, array $orderBy = null, $lim
/**
* {@inheritdoc}
*/
public function getPager(array $criteria, $page, $limit = 10, array $sort = [])
public function getPager(array $criteria, $page, $limit = 10, array $sort = []): void
{
new \RuntimeException('method not implemented');
}
Expand Down
Loading

0 comments on commit ae6d94f

Please sign in to comment.