Skip to content

Commit

Permalink
PHP-CS-Fixer (3.48.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienHarper committed Jan 21, 2024
1 parent fc4919a commit 56e75a5
Show file tree
Hide file tree
Showing 36 changed files with 147 additions and 100 deletions.
6 changes: 4 additions & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?php

declare(strict_types=1);
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = (new PhpCsFixer\Finder())
$finder = (new Finder())
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->append([__FILE__])
;

return (new PhpCsFixer\Config())
return (new Config())
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
Expand Down
2 changes: 1 addition & 1 deletion src/Auditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class Auditor
*/
private array $auditProviders = [];

private \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher;
private EventDispatcherInterface $dispatcher;

/**
* @throws ReflectionException
Expand Down
28 changes: 15 additions & 13 deletions tests/AuditorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
use DH\Auditor\Tests\Fixtures\Provider\StorageAndAuditProvider;
use DH\Auditor\Tests\Fixtures\Provider\StorageNoAuditProvider;
use DH\Auditor\Tests\Traits\AuditorTrait;
use PHPUnit\Framework\Attributes\Depends;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;

/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\Small]
#[Small]
final class AuditorTest extends TestCase
{
use AuditorTrait;
Expand All @@ -38,7 +40,7 @@ public function testGetProviders(): void
self::assertCount(0, $auditor->getProviders(), 'Auditor::$providers is an empty array by default.');
}

#[\PHPUnit\Framework\Attributes\Depends('testGetProviders')]
#[Depends('testGetProviders')]
public function testRegisterProvider(): void
{
$auditor = $this->createAuditor();
Expand All @@ -54,7 +56,7 @@ public function testRegisterProvider(): void
self::assertSame($auditor, $provider->getAuditor(), 'Provider is properly registered.');
}

#[\PHPUnit\Framework\Attributes\Depends('testRegisterProvider')]
#[Depends('testRegisterProvider')]
public function testHasProvider(): void
{
$auditor = $this->createAuditor();
Expand All @@ -66,7 +68,7 @@ public function testHasProvider(): void
self::assertFalse($auditor->hasProvider('UNKNOWN_PROVIDER'));
}

#[\PHPUnit\Framework\Attributes\Depends('testRegisterProvider')]
#[Depends('testRegisterProvider')]
public function testRegisterNoStorageNoAuditProvider(): void
{
$auditor = $this->createAuditor();
Expand All @@ -76,7 +78,7 @@ public function testRegisterNoStorageNoAuditProvider(): void
$auditor->registerProvider($provider);
}

#[\PHPUnit\Framework\Attributes\Depends('testRegisterProvider')]
#[Depends('testRegisterProvider')]
public function testGetProvider(): void
{
$auditor = $this->createAuditor();
Expand All @@ -90,7 +92,7 @@ public function testGetProvider(): void
$auditor->getProvider('UNKNOWN_PROVIDER');
}

#[\PHPUnit\Framework\Attributes\Depends('testRegisterProvider')]
#[Depends('testRegisterProvider')]
public function testIsStorageEnabled(): void
{
$auditor = $this->createAuditor();
Expand All @@ -107,7 +109,7 @@ public function testIsStorageEnabled(): void
$auditor->isStorageEnabled($provider3);
}

#[\PHPUnit\Framework\Attributes\Depends('testIsStorageEnabled')]
#[Depends('testIsStorageEnabled')]
public function testDisableStorage(): void
{
$auditor = $this->createAuditor();
Expand All @@ -127,7 +129,7 @@ public function testDisableStorage(): void
$auditor->disableStorage($provider3);
}

#[\PHPUnit\Framework\Attributes\Depends('testIsStorageEnabled')]
#[Depends('testIsStorageEnabled')]
public function testDisableStorageWhenOnlyOneIsEnabled(): void
{
$auditor = $this->createAuditor();
Expand All @@ -139,7 +141,7 @@ public function testDisableStorageWhenOnlyOneIsEnabled(): void
$auditor->disableStorage($provider);
}

#[\PHPUnit\Framework\Attributes\Depends('testDisableStorage')]
#[Depends('testDisableStorage')]
public function testEnableStorage(): void
{
$auditor = $this->createAuditor();
Expand All @@ -159,7 +161,7 @@ public function testEnableStorage(): void
$auditor->enableStorage($provider3);
}

#[\PHPUnit\Framework\Attributes\Depends('testRegisterProvider')]
#[Depends('testRegisterProvider')]
public function testIsAuditingEnabled(): void
{
$auditor = $this->createAuditor();
Expand All @@ -176,7 +178,7 @@ public function testIsAuditingEnabled(): void
$auditor->isAuditingEnabled($provider3);
}

#[\PHPUnit\Framework\Attributes\Depends('testIsStorageEnabled')]
#[Depends('testIsStorageEnabled')]
public function testDisableAuditing(): void
{
$auditor = $this->createAuditor();
Expand All @@ -196,7 +198,7 @@ public function testDisableAuditing(): void
$auditor->disableAuditing($provider3);
}

#[\PHPUnit\Framework\Attributes\Depends('testIsStorageEnabled')]
#[Depends('testIsStorageEnabled')]
public function testDisableAuditingWhenOnlyOneIsEnabled(): void
{
$auditor = $this->createAuditor();
Expand All @@ -208,7 +210,7 @@ public function testDisableAuditingWhenOnlyOneIsEnabled(): void
$auditor->disableAuditing($provider);
}

#[\PHPUnit\Framework\Attributes\Depends('testDisableStorage')]
#[Depends('testDisableStorage')]
public function testEnableAuditing(): void
{
$auditor = $this->createAuditor();
Expand Down
3 changes: 2 additions & 1 deletion tests/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
namespace DH\Auditor\Tests;

use DH\Auditor\Tests\Traits\AuditorConfigurationTrait;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;

/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\Small]
#[Small]
final class ConfigurationTest extends TestCase
{
use AuditorConfigurationTrait;
Expand Down
3 changes: 2 additions & 1 deletion tests/Event/LifecycleEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
use DH\Auditor\EventSubscriber\AuditEventSubscriber;
use DH\Auditor\Exception\InvalidArgumentException;
use DH\Auditor\Tests\Traits\AuditorTrait;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;

/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\Small]
#[Small]
final class LifecycleEventTest extends TestCase
{
use AuditorTrait;
Expand Down
3 changes: 2 additions & 1 deletion tests/EventSubscriber/AuditEventSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
use DH\Auditor\EventSubscriber\AuditEventSubscriber;
use DH\Auditor\Tests\Fixtures\EventSubscriber\CustomAuditEventSubscriber;
use DH\Auditor\Tests\Traits\AuditorTrait;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;

/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\Small]
#[Small]
final class AuditEventSubscriberTest extends TestCase
{
use AuditorTrait;
Expand Down
3 changes: 2 additions & 1 deletion tests/Model/EntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

use DateTimeImmutable;
use DH\Auditor\Model\Entry;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;
use ReflectionClass;

/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\Small]
#[Small]
final class EntryTest extends TestCase
{
public function testAccessors(): void
Expand Down
3 changes: 2 additions & 1 deletion tests/Model/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
namespace DH\Auditor\Tests\Model;

use DH\Auditor\Model\Transaction;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;

/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\Small]
#[Small]
final class TransactionTest extends TestCase
{
protected function setUp(): void {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

use DH\Auditor\Provider\Doctrine\Auditing\Annotation\AnnotationLoader;
use DH\Auditor\Tests\Provider\Doctrine\Traits\EntityManagerInterfaceTrait;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;

/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\Small]
#[Small]
final class AnnotationLoaderTest extends TestCase
{
use EntityManagerInterfaceTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
use DH\Auditor\Tests\Provider\Doctrine\Fixtures\Entity\Standard\Blog\Tag;
use DH\Auditor\Tests\Provider\Doctrine\Traits\Schema\DefaultSchemaSetupTrait;
use DH\Auditor\Tests\Traits\ReflectionTrait;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;

/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\Small]
#[Small]
final class TransactionProcessorTest extends TestCase
{
use DefaultSchemaSetupTrait;
Expand Down
3 changes: 2 additions & 1 deletion tests/Provider/Doctrine/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
use DH\Auditor\Tests\Provider\Doctrine\Fixtures\Entity\Standard\Blog\Comment;
use DH\Auditor\Tests\Provider\Doctrine\Fixtures\Entity\Standard\Blog\Post;
use DH\Auditor\Tests\Provider\Doctrine\Traits\ProviderConfigurationTrait;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;

/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\Small]
#[Small]
final class ConfigurationTest extends TestCase
{
use ProviderConfigurationTrait;
Expand Down
28 changes: 15 additions & 13 deletions tests/Provider/Doctrine/DoctrineProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
use DH\Auditor\User\UserInterface;
use DH\Auditor\User\UserProviderInterface;
use Exception;
use PHPUnit\Framework\Attributes\Depends;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;

/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\Small]
#[Small]
final class DoctrineProviderTest extends TestCase
{
use DoctrineProviderTrait;
Expand Down Expand Up @@ -84,7 +86,7 @@ public function testRegisterAuditingEntityManager(): void
$provider->registerAuditingService(new AuditingService('auditingEM_1', $this->createEntityManager()));
}

#[\PHPUnit\Framework\Attributes\Depends('testRegisterAuditingEntityManager')]
#[Depends('testRegisterAuditingEntityManager')]
public function testGetAuditingServiceForEntity(): void
{
$provider = $this->createUnregisteredDoctrineProvider();
Expand All @@ -94,8 +96,8 @@ public function testGetAuditingServiceForEntity(): void
$provider->getAuditingServiceForEntity('My\Fake\Entity');
}

#[\PHPUnit\Framework\Attributes\Depends('testRegisterAuditingEntityManager')]
#[\PHPUnit\Framework\Attributes\Depends('testRegisterStorageEntityManager')]
#[Depends('testRegisterAuditingEntityManager')]
#[Depends('testRegisterStorageEntityManager')]
public function testRegisterEntityManager(): void
{
$provider = $this->createUnregisteredDoctrineProvider();
Expand Down Expand Up @@ -243,7 +245,7 @@ public function testIsAuditable(): void
self::assertFalse($provider->isAuditable(Comment::class), 'Entity "'.Comment::class.'" is not auditable.');
}

#[\PHPUnit\Framework\Attributes\Depends('testIsAudited')]
#[Depends('testIsAudited')]
public function testIsAuditedHonorsEnabledFlag(): void
{
$entities = [
Expand Down Expand Up @@ -273,7 +275,7 @@ public function testIsAuditedHonorsEnabledFlag(): void
self::assertFalse($provider->isAudited(Post::class), 'Entity "'.Post::class.'" is not audited.');
}

#[\PHPUnit\Framework\Attributes\Depends('testIsAudited')]
#[Depends('testIsAudited')]
public function testIsAuditedWhenAuditIsEnabled(): void
{
$entities = [
Expand Down Expand Up @@ -305,7 +307,7 @@ public function testIsAuditedWhenAuditIsEnabled(): void
self::assertFalse($provider->isAudited(Post::class), 'Entity "'.Post::class.'" is not audited.');
}

#[\PHPUnit\Framework\Attributes\Depends('testIsAudited')]
#[Depends('testIsAudited')]
public function testIsAuditedWhenAuditIsDisabled(): void
{
$entities = [
Expand All @@ -326,7 +328,7 @@ public function testIsAuditedWhenAuditIsDisabled(): void
self::assertFalse($provider->isAudited(Post::class), 'Entity "'.Post::class.'" is not audited.');
}

#[\PHPUnit\Framework\Attributes\Depends('testIsAudited')]
#[Depends('testIsAudited')]
public function testIsAuditedFieldAuditsAnyFieldByDefault(): void
{
$entities = [
Expand All @@ -344,7 +346,7 @@ public function testIsAuditedFieldAuditsAnyFieldByDefault(): void
self::assertTrue($provider->isAuditedField(Post::class, 'updated_at'), 'Every field is audited.');
}

#[\PHPUnit\Framework\Attributes\Depends('testIsAuditedFieldAuditsAnyFieldByDefault')]
#[Depends('testIsAuditedFieldAuditsAnyFieldByDefault')]
public function testIsAuditedFieldHonorsLocallyIgnoredColumns(): void
{
$entities = [
Expand All @@ -367,7 +369,7 @@ public function testIsAuditedFieldHonorsLocallyIgnoredColumns(): void
self::assertFalse($provider->isAuditedField(Post::class, 'updated_at'), 'Field "'.Post::class.'::$updated_at" is not audited.');
}

#[\PHPUnit\Framework\Attributes\Depends('testIsAuditedFieldHonorsLocallyIgnoredColumns')]
#[Depends('testIsAuditedFieldHonorsLocallyIgnoredColumns')]
public function testIsAuditedFieldHonorsGloballyIgnoredColumns(): void
{
$entities = [
Expand All @@ -389,7 +391,7 @@ public function testIsAuditedFieldHonorsGloballyIgnoredColumns(): void
self::assertFalse($provider->isAuditedField(Post::class, 'updated_at'), 'Field "'.Post::class.'::$updated_at" is not audited.');
}

#[\PHPUnit\Framework\Attributes\Depends('testIsAuditedFieldHonorsLocallyIgnoredColumns')]
#[Depends('testIsAuditedFieldHonorsLocallyIgnoredColumns')]
public function testIsAuditedFieldReturnsFalseIfEntityIsNotAudited(): void
{
$entities = [
Expand Down Expand Up @@ -436,7 +438,7 @@ public function testLoadEntitiesWithAttributesOnly(): void
self::assertFalse($provider->isAuditedField(AuditedEntityWithAttribute::class, 'ignoredPrivateField'), 'Field "'.AuditedEntityWithAttribute::class.'::$ignoredPrivateField" is ignored.');
}

#[\PHPUnit\Framework\Attributes\Depends('testIsAuditedHonorsEnabledFlag')]
#[Depends('testIsAuditedHonorsEnabledFlag')]
public function testEnableAuditFor(): void
{
$entities = [
Expand All @@ -457,7 +459,7 @@ public function testEnableAuditFor(): void
self::assertTrue($provider->isAudited(Post::class), 'entity "'.Post::class.'" is audited.');
}

#[\PHPUnit\Framework\Attributes\Depends('testIsAuditedHonorsEnabledFlag')]
#[Depends('testIsAuditedHonorsEnabledFlag')]
public function testDisableAuditFor(): void
{
$entities = [
Expand Down
Loading

0 comments on commit 56e75a5

Please sign in to comment.