Composer updates woocommerce to a version outside of specified version condition

composer

#1

My site/composer.json contains the following line to install Woocommerce plugin:

"wpackagist-plugin/woocommerce": "^3.4.2"

I have just tried updating all composer packages with “composer update” command and it updated woocommerce to 3.5.1. Is this the correct behaviour? I was expecting that it would update to a version within 3.4 and not jump to 3.5 …

Any comments welcome.


#2

Just for reference: Major.Minor.Patch (Semantic Versioning)

^ is for everything greater within the same major version. So Composer working as expected in your case.

What you want to use is ~ which does the same but within the same minor version.

Play around with this to get an idea of what the different constraints do:
https://semver.npmjs.com


#3

Awesome! thanks for a quick answer and the resource.