Sylius: Make core model interfaces return docblocks more specific

Created on 30 Jun 2017  路  5Comments  路  Source: Sylius/Sylius

Hi, I have problem everywhere with sylius interface i.e.

$product = $productVariant->getProduct();

will return object with interface Sylius\Component\Product\Model\ProductInterface

then when I write this

$taxon = $product->getMainTaxon();

PHPstorm will show that the not exists in interface Sylius\Component\Product\Model\ProductInterface but exists in \Sylius\Component\Core\Model\ProductInterface (edited)

And problem exists for others components also

DX Enhancement Stale

Most helpful comment

This is one of the most annoying DX issues we have IMO, let's try to fix it for 1.0.0.

All 5 comments

Yes, we are aware of this. That way, there is a lot of variable type hints around Sylius, But this probably won't be resolved, as it is a trade-off, that we are probably willing to pay. Unless somebody has an idea how to make it better. Not sure, if there is any point in keeping it open? /cc @pamil @pjedrzejewski

Actually, we might end up overriding return type docblocks in Core entities so that it won't happen if traversing from another Core entity.

This is one of the most annoying DX issues we have IMO, let's try to fix it for 1.0.0.

Tried to implement it before beta.3, but return types will make it much more easier.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings