Skip to content

Commit

Permalink
Update ComposerJson.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwriter committed Dec 4, 2023
1 parent 2a70bec commit 69dc389
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/Service/Composer/ComposerJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

final readonly class ComposerJson {
private Package $package;
private DependencyVersion $version;

public function getVersion(): DependencyVersion
{
return $this->version;
return new DependencyVersion(
$this->contents['version'] ??
InstalledVersions::getPrettyVersion($this->contents['name'])
);
}

private PhpVersionConstraint $phpVersionConstraint;
Expand All @@ -32,11 +33,6 @@ public function __construct(
) {
$dependencyName = new DependencyName($contents['name']);

$this->version = new DependencyVersion(
$contents['version'] ??
InstalledVersions::getPrettyVersion($dependencyName->__toString())
);

$this->package = new Package($dependencyName, $this->version);

$require = $contents['require'] ?? [];
Expand Down

0 comments on commit 69dc389

Please sign in to comment.