Tag Model - Fixed a tag ID related bug

+ Fixed a bug that was causing Acappella to only generate out composer packages for the most recent tag in each repository
This commit is contained in:
Benjamin Blake
2020-03-31 16:13:43 -06:00
parent 027b430adc
commit cc6bd39f82

View File

@ -44,9 +44,9 @@ class Tag extends AbstractApiModel {
if (count($args) >= 2) { if (count($args) >= 2) {
$id = $args[0]; $id = $args[0];
$name = $args[1]; $name = $args[1];
if (!is_numeric($id)) { if (!is_string($id)) {
$argumentType = gettype($id); $argumentType = gettype($id);
throw new InvalidArgumentException("The \"__construct()\" function requires the 3rd parameter to be of the integer type, but a \"$argumentType\" was passed in"); throw new InvalidArgumentException("The \"__construct()\" function requires the 3rd parameter to be of the string type, but a \"$argumentType\" was passed in");
} }
if (!is_string($name)) { if (!is_string($name)) {
$argumentType = gettype($name); $argumentType = gettype($name);
@ -71,7 +71,7 @@ class Tag extends AbstractApiModel {
$newTag = new static( $newTag = new static(
$client, $client,
$caller, $caller,
isset($map->id) && is_numeric($map->id) ? $map->id : -1, isset($map->id) && is_string($map->id) ? $map->id : -1,
isset($map->name) && is_string($map->name) ? $map->name : '' isset($map->name) && is_string($map->name) ? $map->name : ''
); );
$newTag->setTarballURL(isset($map->tarball_url) && is_string($map->tarball_url) ? new Uri($map->tarball_url) : null); $newTag->setTarballURL(isset($map->tarball_url) && is_string($map->tarball_url) ? new Uri($map->tarball_url) : null);
@ -104,7 +104,7 @@ class Tag extends AbstractApiModel {
* Gets the tag identifier. * Gets the tag identifier.
* @return int The tag identifier. * @return int The tag identifier.
*/ */
function getId(): int { function getId(): string {
return $this->id; return $this->id;
} }