v2.4.0
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:
- 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->...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
