Skip to content

Commit 5d2af3f

Browse files
committed
version() to always return a string
1 parent e85071f commit 5d2af3f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

composer-lock-diff

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,12 @@ function diff($key, $from, $to, $base_path) {
4747

4848
function version($pkg)
4949
{
50-
$version = null;
51-
if(substr($pkg->version,0,4) == 'dev-')
52-
{
53-
$version = substr($pkg->source->reference,0,7);
54-
}
55-
else
56-
{
57-
$version = $pkg->version;
50+
if(substr($pkg->version,0,4) == 'dev-') {
51+
$version = substr($pkg->source->reference,0,7) ?: '';
52+
} else {
53+
$version = (string) $pkg->version;
5854
}
55+
5956
return $version;
6057
}
6158

0 commit comments

Comments
 (0)