Skip to content

v2.4.0

Choose a tag to compare

@butschster butschster released this 02 Oct 10:03
· 4 commits to 2.x since this release
e60b238

What's Changed

We have enriched the type information of entity factory by integrating Psalm annotations. This enhancement facilitates developers by offering precise return type definitions.

Here's a snapshot of what has been done:

  1. For a factory, you can now clearly define the return type. Here is an example utilizing @implements FactoryInterface<...> annotation:
use Spiral\DatabaseSeeder\Factory\AbstractFactory;
use Spiral\DatabaseSeeder\Factory\FactoryInterface;
use App\Domain\User\Entity\User;

/**
 * @implements FactoryInterface<User>
 */
final class UserFactory extends AbstractFactory
{
   //...
}

With this annotation in place, your IDE will now provide suggestive autocomplete options, making the code interaction more intuitive and error-prone.

Here are examples showing how IDE suggestions would appear post this update:

$user = UserFactory::new()
            ->verified('secret')
            ->createOne();

$user->...

image

This update aims to streamline the development process by providing clearer, type-informed interactions within the codebase.

Full Changelog: v2.3.0...v2.4.0