This should cover all edge cases to determine somehow with which Shopware version we are interacting. We want to have a Version Constraint so we try:
is shopware/core required, take that constraint
If we cannot parse it (we don't support any composer version stuff), look into composer.lock for an exact version
If we cannot find Shopware in composer.lock, use Kernel.php of Shopware to get the fallback version.
When even that does not work, throw exception
If shopware/core is not required,
Check for Kernel.php for the fallback version
So we get at an end a constraint. But we cannot compare a constraint against another constraint. Therefore, we need to resolve the constraint to the min version of Shopware. And with that version we do version comparison, if something is available.
This should cover all edge cases to determine somehow with which Shopware version we are interacting. We want to have a Version Constraint so we try:
shopware/core
required, take that constraintcomposer.lock
, useKernel.php
of Shopware to get the fallback version.shopware/core
is not required,Kernel.php
for the fallback versionSo we get at an end a constraint. But we cannot compare a constraint against another constraint. Therefore, we need to resolve the constraint to the min version of Shopware. And with that version we do version comparison, if something is available.