Skip to content

Commit f718597

Browse files
committed
fix(location): Fix serialization of Location class
1 parent f553351 commit f718597

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55

66
## [Unreleased](https://github.com/contentful/contentful-core.php/compare/1.0.0...HEAD)
77

8+
* `Contentful\Core\Api\Location` used to provide a wrongful serialization of the longitude property. Now it correctly serializes to `lon` instead of `long`.
89
* The `Contentful\Core\Log\Timer` has been deprecated and will be removed in version 2.
910

1011
## [1.0.0](https://github.com/contentful/contentful-core.php/tree/1.0.0) (2018-04-17)

src/Api/Location.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function jsonSerialize()
6161
{
6262
return [
6363
'lat' => $this->latitude,
64-
'long' => $this->longitude,
64+
'lon' => $this->longitude,
6565
];
6666
}
6767

tests/Unit/Api/LocationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testJsonSerialization()
2828
{
2929
$loc = new Location(15.0, 17.8);
3030

31-
$this->assertJsonStringEqualsJsonString('{"lat":15,"long":17.8}', \json_encode($loc));
31+
$this->assertJsonStringEqualsJsonString('{"lat":15,"lon":17.8}', \json_encode($loc));
3232
}
3333

3434
public function testQueryStringFormatted()

0 commit comments

Comments
 (0)