Skip to content

Commit

Permalink
Cast the length to comply with ints provided by JSON Feed #374
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdebril committed Feb 1, 2022
1 parent aaa6f99 commit c7d0852
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/FeedIo/Feed/Item/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,20 @@ public function setUrl(?string $url) : MediaInterface
}

/**
* @return string
* @return integer
*/
public function getLength() : ? string
{
return $this->length;
}

/**
* @param string $length
* @param mixed $length
* @return MediaInterface
*/
public function setLength(?string $length) : MediaInterface
public function setLength($length) : MediaInterface
{
$this->length = $length;
$this->length = (string) intval($length);

return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/FeedIo/Feed/Item/MediaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public function setUrl(?string $url) : MediaInterface;
public function getLength() : ? string;

/**
* @param string $length
* @param mixed $length
* @return MediaInterface
*/
public function setLength(?string $length) : MediaInterface;
public function setLength($length) : MediaInterface;

/**
* @return string
Expand Down
3 changes: 2 additions & 1 deletion tests/samples/feed.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"attachments": [
{
"url": "http://localhost/some-resource.jpg",
"mime_type": "image/jpg"
"mime_type": "image/jpg",
"size_in_bytes": 12345
}
]
},
Expand Down

0 comments on commit c7d0852

Please sign in to comment.