4

I'm running the static tests on one of my modules and on magento version 2.3 it reports an inconsistency:

Version must not be specified in the root and package composer JSON files in Git Failed asserting that object of class "stdClass" does not have attribute "version".

This does not happen for magento 2.2.
After some digging around I found that there is this test Magento\Test\Integrity\ComposerTest::assertNoVersionSpecified()

/**
 * Version must not be specified in the root and package composer JSON files in Git.
 *
 * All versions are added by tools during release publication by version setter tool.
 *
 * @param \StdClass $json
 */
private function assertNoVersionSpecified(\StdClass $json)
{
    $errorMessage = 'Version must not be specified in the root and package composer JSON files in Git';
    $this->assertObjectNotHasAttribute('version', $json, $errorMessage);
}

On the other hand, the official docs state that the version should be specified in composer.json: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/versioning/

I need a confirmation that the composer.json should not contain the module version anymore.
In case the answer is Yes for the question above, I could use an explanation on how does magento know the version of the modules installed via composer if the version is missing from composer.json.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.