File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,13 @@ class PackageJsonSynchronizer
24
24
{
25
25
private $ rootDir ;
26
26
private $ vendorDir ;
27
+ private $ versionParser ;
27
28
28
29
public function __construct (string $ rootDir , string $ vendorDir = 'vendor ' )
29
30
{
30
31
$ this ->rootDir = $ rootDir ;
31
32
$ this ->vendorDir = $ vendorDir ;
33
+ $ this ->versionParser = new VersionParser ();
32
34
}
33
35
34
36
public function shouldSynchronize (): bool
@@ -169,9 +171,8 @@ private function registerDependencies(array $flexDependencies): bool
169
171
private function shouldUpdateConstraint (string $ existingConstraint , string $ constraint )
170
172
{
171
173
try {
172
- $ versionParser = new VersionParser ();
173
- $ existingConstraint = $ versionParser ->parseConstraints ($ existingConstraint );
174
- $ constraint = $ versionParser ->parseConstraints ($ constraint );
174
+ $ existingConstraint = $ this ->versionParser ->parseConstraints ($ existingConstraint );
175
+ $ constraint = $ this ->versionParser ->parseConstraints ($ constraint );
175
176
176
177
return !$ existingConstraint ->matches ($ constraint );
177
178
} catch (\UnexpectedValueException $ e ) {
You can’t perform that action at this time.
0 commit comments