File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 17
17
namespace JBZoo \ComposerDiff ;
18
18
19
19
use Composer \Semver \Comparator ;
20
+ use Composer \Semver \VersionParser ;
20
21
21
22
final class Diff
22
23
{
@@ -103,11 +104,16 @@ public function compareWithPackage(Package $targetPackage): self
103
104
return $ this ->setMode (self ::MODE_CHANGED );
104
105
}
105
106
106
- if (Comparator::greaterThan ($ sourceVersion , $ targetVersion )) {
107
+ $ parser = new VersionParser ();
108
+
109
+ $ normalizedSource = $ parser ->normalize ($ sourceVersion );
110
+ $ normalizedTarget = $ parser ->normalize ($ targetVersion );
111
+
112
+ if (Comparator::greaterThan ($ normalizedSource , $ normalizedTarget )) {
107
113
return $ this ->setMode (self ::MODE_DOWNGRADED );
108
114
}
109
115
110
- if (Comparator::lessThan ($ sourceVersion , $ targetVersion )) {
116
+ if (Comparator::lessThan ($ normalizedSource , $ normalizedTarget )) {
111
117
return $ this ->setMode (self ::MODE_UPGRADED );
112
118
}
113
119
You can’t perform that action at this time.
0 commit comments