data-fixtures icon indicating copy to clipboard operation
data-fixtures copied to clipboard

Allow to pass the class to getReference.

Open VincentLanglet opened this issue 1 year ago • 0 comments

When doing something like

$user->setContext($this->getReference(ContextFixtures::FR));

currently phpstan is reporting an error before getReference is typehinted as an object, and not a Context class.

Also, if I have a country FR and a context FR, I cannot use the same name/reference for both of those entities.

Both of this issues could be solved if we were using the method this way

$this->getReference(ContextFixtures::FR, Context::class)
  • I can use the same name for different entities of different class.
  • with some annotation psalm and phpstan can understand the class of the return value.

VincentLanglet avatar Oct 12 '22 13:10 VincentLanglet