Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 792077a

Browse files
committed
bot: fix cs [skip ci]
1 parent 833ea55 commit 792077a

10 files changed

Lines changed: 10 additions & 12 deletions

File tree

src/PHPUnit/KernelTestCaseHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static function getContainer(string $class): Container
3030
}
3131

3232
return (\Closure::bind(
33-
fn() => $class::getContainer(),
33+
static fn() => $class::getContainer(),
3434
newThis: null,
3535
newScope: $class,
3636
))();
@@ -67,7 +67,7 @@ public static function bootKernel(string $class): KernelInterface
6767
}
6868

6969
return (\Closure::bind(
70-
fn() => $class::bootKernel(),
70+
static fn() => $class::bootKernel(),
7171
newThis: null,
7272
newScope: $class,
7373
))();

src/PHPUnit/ResetDatabase/ResetDatabaseOnPreparationStarted.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private function shouldReset(Event\Code\TestMethod $test): bool
5353
{
5454
$hasResetDatabaseAttribute = AttributeReader::classOrParentsHasAttribute($test->className(), ResetDatabase::class);
5555

56-
if (!is_subclass_of($test->className(), KernelTestCase::class)) {
56+
if (!\is_subclass_of($test->className(), KernelTestCase::class)) {
5757
if ($hasResetDatabaseAttribute) {
5858
throw new \LogicException(\sprintf('Class "%s" cannot use attribute #[ResetDatabase] if it does not extend "%s".', $test->className(), KernelTestCase::class));
5959
}

src/PHPUnit/ResetDatabase/ResetDatabaseOnTestSuiteStarted.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function notify(Event\TestSuite\Started $event): void
6262
*/
6363
private function shouldReset(string $testClassName): bool
6464
{
65-
if (!is_subclass_of($testClassName, KernelTestCase::class)) {
65+
if (!\is_subclass_of($testClassName, KernelTestCase::class)) {
6666
return false;
6767
}
6868

src/Persistence/ResetDatabase/ResetDatabaseManager.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Zenstruck\Foundry\Configuration;
1919
use Zenstruck\Foundry\Exception\PersistenceNotAvailable;
2020
use Zenstruck\Foundry\Persistence\PersistenceManager;
21-
use Zenstruck\Foundry\PHPUnit\ResetDatabase\ResetDatabaseOnTestSuiteStarted;
2221
use Zenstruck\Foundry\Tests\Fixture\TestKernel;
2322

2423
/**
@@ -76,7 +75,6 @@ public static function resetBeforeEachTest(KernelInterface $kernel): void
7675
throw $e;
7776
}
7877

79-
8078
// allow this to fail if running foundry test suite
8179
return;
8280
}

src/Test/ResetDatabase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Zenstruck\Foundry\Attribute\ResetDatabase as ResetDatabaseAttribute;
1919
use Zenstruck\Foundry\Configuration;
2020
use Zenstruck\Foundry\Persistence\ResetDatabase\ResetDatabaseManager;
21-
use Zenstruck\Foundry\PHPUnit\AttributeReader;
2221
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
2322

2423
/**

tests/Integration/DataProvider/DataProviderWithPersistentFactoryTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public static function createOneObjectInDataProviderWithAfterPersistCallback():
225225
{
226226
yield [
227227
static::factory()
228-
->afterPersist(fn(GenericModel $object) => $object->setProp1('after persist callback'))
228+
->afterPersist(static fn(GenericModel $object) => $object->setProp1('after persist callback'))
229229
->create(),
230230
];
231231
}

tests/Integration/InMemory/InMemoryAttributeOnMethodTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Zenstruck\Foundry\Tests\Fixture\Entity\Address;
2525
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\Address\AddressFactory;
2626
use Zenstruck\Foundry\Tests\Integration\RequiresORM;
27+
2728
use function Zenstruck\Foundry\Persistence\delete;
2829

2930
/**

tests/Integration/Persistence/GenericFactoryUsingBeforeHooksTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111

1212
namespace Zenstruck\Foundry\Tests\Integration\Persistence;
1313

14-
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory;
1514
use PHPUnit\Framework\Attributes\Before;
1615
use PHPUnit\Framework\Attributes\Test;
1716
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1817
use Zenstruck\Foundry\Test\Factories;
1918
use Zenstruck\Foundry\Test\ResetDatabase;
19+
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory;
2020
use Zenstruck\Foundry\Tests\Integration\RequiresORM;
2121

2222
/**
2323
* @author Nicolas PHILIPPE <[email protected]>
2424
*/
2525
abstract class GenericFactoryUsingBeforeHooksTestCase extends KernelTestCase
2626
{
27-
use Factories, ResetDatabase, RequiresORM;
27+
use Factories, RequiresORM, ResetDatabase;
2828

2929
protected function setUp(): void
3030
{

tests/Integration/ResetDatabase/OrmEdgeCaseTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function it_can_use_flush_after_and_entity_from_global_state(): void
4343
$relationshipWithGlobalEntityFactory = persistent_factory(RelationshipWithGlobalEntity\RelationshipWithGlobalEntity::class);
4444
$globalEntitiesCount = persistent_factory(GlobalEntity::class)::repository()->count();
4545

46-
flush_after(function() use ($relationshipWithGlobalEntityFactory) {
46+
flush_after(static function() use ($relationshipWithGlobalEntityFactory) {
4747
$relationshipWithGlobalEntityFactory->create(['globalEntity' => GlobalStory::globalEntity()]);
4848
});
4949

utils/rector/src/ResetDatabaseAttributeRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function refactor(Node $node): ?Node
4949
);
5050

5151
if ([] === $traitUseWithResetDatabase->traits) {
52-
$node->stmts = \array_filter($node->stmts, fn(Node\Stmt $stmt) => $stmt !== $traitUseWithResetDatabase);
52+
$node->stmts = \array_filter($node->stmts, static fn(Node\Stmt $stmt) => $stmt !== $traitUseWithResetDatabase);
5353
}
5454

5555
$hasResetDatabaseTrait = (bool) $this->nodeFinder->findFirst($node->attrGroups, function(Node $node): bool {

0 commit comments

Comments
 (0)