What is the difference between pipe and douoble pipe in composer.json file? For example:
"^1.0.0 || ^2.0.0"
and
'^1.0.0|^2.0.0'
What is the difference between pipe and douoble pipe in composer.json file? For example:
"^1.0.0 || ^2.0.0"
and
'^1.0.0|^2.0.0'
They're the same.
If you look into the VersionParser class (https://github.com/composer/semver/blob/1dd67fe56c0587d0d119947061a6bfc9863c101c/src/VersionParser.php#L237) you can see the following code:
$orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
As we can see in the regex, they're is a ? after the second pipe, making it optional.
It seems that only the double pipe is documented though. (https://getcomposer.org/doc/articles/versions.md#range)
I thinks it´s the old syntax of the composer OR logical operator. I found this reference: http://qpleple.com/understand-composer-versions (search for the pipe character)
In the introduction it says:
Here are some extracts from Composer's documentation reorganized to better understand how package versions and stability work
but I couldn't found any reference in current composer documentation, then I assume this is from an old version of the docs