diff --git a/phpstan.neon b/phpstan.neon index 6b00bf43a..0140c0a54 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -10,6 +10,8 @@ parameters: - message: '#Return type of call to function Zenstruck\\Foundry\\Persistence\\proxy contains unresolvable type#' path: src/Persistence/ProxyRepositoryDecorator.php + - message: '#Attribute class PHPUnit\\Framework\\Attributes\\(.*) does not exist.#' + excludePaths: - tests/Fixture/Maker/expected/can_create_factory_interactively.php - tests/Fixture/Maker/expected/can_create_factory_with_embeddable_with_data_set_odm.php diff --git a/src/Test/Factories.php b/src/Test/Factories.php index 255709eff..7c22831b3 100644 --- a/src/Test/Factories.php +++ b/src/Test/Factories.php @@ -11,6 +11,8 @@ namespace Zenstruck\Foundry\Test; +use PHPUnit\Framework\Attributes\After; +use PHPUnit\Framework\Attributes\Before; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Zenstruck\Foundry\Configuration; @@ -23,6 +25,7 @@ trait Factories * @internal * @before */ + #[Before] public static function _bootFoundry(): void { if (!\is_subclass_of(static::class, KernelTestCase::class)) { // @phpstan-ignore-line @@ -47,6 +50,7 @@ public static function _bootFoundry(): void * @internal * @after */ + #[After] public static function _shutdownFoundry(): void { Configuration::shutdown(); diff --git a/src/Test/ResetDatabase.php b/src/Test/ResetDatabase.php index 6c2dc1d74..09c8f1b0f 100644 --- a/src/Test/ResetDatabase.php +++ b/src/Test/ResetDatabase.php @@ -11,6 +11,8 @@ namespace Zenstruck\Foundry\Test; +use PHPUnit\Framework\Attributes\Before; +use PHPUnit\Framework\Attributes\BeforeClass; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Zenstruck\Foundry\Persistence\PersistenceManager; @@ -23,6 +25,7 @@ trait ResetDatabase * @internal * @beforeClass */ + #[BeforeClass] public static function _resetDatabase(): void { if (!\is_subclass_of(static::class, KernelTestCase::class)) { @@ -39,6 +42,7 @@ public static function _resetDatabase(): void * @internal * @before */ + #[Before] public static function _resetSchema(): void { if (!\is_subclass_of(static::class, KernelTestCase::class)) {