Skip to content

Commit

Permalink
Fix constructor for Version class (#521)
Browse files Browse the repository at this point in the history
* add default values to properties not sent

* release date is nullable

* name cannot be nullable

* adjust constructor of version so name can only be a string

* require a minimum of latest version of json mapper to support class-string syntax

---------

Co-authored-by: martin.reinfandt <[email protected]>
  • Loading branch information
reinfi and reinfi authored Sep 26, 2023
1 parent 25f83be commit 1306db5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"php": "^8.0",
"ext-curl": "*",
"ext-json": "*",
"netresearch/jsonmapper": "^3.0|^4.0|^5.0",
"netresearch/jsonmapper": "^4.2",
"monolog/monolog": "^2.0|^3.0"
},
"suggest": {
Expand Down
2 changes: 1 addition & 1 deletion src/Issue/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Version implements \JsonSerializable
public ?string $startDate = null;
public ?string $userStartDate = null;

public function __construct($name = null)
public function __construct(string $name)
{
$this->name = $name;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Version/VersionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function create($version)

return $this->json_mapper->map(
json_decode($ret),
new Version()
Version::class
);
}

Expand Down Expand Up @@ -71,7 +71,7 @@ public function get(string $id)

return $this->json_mapper->map(
json_decode($ret),
new Version()
Version::class
);
}

Expand Down Expand Up @@ -100,7 +100,7 @@ public function update(Version $version): Version

return $this->json_mapper->map(
json_decode($ret),
new Version()
Version::class
);
}

Expand Down

0 comments on commit 1306db5

Please sign in to comment.