Skip to content

Commit 9b0dba8

Browse files
committed
Pretty
1 parent 04e366d commit 9b0dba8

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

src/PreRelease.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,19 @@ private function validate()
6060
if ($this->hasOnlyNumbers($part)) {
6161
if (strlen($part) > 1 && $part[0] == "0") {
6262
throw new VersionFormatException(sprintf(
63-
"The prerelease part '%s' is numeric but contains a leading zero.", $part));
63+
"The prerelease part '%s' is numeric but contains a leading zero.",
64+
$part
65+
));
6466
} else {
6567
continue;
6668
}
6769
}
6870

6971
if (!$this->hasOnlyAlphanumericsAndHyphen($part)) {
7072
throw new VersionFormatException(sprintf(
71-
"The prerelease part '%s' contains invalid character.", $part));
73+
"The prerelease part '%s' contains invalid character.",
74+
$part
75+
));
7276
}
7377
}
7478
}
@@ -169,4 +173,4 @@ private static function comparePart($a, $b)
169173
? Utils::comparePrimitive(intval($a), intval($b))
170174
: Utils::comparePrimitive($a, $b);
171175
}
172-
}
176+
}

src/Utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ public static function comparePrimitive($a, $b)
1717

1818
return 0;
1919
}
20-
}
20+
}

src/Version.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@ public function getNextPatchVersion()
148148
*/
149149
public function getNextPreReleaseVersion()
150150
{
151-
return new Version($this->major,
151+
return new Version(
152+
$this->major,
152153
$this->minor,
153154
$this->isPreRelease() ? $this->patch : $this->patch + 1,
154-
$this->isPreRelease() ? $this->preRelease->increment() : PreRelease::createDefault());
155+
$this->isPreRelease() ? $this->preRelease->increment() : PreRelease::createDefault()
156+
);
155157
}
156158

157159
/**
@@ -232,15 +234,17 @@ public static function parse($versionString)
232234
throw new VersionFormatException(sprintf("Invalid version: %s.", $versionString));
233235
}
234236

235-
return new Version(intval($matches['major']),
237+
return new Version(
238+
intval($matches['major']),
236239
intval($matches['minor']),
237240
intval($matches['patch']),
238241
isset($matches['prerelease']) && $matches['prerelease'] != ""
239242
? PreRelease::parse($matches['prerelease'])
240243
: null,
241244
isset($matches['buildmetadata']) && $matches['buildmetadata'] != ""
242245
? $matches['buildmetadata']
243-
: null);
246+
: null
247+
);
244248
}
245249

246250
/**
@@ -260,11 +264,13 @@ public static function create($major, $minor, $patch, $preRelease = null, $build
260264
self::ensureValidState($minor >= 0, "The minor number must be >= 0.");
261265
self::ensureValidState($patch >= 0, "The patch number must be >= 0.");
262266

263-
return new Version($major,
267+
return new Version(
268+
$major,
264269
$minor,
265270
$patch,
266271
$preRelease != null ? PreRelease::parse($preRelease) : null,
267-
$buildMeta);
272+
$buildMeta
273+
);
268274
}
269275

270276
/**

0 commit comments

Comments
 (0)