Skip to content

Commit

Permalink
Temporarily fix deprecation (#35)
Browse files Browse the repository at this point in the history
* Temporarily fix deprecation: Return type of SmartEmailing\v3\Models\AbstractHolder::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed

* Fix tests
  • Loading branch information
stanislav-janu authored Nov 10, 2023
1 parent e866d65 commit 2f0064b
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Endpoints/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function send()

abstract public function toArray(): array;

#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->toArray();
Expand Down
1 change: 1 addition & 0 deletions src/Models/AbstractHolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function toArray(): array
/**
* @return TEntry[]
*/
#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->toArray();
Expand Down
1 change: 1 addition & 0 deletions src/Models/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ public function toArray(): array
];
}

#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->removeEmptyValues($this->toArray());
Expand Down
1 change: 1 addition & 0 deletions src/Models/ContactListStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function toArray(): array
];
}

#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->removeEmptyValues($this->toArray());
Expand Down
1 change: 1 addition & 0 deletions src/Models/Contactlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ public function toArray(): array
];
}

#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->removeEmptyValues($this->toArray());
Expand Down
1 change: 1 addition & 0 deletions src/Models/CustomFieldDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public function toArray(): array
];
}

#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->removeEmptyValues($this->toArray());
Expand Down
1 change: 1 addition & 0 deletions src/Models/CustomFieldOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public function toArray(): array
];
}

#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->removeEmptyValues($this->toArray());
Expand Down
1 change: 1 addition & 0 deletions src/Models/CustomFieldValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public function toArray(): array
];
}

#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->removeEmptyValues($this->toArray());
Expand Down
1 change: 1 addition & 0 deletions src/Models/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static function fromJSON(\stdClass $json): object
*/
abstract public function toArray(): array;

#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->toArray();
Expand Down
1 change: 1 addition & 0 deletions src/Models/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public function toArray(): array
];
}

#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->removeEmptyValues($this->toArray());
Expand Down
1 change: 1 addition & 0 deletions tests/Endpoints/Contactlists/Search/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function testDefaultEndpoint(): void

// The query parameters to send
$query = $value['query'];
$this->assertTrue(is_array($query), 'Query must be an array');
$this->assertArrayHasKey('limit', $query);
$this->assertArrayHasKey('offset', $query);
$this->assertEquals(0, $query['offset'], 'The first page should have 0 offset');
Expand Down
2 changes: 2 additions & 0 deletions tests/Endpoints/Contacts/Search/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function testDefaultEndpoint(): void

// The query parameters to send
$query = $value['query'];
$this->assertTrue(is_array($query), 'Query must be an array');
$this->assertArrayHasKey('limit', $query);
$this->assertArrayHasKey('offset', $query);
$this->assertEquals(0, $query['offset'], 'The first page should have 0 offset');
Expand All @@ -57,6 +58,7 @@ public function testFilteredEndpoint(): void

// The query parameters to send
$query = $value['query'];
$this->assertTrue(is_array($query), 'Query must be an array');
$this->assertArrayHasKey('limit', $query);
$this->assertArrayHasKey('offset', $query);
$this->assertEquals(50, $query['offset'], 'The second page should the limit value');
Expand Down
2 changes: 2 additions & 0 deletions tests/Endpoints/CustomFields/Search/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function testDefaultEndpoint(): void

// The query parameters to send
$query = $value['query'];
$this->assertTrue(is_array($query), 'Query must be an array');
$this->assertArrayHasKey('limit', $query);
$this->assertArrayHasKey('offset', $query);
$this->assertEquals(0, $query['offset'], 'The first page should have 0 offset');
Expand All @@ -58,6 +59,7 @@ public function testFilteredEndpoint(): void

// The query parameters to send
$query = $value['query'];
$this->assertTrue(is_array($query), 'Query must be an array');
$this->assertArrayHasKey('limit', $query);
$this->assertArrayHasKey('offset', $query);
$this->assertEquals(50, $query['offset'], 'The second page should the limit value');
Expand Down
1 change: 1 addition & 0 deletions tests/Mock/ModelMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function toArray(): array
];
}

#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return $this->removeEmptyValues($this->toArray());
Expand Down

0 comments on commit 2f0064b

Please sign in to comment.