Skip to content

Commit 1306db5

Browse files
authored
Fix constructor for Version class (#521)
* 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]>
1 parent 25f83be commit 1306db5

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"php": "^8.0",
88
"ext-curl": "*",
99
"ext-json": "*",
10-
"netresearch/jsonmapper": "^3.0|^4.0|^5.0",
10+
"netresearch/jsonmapper": "^4.2",
1111
"monolog/monolog": "^2.0|^3.0"
1212
},
1313
"suggest": {

src/Issue/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Version implements \JsonSerializable
3131
public ?string $startDate = null;
3232
public ?string $userStartDate = null;
3333

34-
public function __construct($name = null)
34+
public function __construct(string $name)
3535
{
3636
$this->name = $name;
3737
}

src/Version/VersionService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function create($version)
3535

3636
return $this->json_mapper->map(
3737
json_decode($ret),
38-
new Version()
38+
Version::class
3939
);
4040
}
4141

@@ -71,7 +71,7 @@ public function get(string $id)
7171

7272
return $this->json_mapper->map(
7373
json_decode($ret),
74-
new Version()
74+
Version::class
7575
);
7676
}
7777

@@ -100,7 +100,7 @@ public function update(Version $version): Version
100100

101101
return $this->json_mapper->map(
102102
json_decode($ret),
103-
new Version()
103+
Version::class
104104
);
105105
}
106106

0 commit comments

Comments
 (0)