Skip to content

Commit

Permalink
PHP-CS-Fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienHarper committed Feb 6, 2019
1 parent 00761bc commit c4fa773
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/DoctrineAuditBundle/AuditReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getConfiguration(): AuditConfiguration
*
* @return AuditReader
*/
public function filterBy(string $filter): AuditReader
public function filterBy(string $filter): self
{
if (!\in_array($filter, [self::UPDATE, self::ASSOCIATE, self::DISSOCIATE, self::INSERT, self::REMOVE], true)) {
$this->filter = null;
Expand Down Expand Up @@ -98,7 +98,7 @@ public function getAudits($entity, int $id = null, int $page = 1, int $pageSize
{
$connection = $this->entityManager->getConnection();

$schema = isset($this->entityManager->getClassMetadata($entity)->table['schema']) ? $this->entityManager->getClassMetadata($entity)->table['schema'] . '.' : '';
$schema = isset($this->entityManager->getClassMetadata($entity)->table['schema']) ? $this->entityManager->getClassMetadata($entity)->table['schema'].'.' : '';

$auditTable = implode('', [
$schema,
Expand Down Expand Up @@ -143,7 +143,7 @@ public function getAudit($entity, int $id)
{
$connection = $this->entityManager->getConnection();

$schema = isset($this->entityManager->getClassMetadata($entity)->table['schema']) ? $this->entityManager->getClassMetadata($entity)->table['schema'] . '.' : '';
$schema = isset($this->entityManager->getClassMetadata($entity)->table['schema']) ? $this->entityManager->getClassMetadata($entity)->table['schema'].'.' : '';

$auditTable = implode('', [
$schema,
Expand Down
4 changes: 2 additions & 2 deletions src/DoctrineAuditBundle/Command/CleanAuditLogsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
"You are about to clean audits older than %d months (up to <comment>%s</comment>): %d entities involved.\n Do you want to proceed?",
$input->getArgument('keep'),
$until->format('Y-m-d'),
count($entities)
\count($entities)
);

$confirm = $input->getOption('no-confirm') ? true : $io->confirm($message, false);

if ($confirm) {
$progressBar = new ProgressBar($output, count($entities));
$progressBar = new ProgressBar($output, \count($entities));
$progressBar->setBarWidth(70);
$progressBar->setFormat("%message%\n".$progressBar->getFormatDefinition('debug'));

Expand Down
2 changes: 1 addition & 1 deletion src/DoctrineAuditBundle/Controller/AuditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace DH\DoctrineAuditBundle\Controller;

use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class AuditController extends AbstractController
{
Expand Down
5 changes: 3 additions & 2 deletions src/DoctrineAuditBundle/EventSubscriber/AuditSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function __construct(AuditConfiguration $configuration)

/**
* Handles soft-delete events from Gedmo\SoftDeleteable filter.
*
* @see https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html
*
* @param LifecycleEventArgs $args
Expand Down Expand Up @@ -489,13 +490,13 @@ private function value(EntityManager $em, Type $type, $value)
case Type::INTEGER:
case Type::SMALLINT:
$convertedValue = (string) $value;
break;

break;
case Type::FLOAT:
case Type::BOOLEAN:
$convertedValue = $type->convertToPHPValue($value, $platform);
break;

break;
default:
$convertedValue = $type->convertToDatabaseValue($value, $platform);
}
Expand Down
5 changes: 3 additions & 2 deletions src/DoctrineAuditBundle/User/TokenStorageUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace DH\DoctrineAuditBundle\User;

use Symfony\Component\Security\Core\Role\SwitchUserRole;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Core\User\UserInterface as BaseUserInterface;
use Symfony\Component\Security\Core\Role\SwitchUserRole;

class TokenStorageUserProvider implements UserProviderInterface
{
Expand All @@ -18,8 +18,8 @@ public function __construct(Security $security)
public function getUser(): ?UserInterface
{
$user = null;

$token = $this->security->getToken();

if (null !== $token) {
$tokenUser = $token->getUser();
if ($tokenUser instanceof BaseUserInterface) {
Expand All @@ -28,6 +28,7 @@ public function getUser(): ?UserInterface
foreach ($this->security->getToken()->getRoles() as $role) {
if ($role instanceof SwitchUserRole) {
$impersonatorUser = $role->getSource()->getUser();

break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/DoctrineAuditBundle/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
class User implements UserInterface
{
/**
* @var int|null
* @var null|int
*/
protected $id;

/**
* @var string|null
* @var null|string
*/
protected $username;

Expand Down
1 change: 1 addition & 0 deletions src/DoctrineAuditBundle/User/UserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
interface UserInterface
{
public function getId(): ?int;

public function getUsername(): ?string;
}

0 comments on commit c4fa773

Please sign in to comment.