I'm currently using doctrine/data-fixtures 1.6.3 with phpstan/phpstan 1.10.0 on the highest level.
The following Fixture code:
namespace App\DataFixtures;
use App\Entity\User;
use App\Entity\UserGroup;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
class UserFixture extends Fixture
{
public function load(ObjectManager $manager): void
{
$user = (new User())
->setLogin('user')
->addGroup($this->getReference(UserGroupFixture::GROUP_1, UserGroup::class))
->addGroup($this->getReference(UserGroupFixture::GROUP_2, UserGroup::class));
$manager->persist($user);
$manager->flush();
}
/**
* @return array<class-string<FixtureInterface>>
*/
public function getDependencies(): array
{
return [UserGroupFixture::class];
}
}
Returns the following error:
Parameter #1 $group of method App\Entity\User::addGroup() expects App\Entity\UserGroup, object given.
I'm currently using doctrine/data-fixtures 1.6.3 with phpstan/phpstan 1.10.0 on the highest level.
The following Fixture code:
Returns the following error: